[llvm-commits] CVS: llvm/lib/VMCore/Mangler.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Nov 10 15:24:38 PST 2005



Changes in directory llvm/lib/VMCore:

Mangler.cpp updated: 1.24 -> 1.25
---
Log message:

Fix the optimized code handling of user asm strings


---
Diffs of the changes:  (+15 -8)

 Mangler.cpp |   23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)


Index: llvm/lib/VMCore/Mangler.cpp
diff -u llvm/lib/VMCore/Mangler.cpp:1.24 llvm/lib/VMCore/Mangler.cpp:1.25
--- llvm/lib/VMCore/Mangler.cpp:1.24	Thu Nov 10 15:47:01 2005
+++ llvm/lib/VMCore/Mangler.cpp	Thu Nov 10 17:24:26 2005
@@ -54,13 +54,10 @@
   } else {
     bool NeedsQuotes = false;
     
-    // If X does not start with (char)1, add the prefix.
     std::string::const_iterator I = X.begin();
-    if (*I != 1)
-      Result = Prefix;
-    else
+    if (*I == 1)
       ++I;  // Skip over the marker.
-    
+
     // If the first character is a number, we need quotes.
     if (*I >= '0' && *I <= '9')
       NeedsQuotes = true;
@@ -75,12 +72,22 @@
         }
     
     // In the common case, we don't need quotes.  Handle this quickly.
-    if (!NeedsQuotes)
-      return Result + X;
+    if (!NeedsQuotes) {
+      if (*X.begin() != 1)
+        return Prefix+X;
+      else
+        return X.substr(1);
+    }
     
     // Otherwise, construct the string the expensive way.
     I = X.begin();
-    if (*I == 1) ++I;   // Skip the marker if present.
+    
+    // If X does not start with (char)1, add the prefix.
+    if (*I != 1)
+      Result = Prefix;
+    else
+      ++I;   // Skip the marker if present.
+      
     for (std::string::const_iterator E = X.end(); I != E; ++I) {
       if (*I == '"')
         Result += "_QQ_";






More information about the llvm-commits mailing list