IR: Make MDString inherit from Metadata

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222022 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith 2014-11-14 18:45:40 +00:00
parent 848d9223c5
commit 6bc59dcccb
2 changed files with 4 additions and 8 deletions

View File

@ -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<MDString>;
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;

View File

@ -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);