[llvm-commits] [llvm] r93350 - in /llvm/trunk: include/llvm/MC/MCSymbol.h lib/MC/MCSymbol.cpp

Chris Lattner sabre at nondot.org
Wed Jan 13 13:09:59 PST 2010


Author: lattner
Date: Wed Jan 13 15:09:59 2010
New Revision: 93350

URL: http://llvm.org/viewvc/llvm-project?rev=93350&view=rev
Log:
expose a static function as a static method on the MCSymbol class.

Modified:
    llvm/trunk/include/llvm/MC/MCSymbol.h
    llvm/trunk/lib/MC/MCSymbol.cpp

Modified: llvm/trunk/include/llvm/MC/MCSymbol.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSymbol.h?rev=93350&r1=93349&r2=93350&view=diff

==============================================================================
--- llvm/trunk/include/llvm/MC/MCSymbol.h (original)
+++ llvm/trunk/include/llvm/MC/MCSymbol.h Wed Jan 13 15:09:59 2010
@@ -136,6 +136,11 @@
 
     /// dump - Print the value to stderr.
     void dump() const;
+    
+    /// printMangledName - Print the specified string in mangled form if it uses
+    /// any unusual characters.
+    static void printMangledName(StringRef Str, raw_ostream &OS,
+                                 const MCAsmInfo *MAI);
   };
 
 } // end namespace llvm

Modified: llvm/trunk/lib/MC/MCSymbol.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSymbol.cpp?rev=93350&r1=93349&r2=93350&view=diff

==============================================================================
--- llvm/trunk/lib/MC/MCSymbol.cpp (original)
+++ llvm/trunk/lib/MC/MCSymbol.cpp Wed Jan 13 15:09:59 2010
@@ -52,11 +52,14 @@
   return false;
 }
 
-static void PrintMangledName(raw_ostream &OS, StringRef Str,
-                             const MCAsmInfo &MAI) {
+/// printMangledName - Print the specified string in mangled form if it uses
+/// any unusual characters.
+void MCSymbol::printMangledName(StringRef Str, raw_ostream &OS,
+                                const MCAsmInfo *MAI) {
   // The first character is not allowed to be a number unless the target
   // explicitly allows it.
-  if (!MAI.doesAllowNameToStartWithDigit() && Str[0] >= '0' && Str[0] <= '9') {
+  if ((MAI == 0 || !MAI->doesAllowNameToStartWithDigit()) &&
+      Str[0] >= '0' && Str[0] <= '9') {
     MangleLetter(OS, Str[0]);
     Str = Str.substr(1);
   }
@@ -95,7 +98,7 @@
 
   // On systems that do not allow quoted names, print with mangling.
   if (!MAI->doesAllowQuotesInName())
-    return PrintMangledName(OS, getName(), *MAI);
+    return printMangledName(getName(), OS, MAI);
 
   // If the string contains a double quote or newline, we still have to mangle
   // it.





More information about the llvm-commits mailing list