Add ArrayRef variant.
authorDevang Patel <dpatel@apple.com>
Fri, 4 Mar 2011 01:20:33 +0000 (01:20 +0000)
committerDevang Patel <dpatel@apple.com>
Fri, 4 Mar 2011 01:20:33 +0000 (01:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126978 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Metadata.h
lib/VMCore/Metadata.cpp

index a6c3f039a11ec41802f5da0590c0421692b06571..6a61996ff760ad4389c630f03a2414e520bc336f 100644 (file)
@@ -17,6 +17,7 @@
 #define LLVM_METADATA_H
 
 #include "llvm/Value.h"
+#include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/ilist_node.h"
 
@@ -117,6 +118,8 @@ class MDNode : public Value, public FoldingSetNode {
                            FunctionLocalness FL, bool Insert = true);
 public:
   // Constructors and destructors.
+  static MDNode *get(LLVMContext &Context, ArrayRef<Value*> V);
+  // FIXME: Eliminate this constructor form.
   static MDNode *get(LLVMContext &Context, Value *const *Vals,
                      unsigned NumVals);
   // getWhenValsUnresolved - Construct MDNode determining function-localness
index 0b8e8dfa8b3619000b0403e0d4cd2ccd25a3e7a8..84a0975e61e3a420c8430cf8469b8128b18237bb 100644 (file)
@@ -232,6 +232,9 @@ MDNode *MDNode::getMDNode(LLVMContext &Context, Value *const *Vals,
   return N;
 }
 
+MDNode *MDNode::get(LLVMContext &Context, ArrayRef<Value*> Vals) {
+  return getMDNode(Context, Vals.data(), Vals.size(), FL_Unknown);
+}
 MDNode *MDNode::get(LLVMContext &Context, Value*const* Vals, unsigned NumVals) {
   return getMDNode(Context, Vals, NumVals, FL_Unknown);
 }