Remove std::string version of getNameWithPrefix.

llvm-svn: 125363
This commit is contained in:
Rafael Espindola 2011-02-11 05:23:09 +00:00
parent 5662dfefad
commit 34b59389ea
4 changed files with 10 additions and 21 deletions

View File

@ -15,7 +15,6 @@
#define LLVM_SUPPORT_MANGLER_H #define LLVM_SUPPORT_MANGLER_H
#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseMap.h"
#include <string>
namespace llvm { namespace llvm {
class StringRef; class StringRef;
@ -69,12 +68,6 @@ public:
/// empty. /// empty.
void getNameWithPrefix(SmallVectorImpl<char> &OutName, const Twine &GVName, void getNameWithPrefix(SmallVectorImpl<char> &OutName, const Twine &GVName,
ManglerPrefixTy PrefixTy = Mangler::Default); 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 } // End llvm namespace

View 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 /// getSymbol - Return the MCSymbol for the specified global value. This
/// symbol is the main label that is the address of the global. /// symbol is the main label that is the address of the global.
MCSymbol *Mangler::getSymbol(const GlobalValue *GV) { MCSymbol *Mangler::getSymbol(const GlobalValue *GV) {

View File

@ -350,16 +350,19 @@ void LTOCodeGenerator::applyScopeRestrictions() {
MCContext Context(*_target->getMCAsmInfo(), NULL); MCContext Context(*_target->getMCAsmInfo(), NULL);
Mangler mangler(Context, *_target->getTargetData()); Mangler mangler(Context, *_target->getTargetData());
std::vector<const char*> mustPreserveList; std::vector<const char*> mustPreserveList;
SmallString<64> Buffer;
for (Module::iterator f = mergedModule->begin(), for (Module::iterator f = mergedModule->begin(),
e = mergedModule->end(); f != e; ++f) { e = mergedModule->end(); f != e; ++f) {
mangler.getNameWithPrefix(Buffer, f, false);
if (!f->isDeclaration() && if (!f->isDeclaration() &&
_mustPreserveSymbols.count(mangler.getNameWithPrefix(f))) _mustPreserveSymbols.count(Buffer))
mustPreserveList.push_back(::strdup(f->getNameStr().c_str())); mustPreserveList.push_back(::strdup(f->getNameStr().c_str()));
} }
for (Module::global_iterator v = mergedModule->global_begin(), for (Module::global_iterator v = mergedModule->global_begin(),
e = mergedModule->global_end(); v != e; ++v) { e = mergedModule->global_end(); v != e; ++v) {
mangler.getNameWithPrefix(Buffer, v, false);
if (!v->isDeclaration() && if (!v->isDeclaration() &&
_mustPreserveSymbols.count(mangler.getNameWithPrefix(v))) _mustPreserveSymbols.count(Buffer))
mustPreserveList.push_back(::strdup(v->getNameStr().c_str())); mustPreserveList.push_back(::strdup(v->getNameStr().c_str()));
} }
passes.add(createInternalizePass(mustPreserveList)); passes.add(createInternalizePass(mustPreserveList));

View File

@ -320,7 +320,9 @@ void LTOModule::addDefinedSymbol(GlobalValue *def, Mangler &mangler,
return; return;
// string is owned by _defines // 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 // set alignment part log2() can have rounding errors
uint32_t align = def->getAlignment(); uint32_t align = def->getAlignment();
@ -395,7 +397,8 @@ void LTOModule::addPotentialUndefinedSymbol(GlobalValue *decl,
if (isa<GlobalAlias>(decl)) if (isa<GlobalAlias>(decl))
return; return;
std::string name = mangler.getNameWithPrefix(decl); SmallString<64> name;
mangler.getNameWithPrefix(name, decl, false);
// we already have the symbol // we already have the symbol
if (_undefines.find(name) != _undefines.end()) if (_undefines.find(name) != _undefines.end())