Remove llvm::EscapeString, raw_ostream::write_escaped is much faster.
authorDaniel Dunbar <daniel@zuster.org>
Sat, 17 Oct 2009 20:43:29 +0000 (20:43 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Sat, 17 Oct 2009 20:43:29 +0000 (20:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84357 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/StringExtras.h
lib/Support/StringExtras.cpp

index 515cda4b298eb6cf5099f6a0ec0eb0d18512dc3b..76779fc306686a49cda23ae6e87115dcc9e89eea 100644 (file)
@@ -222,10 +222,6 @@ void SplitString(const std::string &Source,
 /// \num (where num is a 1-3 byte octal value).
 void UnescapeString(std::string &Str);
 
-/// EscapeString - Modify the argument string, turning '\\' and anything that
-/// doesn't satisfy std::isprint into an escape sequence.
-void EscapeString(std::string &Str);
-
 /// HashString - Hash funtion for strings.
 ///
 /// This is the Bernstein hash function.
index 1618086e602ea0b424488f5b2f89f98ff2d3bd73..0a6e497f1ea6728af135674d6801fad0e17e6b89 100644 (file)
@@ -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));
-    }
-  }
-}