Use single interface, using twine, to get named metadata.
authorDevang Patel <dpatel@apple.com>
Tue, 22 Jun 2010 01:19:38 +0000 (01:19 +0000)
committerDevang Patel <dpatel@apple.com>
Tue, 22 Jun 2010 01:19:38 +0000 (01:19 +0000)
getNamedMetadata().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106518 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Module.h
lib/Analysis/DebugInfo.cpp
lib/CodeGen/AsmPrinter/DwarfDebug.cpp
lib/VMCore/Module.cpp

index 15e0a17e1e5b35020679680c9e95d477024e4115..994184f756539c3eebb98fb45c9b0f2a89025c78 100644 (file)
@@ -325,8 +325,7 @@ public:
   /// getNamedMetadata - Return the first NamedMDNode in the module with the
   /// specified name. This method returns null if a NamedMDNode with the 
   /// specified name is not found.
-  NamedMDNode *getNamedMetadata(StringRef Name) const;
-  NamedMDNode *getNamedMetadataUsingTwine(Twine Name) const;
+  NamedMDNode *getNamedMetadata(const Twine &Name) const;
 
   /// getOrInsertNamedMetadata - Return the first named MDNode in the module 
   /// with the specified name. This method returns a new NamedMDNode if a 
index fe19ff8dbdb223d2ed310fba684844b0436d23b6..feb7a303d0ecf230194581d9470024d74ff671e3 100644 (file)
@@ -1062,8 +1062,7 @@ DIVariable DIFactory::CreateVariable(unsigned Tag, DIDescriptor Context,
     char One = '\1';
     if (FName.startswith(StringRef(&One, 1)))
       FName = FName.substr(1);
-    NamedMDNode *FnLocals = 
-      M.getNamedMetadataUsingTwine(Twine("llvm.dbg.lv.", FName));
+    NamedMDNode *FnLocals = M.getNamedMetadata(Twine("llvm.dbg.lv.", FName));
     if (!FnLocals)
       FnLocals = NamedMDNode::Create(VMContext, Twine("llvm.dbg.lv.", FName),
                                      NULL, 0, &M);
index d47359c02b15695634e2a2f0cddff6a4b05389f0..89993ae9fd4192e392aeab52e0d0ce21e4185608 100644 (file)
@@ -2260,8 +2260,8 @@ void DwarfDebug::collectVariableInfo(const MachineFunction *MF) {
   const Function *F = MF->getFunction();
   const Module *M = F->getParent();
   if (NamedMDNode *NMD = 
-      M->getNamedMetadataUsingTwine(Twine("llvm.dbg.lv.", 
-                                          getRealLinkageName(F->getName())))) {
+      M->getNamedMetadata(Twine("llvm.dbg.lv.", 
+                                getRealLinkageName(F->getName())))) {
     for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) {
       DIVariable DV(cast_or_null<MDNode>(NMD->getOperand(i)));
       if (!DV || !Processed.insert(DV))
index a06911f77ad46a8731e99d2e2a97deb13598df0c..38a51dfd5d388d341cf78750c246f57c268288ed 100644 (file)
@@ -313,11 +313,7 @@ GlobalAlias *Module::getNamedAlias(StringRef Name) const {
 /// getNamedMetadata - Return the first NamedMDNode in the module with the
 /// specified name. This method returns null if a NamedMDNode with the 
 /// specified name is not found.
-NamedMDNode *Module::getNamedMetadata(StringRef Name) const {
-  return NamedMDSymTab->lookup(Name);
-}
-
-NamedMDNode *Module::getNamedMetadataUsingTwine(Twine Name) const {
+NamedMDNode *Module::getNamedMetadata(const Twine &Name) const {
   SmallString<256> NameData;
   StringRef NameRef = Name.toStringRef(NameData);
   return NamedMDSymTab->lookup(NameRef);