[PATCH] D112247: Fix printEscapedString: Hex escape is \xHH, not \HH.
Matthias Kramm via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 21 12:11:49 PDT 2021
matthiaskramm updated this revision to Diff 381358.
matthiaskramm added a comment.
Adjust test case.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D112247/new/
https://reviews.llvm.org/D112247
Files:
llvm/lib/Support/StringExtras.cpp
llvm/unittests/ADT/StringExtrasTest.cpp
Index: llvm/unittests/ADT/StringExtrasTest.cpp
===================================================================
--- llvm/unittests/ADT/StringExtrasTest.cpp
+++ 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) {
Index: llvm/lib/Support/StringExtras.cpp
===================================================================
--- llvm/lib/Support/StringExtras.cpp
+++ 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);
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112247.381358.patch
Type: text/x-patch
Size: 884 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211021/e158ee4f/attachment.bin>
More information about the llvm-commits
mailing list