summaryrefslogtreecommitdiffstats
path: root/clang/Lex/Lexer.cpp
diff options
context:
space:
mode:
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