diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-10-17 20:43:29 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-10-17 20:43:29 +0000 |
commit | ca107c5c1871e38f475224db03da5b90f9fccef2 (patch) | |
tree | f70525269b68818089214ac1a525593718ddf956 /lib/Support/StringExtras.cpp | |
parent | 3446cf142eb3113679cbc11c3f63b133423d4c8b (diff) |
Remove llvm::EscapeString, raw_ostream::write_escaped is much faster.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84357 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/StringExtras.cpp')
-rw-r--r-- | lib/Support/StringExtras.cpp | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/lib/Support/StringExtras.cpp b/lib/Support/StringExtras.cpp index 1618086e60..0a6e497f1e 100644 --- a/lib/Support/StringExtras.cpp +++ b/lib/Support/StringExtras.cpp @@ -86,29 +86,3 @@ void llvm::UnescapeString(std::string &Str) { } } } - -/// EscapeString - Modify the argument string, turning '\\' and anything that -/// doesn't satisfy std::isprint into an escape sequence. -void llvm::EscapeString(std::string &Str) { - for (unsigned i = 0; i != Str.size(); ++i) { - if (Str[i] == '\\') { - ++i; - Str.insert(Str.begin()+i, '\\'); - } else if (Str[i] == '\t') { - Str[i++] = '\\'; - Str.insert(Str.begin()+i, 't'); - } else if (Str[i] == '"') { - Str.insert(Str.begin()+i++, '\\'); - } else if (Str[i] == '\n') { - Str[i++] = '\\'; - Str.insert(Str.begin()+i, 'n'); - } else if (!std::isprint(Str[i])) { - // Always expand to a 3-digit octal escape. - unsigned Char = Str[i]; - Str[i++] = '\\'; - Str.insert(Str.begin()+i++, '0'+((Char/64) & 7)); - Str.insert(Str.begin()+i++, '0'+((Char/8) & 7)); - Str.insert(Str.begin()+i , '0'+( Char & 7)); - } - } -} |