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

Chris Lattner sabre at nondot.org
Tue Jan 12 21:02:57 PST 2010


Author: lattner
Date: Tue Jan 12 23:02:57 2010
New Revision: 93296

URL: http://llvm.org/viewvc/llvm-project?rev=93296&view=rev
Log:
my mistake, Mangler::makeNameProper wants to take a twine, not a stringref!

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=93296&r1=93295&r2=93296&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/Mangler.h (original)
+++ llvm/trunk/include/llvm/Support/Mangler.h Tue Jan 12 23:02:57 2010
@@ -19,7 +19,7 @@
 #include <string>
 
 namespace llvm {
-class StringRef;
+class Twine;
 class Type;
 class Module;
 class Value;
@@ -112,7 +112,7 @@
   /// does this for you, so there's no point calling it on the result
   /// from getValueName.
   ///
-  std::string makeNameProper(StringRef x,
+  std::string makeNameProper(const Twine &Name,
                              ManglerPrefixTy PrefixTy = Mangler::Default);
   
   /// getNameWithPrefix - Fill OutName with the name of the appropriate prefix

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

==============================================================================
--- llvm/trunk/lib/VMCore/Mangler.cpp (original)
+++ llvm/trunk/lib/VMCore/Mangler.cpp Tue Jan 12 23:02:57 2010
@@ -16,7 +16,7 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringMap.h"
-#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/Support/raw_ostream.h"
 using namespace llvm;
 
@@ -32,8 +32,11 @@
 /// makeNameProper - We don't want identifier names non-C-identifier characters
 /// in them, so mangle them as appropriate.
 ///
-std::string Mangler::makeNameProper(StringRef X,
+std::string Mangler::makeNameProper(const Twine &TheName,
                                     ManglerPrefixTy PrefixTy) {
+  SmallString<256> TmpData;
+  TheName.toVector(TmpData);
+  StringRef X = TmpData.str();
   assert(!X.empty() && "Cannot mangle empty strings");
   
   if (!UseQuotes) {





More information about the llvm-commits mailing list