[llvm] 2bac59b - [Support] avoid u8"" literals in tests, their type changes in C++20
Sam McCall via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 10 05:00:31 PST 2023
Author: Sam McCall
Date: 2023-01-10T14:00:22+01:00
New Revision: 2bac59bab41fc8f4950b5cb630781cfa5d3a71b8
URL: https://github.com/llvm/llvm-project/commit/2bac59bab41fc8f4950b5cb630781cfa5d3a71b8
DIFF: https://github.com/llvm/llvm-project/commit/2bac59bab41fc8f4950b5cb630781cfa5d3a71b8.diff
LOG: [Support] avoid u8"" literals in tests, their type changes in C++20
Just specify the encoded bytes instead, which causes less confusion anyway.
Differential Revision: https://reviews.llvm.org/D141312
Added:
Modified:
llvm/unittests/Support/JSONTest.cpp
Removed:
################################################################################
diff --git a/llvm/unittests/Support/JSONTest.cpp b/llvm/unittests/Support/JSONTest.cpp
index ff425a0c20f3a..392a9532b660e 100644
--- a/llvm/unittests/Support/JSONTest.cpp
+++ b/llvm/unittests/Support/JSONTest.cpp
@@ -174,12 +174,16 @@ TEST(JSONTest, Parse) {
Compare(R"("\"\\\b\f\n\r\t")", "\"\\\b\f\n\r\t");
Compare(R"("\u0000")", llvm::StringRef("\0", 1));
Compare("\"\x7f\"", "\x7f");
- Compare(R"("\ud801\udc37")", u8"\U00010437"); // UTF16 surrogate pair escape.
- Compare("\"\xE2\x82\xAC\xF0\x9D\x84\x9E\"", u8"\u20ac\U0001d11e"); // UTF8
+ Compare(R"("\ud801\udc37")", // UTF-16 surrogate pair escape.
+ /*U+10437*/ "\xf0\x90\x90\xb7");
+ Compare("\"\xE2\x82\xAC\xF0\x9D\x84\x9E\"", // UTF-8
+ /*U+20AC U+1D11E*/ "\xe2\x82\xac\xf0\x9d\x84\x9e");
Compare(
- R"("LoneLeading=\ud801, LoneTrailing=\udc01, LeadingLeadingTrailing=\ud801\ud801\udc37")",
- u8"LoneLeading=\ufffd, LoneTrailing=\ufffd, "
- u8"LeadingLeadingTrailing=\ufffd\U00010437"); // Invalid unicode.
+ // Invalid unicode.
+ R"("LoneLeading=\ud801, LoneTrailing=\udc01, LeadLeadTrail=\ud801\ud801\udc37")",
+ "LoneLeading=" /*U+FFFD*/ "\xef\xbf\xbd, "
+ "LoneTrailing=" /*U+FFFD*/ "\xef\xbf\xbd, "
+ "LeadLeadTrail=" /*U+FFFD U+10437*/ "\xef\xbf\xbd\xf0\x90\x90\xb7");
Compare(R"({"":0,"":0})", Object{{"", 0}});
Compare(R"({"obj":{},"arr":[]})", Object{{"obj", Object{}}, {"arr", {}}});
More information about the llvm-commits
mailing list