add an inefficient version of getNameWithPrefix that returns an std::string.

llvm-svn: 93641
This commit is contained in:
Chris Lattner 2010-01-16 18:06:34 +00:00
parent 46d6614388
commit d3a2163069
2 changed files with 15 additions and 0 deletions

View File

@ -120,6 +120,11 @@ public:
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);
private: private:
/// makeNameProper - We don't want identifier names with ., space, or /// makeNameProper - We don't want identifier names with ., space, or
/// - in them, so we mangle these characters into the strings "d_", /// - in them, so we mangle these characters into the strings "d_",

View File

@ -249,6 +249,16 @@ void Mangler::getNameWithPrefix(SmallVectorImpl<char> &OutName,
raw_svector_ostream(OutName) << "__unnamed_" << ID; raw_svector_ostream(OutName) << "__unnamed_" << ID;
} }
/// 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());
}
Mangler::Mangler(Module &M, const char *prefix, const char *privatePrefix, Mangler::Mangler(Module &M, const char *prefix, const char *privatePrefix,
const char *linkerPrivatePrefix) const char *linkerPrivatePrefix)