diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-10-17 20:43:42 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-10-17 20:43:42 +0000 |
commit | 04f049f2f5ac3fd25643c17803603c0a3e2e8149 (patch) | |
tree | 44fc9ef3565307a5c3537e6b29f67da98e1ba0b5 /llvm/lib/Support/StringExtras.cpp | |
parent | 59449581b28440d33bdde870358bde78aaf8c157 (diff) | |
download | bcm5719-llvm-04f049f2f5ac3fd25643c17803603c0a3e2e8149.tar.gz bcm5719-llvm-04f049f2f5ac3fd25643c17803603c0a3e2e8149.zip |
Move UnescapeString to a static function for its sole client; its inefficient and broken.
llvm-svn: 84358
Diffstat (limited to 'llvm/lib/Support/StringExtras.cpp')
-rw-r--r-- | llvm/lib/Support/StringExtras.cpp | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/llvm/lib/Support/StringExtras.cpp b/llvm/lib/Support/StringExtras.cpp index 0a6e497f1ea..c72f1216534 100644 --- a/llvm/lib/Support/StringExtras.cpp +++ b/llvm/lib/Support/StringExtras.cpp @@ -56,33 +56,3 @@ void llvm::SplitString(const std::string &Source, S2 = getToken(S, Delimiters); } } - - - -/// UnescapeString - Modify the argument string, turning two character sequences -/// @verbatim -/// like '\\' 'n' into '\n'. This handles: \e \a \b \f \n \r \t \v \' \ and -/// \num (where num is a 1-3 byte octal value). -/// @endverbatim -void llvm::UnescapeString(std::string &Str) { - for (unsigned i = 0; i != Str.size(); ++i) { - if (Str[i] == '\\' && i != Str.size()-1) { - switch (Str[i+1]) { - default: continue; // Don't execute the code after the switch. - case 'a': Str[i] = '\a'; break; - case 'b': Str[i] = '\b'; break; - case 'e': Str[i] = 27; break; - case 'f': Str[i] = '\f'; break; - case 'n': Str[i] = '\n'; break; - case 'r': Str[i] = '\r'; break; - case 't': Str[i] = '\t'; break; - case 'v': Str[i] = '\v'; break; - case '"': Str[i] = '\"'; break; - case '\'': Str[i] = '\''; break; - case '\\': Str[i] = '\\'; break; - } - // Nuke the second character. - Str.erase(Str.begin()+i+1); - } - } -} |