diff --git a/include/llvm/Metadata.h b/include/llvm/Metadata.h index a6c3f039a11..6a61996ff76 100644 --- a/include/llvm/Metadata.h +++ b/include/llvm/Metadata.h @@ -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 V); + // FIXME: Eliminate this constructor form. static MDNode *get(LLVMContext &Context, Value *const *Vals, unsigned NumVals); // getWhenValsUnresolved - Construct MDNode determining function-localness diff --git a/lib/VMCore/Metadata.cpp b/lib/VMCore/Metadata.cpp index 0b8e8dfa8b3..84a0975e61e 100644 --- a/lib/VMCore/Metadata.cpp +++ b/lib/VMCore/Metadata.cpp @@ -232,6 +232,9 @@ MDNode *MDNode::getMDNode(LLVMContext &Context, Value *const *Vals, return N; } +MDNode *MDNode::get(LLVMContext &Context, ArrayRef 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); }