Remove std::string version of getNameWithPrefix.
authorRafael Espindola <rafael.espindola@gmail.com>
Fri, 11 Feb 2011 05:23:09 +0000 (05:23 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Fri, 11 Feb 2011 05:23:09 +0000 (05:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125363 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Target/Mangler.h
lib/Target/Mangler.cpp
tools/lto/LTOCodeGenerator.cpp
tools/lto/LTOModule.cpp

index a9f3576559d49b570753c42960a7316eab6d04a4..c1c118b08cab186ccd4e8f23e4b93ff8e0c61a86 100644 (file)
@@ -15,7 +15,6 @@
 #define LLVM_SUPPORT_MANGLER_H
 
 #include "llvm/ADT/DenseMap.h"
-#include <string>
 
 namespace llvm {
 class StringRef;
@@ -69,12 +68,6 @@ public:
   /// empty.
   void getNameWithPrefix(SmallVectorImpl<char> &OutName, const Twine &GVName,
                          ManglerPrefixTy PrefixTy = Mangler::Default);
-
-  /// getNameWithPrefix - Return the name of the appropriate prefix
-  /// and the specified global variable's name.  If the global variable doesn't
-  /// have a name, this fills in a unique name for the global.
-  std::string getNameWithPrefix(const GlobalValue *GV,
-                                bool isImplicitlyPrivate = false);
 };
 
 } // End llvm namespace
index 49efe75d79d8f02e51df9aad34c7af69042d3cb0..46c687b64001dfcf1ded0ca80d261b5ceb2964fb 100644 (file)
@@ -224,16 +224,6 @@ void Mangler::getNameWithPrefix(SmallVectorImpl<char> &OutName,
   }
 }
 
-/// getNameWithPrefix - Fill OutName with the name of the appropriate prefix
-/// and the specified global variable's name.  If the global variable doesn't
-/// have a name, this fills in a unique name for the global.
-std::string Mangler::getNameWithPrefix(const GlobalValue *GV,
-                                       bool isImplicitlyPrivate) {
-  SmallString<64> Buf;
-  getNameWithPrefix(Buf, GV, isImplicitlyPrivate);
-  return std::string(Buf.begin(), Buf.end());
-}
-
 /// getSymbol - Return the MCSymbol for the specified global value.  This
 /// symbol is the main label that is the address of the global.
 MCSymbol *Mangler::getSymbol(const GlobalValue *GV) {
index 439bac19f6607c26945b1c4b144a348ccdb1259b..d102f6b899c526fc161365ed18ff45caeda40f86 100644 (file)
@@ -350,16 +350,19 @@ void LTOCodeGenerator::applyScopeRestrictions() {
     MCContext Context(*_target->getMCAsmInfo(), NULL);
     Mangler mangler(Context, *_target->getTargetData());
     std::vector<const char*> mustPreserveList;
+    SmallString<64> Buffer;
     for (Module::iterator f = mergedModule->begin(),
          e = mergedModule->end(); f != e; ++f) {
+      mangler.getNameWithPrefix(Buffer, f, false);
       if (!f->isDeclaration() &&
-          _mustPreserveSymbols.count(mangler.getNameWithPrefix(f)))
+          _mustPreserveSymbols.count(Buffer))
         mustPreserveList.push_back(::strdup(f->getNameStr().c_str()));
     }
     for (Module::global_iterator v = mergedModule->global_begin(), 
          e = mergedModule->global_end(); v !=  e; ++v) {
+      mangler.getNameWithPrefix(Buffer, v, false);
       if (!v->isDeclaration() &&
-          _mustPreserveSymbols.count(mangler.getNameWithPrefix(v)))
+          _mustPreserveSymbols.count(Buffer))
         mustPreserveList.push_back(::strdup(v->getNameStr().c_str()));
     }
     passes.add(createInternalizePass(mustPreserveList));
index ca937bf2ff080d986519d0a2cfc30d23d0c1de4c..8562f747d0ee5c41c56fe0f27082f2c2317f1bf4 100644 (file)
@@ -320,7 +320,9 @@ void LTOModule::addDefinedSymbol(GlobalValue *def, Mangler &mangler,
     return;
 
   // string is owned by _defines
-  const char *symbolName = ::strdup(mangler.getNameWithPrefix(def).c_str());
+  SmallString<64> Buffer;
+  mangler.getNameWithPrefix(Buffer, def, false);
+  const char *symbolName = ::strdup(Buffer.c_str());
 
   // set alignment part log2() can have rounding errors
   uint32_t align = def->getAlignment();
@@ -395,7 +397,8 @@ void LTOModule::addPotentialUndefinedSymbol(GlobalValue *decl,
   if (isa<GlobalAlias>(decl))
     return;
 
-  std::string name = mangler.getNameWithPrefix(decl);
+  SmallString<64> name;
+  mangler.getNameWithPrefix(name, decl, false);
 
   // we already have the symbol
   if (_undefines.find(name) != _undefines.end())