From cfe99dc1078cd772c6fc718d10690cfead0c9a73 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Tue, 2 Jun 2020 21:34:22 -0700 Subject: [PATCH] [clang-tidy] use raw strings for easier readability 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 3764c2b..13db97a 100644 --- a/src/emitterutils.cpp +++ b/src/emitterutils.cpp @@ -373,15 +373,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 '\'':