1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00

Fix the optimized code handling of user asm strings

llvm-svn: 24296
This commit is contained in:
Chris Lattner 2005-11-10 23:24:26 +00:00
parent e1435b7831
commit 77c3b97f5d

View File

@ -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_";