From 4f6d0733c934047e64476246b16b99f39dbe40b2 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Mon, 15 Jun 2020 13:29:38 -0700 Subject: [PATCH] [clang-tidy] use raw strings for easier readability (#882) Found with modernize-raw-string-literal Signed-off-by: Rosen Penev --- src/emitterutils.cpp | 10 +++++----- src/exp.cpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/emitterutils.cpp b/src/emitterutils.cpp index ccacc2a..0410f93 100644 --- a/src/emitterutils.cpp +++ b/src/emitterutils.cpp @@ -366,15 +366,15 @@ bool WriteChar(ostream_wrapper& out, char ch) { if (('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z')) { out << ch; } else if (ch == '\"') { - out << "\"\\\"\""; + out << R"("\"")"; } else if (ch == '\t') { - out << "\"\\t\""; + out << R"("\t")"; } else if (ch == '\n') { - out << "\"\\n\""; + out << R"("\n")"; } else if (ch == '\b') { - out << "\"\\b\""; + out << R"("\b")"; } else if (ch == '\\') { - out << "\"\\\\\""; + out << R"("\\")"; } else if (0x20 <= ch && ch <= 0x7e) { out << "\"" << ch << "\""; } else { diff --git a/src/exp.cpp b/src/exp.cpp index f05454b..992620f 100644 --- a/src/exp.cpp +++ b/src/exp.cpp @@ -105,7 +105,7 @@ std::string Escape(Stream& in) { case 'e': return "\x1B"; case ' ': - return "\x20"; + return R"( )"; case '\"': return "\""; case '\'':