diff options
| author | Chris Lattner <sabre@nondot.org> | 2010-01-16 18:06:34 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2010-01-16 18:06:34 +0000 |
| commit | d3a21630692ccdc9bdeb4b44c2f4c8a70964cac4 (patch) | |
| tree | a4aaf1fdb44bec76574d7ac788fdb5233ed2f65a | |
| parent | 46d66143886be0c4b486f8112def441c90e5468a (diff) | |
| download | bcm5719-llvm-d3a21630692ccdc9bdeb4b44c2f4c8a70964cac4.tar.gz bcm5719-llvm-d3a21630692ccdc9bdeb4b44c2f4c8a70964cac4.zip | |
add an inefficient version of getNameWithPrefix that returns an std::string.
llvm-svn: 93641
| -rw-r--r-- | llvm/include/llvm/Support/Mangler.h | 5 | ||||
| -rw-r--r-- | llvm/lib/VMCore/Mangler.cpp | 10 |
2 files changed, 15 insertions, 0 deletions
diff --git a/llvm/include/llvm/Support/Mangler.h b/llvm/include/llvm/Support/Mangler.h index aa230d48e86..252a707699c 100644 --- a/llvm/include/llvm/Support/Mangler.h +++ b/llvm/include/llvm/Support/Mangler.h @@ -120,6 +120,11 @@ public: 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); + private: /// makeNameProper - We don't want identifier names with ., space, or /// - in them, so we mangle these characters into the strings "d_", diff --git a/llvm/lib/VMCore/Mangler.cpp b/llvm/lib/VMCore/Mangler.cpp index 7d9f330f4c4..9f6c9605076 100644 --- a/llvm/lib/VMCore/Mangler.cpp +++ b/llvm/lib/VMCore/Mangler.cpp @@ -249,6 +249,16 @@ void Mangler::getNameWithPrefix(SmallVectorImpl<char> &OutName, 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, const char *linkerPrivatePrefix) |

