From: Duncan P. N. Exon Smith Date: Fri, 14 Nov 2014 18:45:40 +0000 (+0000) Subject: IR: Make MDString inherit from Metadata X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=6bc59dcccb51eaedd9ba0c087c5c70fcb1748381;p=oota-llvm.git IR: Make MDString inherit from Metadata git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222022 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/IR/Metadata.h b/include/llvm/IR/Metadata.h index 7f8dca68bfa..6f38013b877 100644 --- a/include/llvm/IR/Metadata.h +++ b/include/llvm/IR/Metadata.h @@ -45,7 +45,7 @@ protected: public: static bool classof(const Value *V) { - return V->getValueID() == MDNodeVal; + return V->getValueID() == MDNodeVal || V->getValueID() == MDStringVal; } }; @@ -54,15 +54,14 @@ public: /// /// These are used to efficiently contain a byte sequence for metadata. /// MDString is always unnamed. -/// -/// TODO: Inherit from Metadata. -class MDString : public Value { +class MDString : public Metadata { friend class StringMapEntry; virtual void anchor(); MDString(const MDString &) LLVM_DELETED_FUNCTION; - explicit MDString(LLVMContext &C); + explicit MDString(LLVMContext &Context) + : Metadata(Context, Value::MDStringVal) {} /// \brief Shadow Value::getName() to prevent its use. StringRef getName() const LLVM_DELETED_FUNCTION; diff --git a/lib/IR/Metadata.cpp b/lib/IR/Metadata.cpp index 0f5f969d2f6..cdd106033f8 100644 --- a/lib/IR/Metadata.cpp +++ b/lib/IR/Metadata.cpp @@ -37,9 +37,6 @@ Metadata::Metadata(LLVMContext &Context, unsigned ID) void MDString::anchor() { } -MDString::MDString(LLVMContext &C) - : Value(Type::getMetadataTy(C), Value::MDStringVal) {} - MDString *MDString::get(LLVMContext &Context, StringRef Str) { auto &Store = Context.pImpl->MDStringCache; auto I = Store.find(Str);