aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/Mangler.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-11-10 23:24:26 +0000
committerChris Lattner <sabre@nondot.org>2005-11-10 23:24:26 +0000
commit92c4bb904fba29c5f38bbdcd7633b0d69b4c2b9a (patch)
tree5e85f7270dab0e2f0f7c528f7b384e51eadd4fed /lib/VMCore/Mangler.cpp
parent5684598f3fbebc7629e7fb2c2b5e120a99597c46 (diff)
Fix the optimized code handling of user asm strings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24296 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Mangler.cpp')
-rw-r--r--lib/VMCore/Mangler.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/lib/VMCore/Mangler.cpp b/lib/VMCore/Mangler.cpp
index 264b84c6fe..5257ca13a0 100644
--- a/lib/VMCore/Mangler.cpp
+++ b/lib/VMCore/Mangler.cpp
@@ -54,13 +54,10 @@ std::string Mangler::makeNameProper(const std::string &X, const char *Prefix) {
} 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 @@ std::string Mangler::makeNameProper(const std::string &X, const char *Prefix) {
}
// 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_";