diff options
author | Devang Patel <dpatel@apple.com> | 2010-01-07 19:39:36 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2010-01-07 19:39:36 +0000 |
commit | 0386f01e061513094504bc11f8352a40173cada7 (patch) | |
tree | 94c2edcbcfba8906e22099dcf3a2c6ef2ebc8897 /lib/VMCore/Module.cpp | |
parent | 3c37bb8dbe886993dcd8f37dec0d94762393f3d4 (diff) |
Use separate namespace for named metadata.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92931 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Module.cpp')
-rw-r--r-- | lib/VMCore/Module.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/VMCore/Module.cpp b/lib/VMCore/Module.cpp index a7f503bacb..e25a29517a 100644 --- a/lib/VMCore/Module.cpp +++ b/lib/VMCore/Module.cpp @@ -59,6 +59,7 @@ Module::Module(StringRef MID, LLVMContext& C) : Context(C), ModuleID(MID), DataLayout("") { ValSymTab = new ValueSymbolTable(); TypeSymTab = new TypeSymbolTable(); + NamedMDSymTab = new MDSymbolTable(); } Module::~Module() { @@ -307,20 +308,25 @@ GlobalAlias *Module::getNamedAlias(StringRef Name) const { /// specified name. This method returns null if a NamedMDNode with the //// specified name is not found. NamedMDNode *Module::getNamedMetadata(StringRef Name) const { - return dyn_cast_or_null<NamedMDNode>(getValueSymbolTable().lookup(Name)); + return NamedMDSymTab->lookup(Name); } /// getOrInsertNamedMetadata - Return the first named MDNode in the module /// with the specified name. This method returns a new NamedMDNode if a /// NamedMDNode with the specified name is not found. NamedMDNode *Module::getOrInsertNamedMetadata(StringRef Name) { - NamedMDNode *NMD = - dyn_cast_or_null<NamedMDNode>(getValueSymbolTable().lookup(Name)); + NamedMDNode *NMD = NamedMDSymTab->lookup(Name); if (!NMD) NMD = NamedMDNode::Create(getContext(), Name, NULL, 0, this); return NMD; } +/// addMDNodeName - Insert an entry in the NamedMDNode symbol table mapping +/// Name to NMD. +void Module::addMDNodeName(StringRef Name, NamedMDNode *NMD) { + NamedMDSymTab->insert(Name, NMD); +} + //===----------------------------------------------------------------------===// // Methods for easy access to the types in the module. // |