[PATCH] D141392: Avoid u8"" literals in tests, their type changes in C++20
Jens Massberg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 10 08:14:14 PST 2023
massberg created this revision.
massberg added a reviewer: ilya-biryukov.
Herald added a project: All.
massberg requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Just specify the encoded bytes instead.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D141392
Files:
llvm/unittests/Support/formatted_raw_ostream_test.cpp
Index: llvm/unittests/Support/formatted_raw_ostream_test.cpp
===================================================================
--- llvm/unittests/Support/formatted_raw_ostream_test.cpp
+++ llvm/unittests/Support/formatted_raw_ostream_test.cpp
@@ -92,34 +92,34 @@
formatted_raw_ostream C(B);
// U+00A0 Non-breaking space: encoded as two bytes, but only one column wide.
- C << u8"\u00a0";
+ C << "\xc2\xa0";
EXPECT_EQ(0U, C.getLine());
EXPECT_EQ(1U, C.getColumn());
EXPECT_EQ(2U, C.GetNumBytesInBuffer());
// U+2468 CIRCLED DIGIT NINE: encoded as three bytes, but only one column
// wide.
- C << u8"\u2468";
+ C << "\xe2\x91\xa8";
EXPECT_EQ(0U, C.getLine());
EXPECT_EQ(2U, C.getColumn());
EXPECT_EQ(5U, C.GetNumBytesInBuffer());
// U+00010000 LINEAR B SYLLABLE B008 A: encoded as four bytes, but only one
// column wide.
- C << u8"\U00010000";
+ C << "\xf0\x90\x80\x80";
EXPECT_EQ(0U, C.getLine());
EXPECT_EQ(3U, C.getColumn());
EXPECT_EQ(9U, C.GetNumBytesInBuffer());
// U+55B5, CJK character, encodes as three bytes, takes up two columns.
- C << u8"\u55b5";
+ C << "\xe5\x96\xb5";
EXPECT_EQ(0U, C.getLine());
EXPECT_EQ(5U, C.getColumn());
EXPECT_EQ(12U, C.GetNumBytesInBuffer());
// U+200B, zero-width space, encoded as three bytes but has no effect on the
// column or line number.
- C << u8"\u200b";
+ C << "\xe2\x80\x8b";
EXPECT_EQ(0U, C.getLine());
EXPECT_EQ(5U, C.getColumn());
EXPECT_EQ(15U, C.GetNumBytesInBuffer());
@@ -137,7 +137,7 @@
// the remaining two bytes are written, at which point we can check the
// display width. In this case the display width is 1, so we end at column 4,
// with 6 bytes written into total, 2 of which are in the buffer.
- C << u8"123\u2468";
+ C << "123\xe2\x91\xa8";
EXPECT_EQ(0U, C.getLine());
EXPECT_EQ(4U, C.getColumn());
EXPECT_EQ(2U, C.GetNumBytesInBuffer());
@@ -145,7 +145,7 @@
EXPECT_EQ(6U, A.size());
// Same as above, but with a CJK character which displays as two columns.
- C << u8"123\u55b5";
+ C << "123\xe5\x96\xb5";
EXPECT_EQ(0U, C.getLine());
EXPECT_EQ(9U, C.getColumn());
EXPECT_EQ(2U, C.GetNumBytesInBuffer());
@@ -161,7 +161,7 @@
// The stream has a one-byte buffer, so it gets flushed multiple times while
// printing a single Unicode character.
- C << u8"\u2468";
+ C << "\xe2\x91\xa8";
EXPECT_EQ(0U, C.getLine());
EXPECT_EQ(1U, C.getColumn());
EXPECT_EQ(0U, C.GetNumBytesInBuffer());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141392.487812.patch
Type: text/x-patch
Size: 2501 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230110/c9766d95/attachment.bin>
More information about the llvm-commits
mailing list