[llvm-commits] [llvm] r93641 - in /llvm/trunk: include/llvm/Support/Mangler.h lib/VMCore/Mangler.cpp

Chris Lattner sabre at nondot.org
Sat Jan 16 10:06:34 PST 2010


Author: lattner
Date: Sat Jan 16 12:06:34 2010
New Revision: 93641

URL: http://llvm.org/viewvc/llvm-project?rev=93641&view=rev
Log:
add an inefficient version of getNameWithPrefix that returns an std::string.

Modified:
    llvm/trunk/include/llvm/Support/Mangler.h
    llvm/trunk/lib/VMCore/Mangler.cpp

Modified: llvm/trunk/include/llvm/Support/Mangler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Mangler.h?rev=93641&r1=93640&r2=93641&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/Mangler.h (original)
+++ llvm/trunk/include/llvm/Support/Mangler.h Sat Jan 16 12:06:34 2010
@@ -120,6 +120,11 @@
   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_",

Modified: llvm/trunk/lib/VMCore/Mangler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Mangler.cpp?rev=93641&r1=93640&r2=93641&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/Mangler.cpp (original)
+++ llvm/trunk/lib/VMCore/Mangler.cpp Sat Jan 16 12:06:34 2010
@@ -249,6 +249,16 @@
   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)





More information about the llvm-commits mailing list