[llvm] r222022 - IR: Make MDString inherit from Metadata
Duncan P. N. Exon Smith
dexonsmith at apple.com
Fri Nov 14 10:45:40 PST 2014
Author: dexonsmith
Date: Fri Nov 14 12:45:40 2014
New Revision: 222022
URL: http://llvm.org/viewvc/llvm-project?rev=222022&view=rev
Log:
IR: Make MDString inherit from Metadata
Modified:
llvm/trunk/include/llvm/IR/Metadata.h
llvm/trunk/lib/IR/Metadata.cpp
Modified: llvm/trunk/include/llvm/IR/Metadata.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Metadata.h?rev=222022&r1=222021&r2=222022&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Metadata.h (original)
+++ llvm/trunk/include/llvm/IR/Metadata.h Fri Nov 14 12:45:40 2014
@@ -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;
Modified: llvm/trunk/lib/IR/Metadata.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Metadata.cpp?rev=222022&r1=222021&r2=222022&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Metadata.cpp (original)
+++ llvm/trunk/lib/IR/Metadata.cpp Fri Nov 14 12:45:40 2014
@@ -37,9 +37,6 @@ Metadata::Metadata(LLVMContext &Context,
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);
More information about the llvm-commits
mailing list