teach EscapeString and UnescapeString to handle ".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69211 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2009-04-15 20:12:52 +00:00
parent 8818b8f443
commit d7fd2126c2

View File

@ -77,6 +77,7 @@ void llvm::UnescapeString(std::string &Str) {
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;
}
@ -96,6 +97,8 @@ void llvm::EscapeString(std::string &Str) {
} 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');