summaryrefslogtreecommitdiffstats
path: root/clang/Lex/Lexer.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-07-15 05:23:31 +0000
committerChris Lattner <sabre@nondot.org>2006-07-15 05:23:31 +0000
commitecc39e932522b89d6951e55e26689b11698a7cf2 (patch)
tree4939bbbfd227217ff190e11e6c4bf2ce49d27850 /clang/Lex/Lexer.cpp
parentb935d8cd90c0b4e70a4832fd3c566b3a63e81680 (diff)
downloadbcm5719-llvm-ecc39e932522b89d6951e55e26689b11698a7cf2.tar.gz
bcm5719-llvm-ecc39e932522b89d6951e55e26689b11698a7cf2.zip
Change Lexer::Stringify to not add ""'s around the string.
llvm-svn: 38708
Diffstat (limited to 'clang/Lex/Lexer.cpp')
-rw-r--r--clang/Lex/Lexer.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/clang/Lex/Lexer.cpp b/clang/Lex/Lexer.cpp
index cc45e1224a6..1344cfe7c8d 100644
--- a/clang/Lex/Lexer.cpp
+++ b/clang/Lex/Lexer.cpp
@@ -69,17 +69,16 @@ Lexer::Lexer(const SourceBuffer *File, unsigned fileid, Preprocessor &pp,
/// Stringify - Convert the specified string into a C string, with surrounding
/// ""'s, and with escaped \ and " characters.
-std::string Lexer::Stringify(const std::string &Str) {
+std::string Lexer::Stringify(const std::string &Str, bool Charify) {
std::string Result = Str;
+ char Quote = Charify ? '\'' : '"';
for (unsigned i = 0, e = Result.size(); i != e; ++i) {
- if (Result[i] == '\\' || Result[i] == '"') {
+ if (Result[i] == '\\' || Result[i] == Quote) {
Result.insert(Result.begin()+i, '\\');
++i; ++e;
}
}
-
- // Add quotes.
- return '"' + Result + '"';
+ return Result;
}
OpenPOWER on IntegriCloud