add an inefficient version of getNameWithPrefix that returns an std::string.
authorChris Lattner <sabre@nondot.org>
Sat, 16 Jan 2010 18:06:34 +0000 (18:06 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 16 Jan 2010 18:06:34 +0000 (18:06 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93641 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/Mangler.h
lib/VMCore/Mangler.cpp

index aa230d48e86d391f19c08c748e3d341ce5e2459f..252a707699c7f20440b5cc8365bf2f1e09dcc9d0 100644 (file)
@@ -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_",
index 7d9f330f4c4e1e9174bb43a488cc6b10c2f813b5..9f6c9605076757a6659304206f5fa735c7d88a4c 100644 (file)
@@ -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)