diff options
| author | Chris Lattner <sabre@nondot.org> | 2010-01-13 04:55:33 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2010-01-13 04:55:33 +0000 |
| commit | 04a7ce850de2043c3a8ea1ff6b7fd5620cd80eaa (patch) | |
| tree | 1b9fa3fee035dd7f6c7e93cec892aad8466cdaa9 /llvm/lib | |
| parent | e192d377c5533419d05c00748f720acdad985b1a (diff) | |
| download | bcm5719-llvm-04a7ce850de2043c3a8ea1ff6b7fd5620cd80eaa.tar.gz bcm5719-llvm-04a7ce850de2043c3a8ea1ff6b7fd5620cd80eaa.zip | |
change makeNameProper to take a stringref instead of std::string.
llvm-svn: 93295
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/VMCore/Mangler.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/llvm/lib/VMCore/Mangler.cpp b/llvm/lib/VMCore/Mangler.cpp index 33eb0449e82..2f546b11e46 100644 --- a/llvm/lib/VMCore/Mangler.cpp +++ b/llvm/lib/VMCore/Mangler.cpp @@ -32,7 +32,7 @@ static std::string MangleLetter(unsigned char C) { /// makeNameProper - We don't want identifier names non-C-identifier characters /// in them, so mangle them as appropriate. /// -std::string Mangler::makeNameProper(const std::string &X, +std::string Mangler::makeNameProper(StringRef X, ManglerPrefixTy PrefixTy) { assert(!X.empty() && "Cannot mangle empty strings"); @@ -41,7 +41,7 @@ std::string Mangler::makeNameProper(const std::string &X, // If X does not start with (char)1, add the prefix. bool NeedPrefix = true; - std::string::const_iterator I = X.begin(); + StringRef::iterator I = X.begin(); if (*I == 1) { NeedPrefix = false; ++I; // Skip over the marker. @@ -52,7 +52,7 @@ std::string Mangler::makeNameProper(const std::string &X, if (!SymbolsCanStartWithDigit && *I >= '0' && *I <= '9') Result += MangleLetter(*I++); - for (std::string::const_iterator E = X.end(); I != E; ++I) { + for (StringRef::iterator E = X.end(); I != E; ++I) { if (!isCharAcceptable(*I)) Result += MangleLetter(*I); else @@ -74,7 +74,7 @@ std::string Mangler::makeNameProper(const std::string &X, bool NeedPrefix = true; bool NeedQuotes = false; std::string Result; - std::string::const_iterator I = X.begin(); + StringRef::iterator I = X.begin(); if (*I == 1) { NeedPrefix = false; ++I; // Skip over the marker. @@ -87,7 +87,7 @@ std::string Mangler::makeNameProper(const std::string &X, // Do an initial scan of the string, checking to see if we need quotes or // to escape a '"' or not. if (!NeedQuotes) - for (std::string::const_iterator E = X.end(); I != E; ++I) + for (StringRef::iterator E = X.end(); I != E; ++I) if (!isCharAcceptable(*I)) { NeedQuotes = true; break; @@ -98,7 +98,7 @@ std::string Mangler::makeNameProper(const std::string &X, if (!NeedPrefix) return X.substr(1); // Strip off the \001. - Result = Prefix + X; + Result = Prefix + X.str(); if (PrefixTy == Mangler::Private) Result = PrivatePrefix + Result; @@ -109,10 +109,10 @@ std::string Mangler::makeNameProper(const std::string &X, } if (NeedPrefix) - Result = X.substr(0, I-X.begin()); + Result = X.substr(0, I-X.begin()).str(); // Otherwise, construct the string the expensive way. - for (std::string::const_iterator E = X.end(); I != E; ++I) { + for (StringRef::iterator E = X.end(); I != E; ++I) { if (*I == '"') Result += "_QQ_"; else if (*I == '\n') |

