diff --git a/llvm/lib/Support/StringExtras.cpp b/llvm/lib/Support/StringExtras.cpp --- a/llvm/lib/Support/StringExtras.cpp +++ b/llvm/lib/Support/StringExtras.cpp @@ -67,7 +67,7 @@ else if (isPrint(C) && C != '"') Out << C; else - Out << '\\' << hexdigit(C >> 4) << hexdigit(C & 0x0F); + Out << "\\x" << hexdigit(C >> 4) << hexdigit(C & 0x0F); } } diff --git a/llvm/unittests/ADT/StringExtrasTest.cpp b/llvm/unittests/ADT/StringExtrasTest.cpp --- a/llvm/unittests/ADT/StringExtrasTest.cpp +++ b/llvm/unittests/ADT/StringExtrasTest.cpp @@ -124,7 +124,7 @@ std::string str; raw_string_ostream OS(str); printEscapedString("ABCdef123&<>\\\"'\t", OS); - EXPECT_EQ("ABCdef123&<>\\\\\\22'\\09", OS.str()); + EXPECT_EQ("ABCdef123&<>\\\\\\x22'\\x09", OS.str()); } TEST(StringExtrasTest, printHTMLEscaped) {