[PATCH] D45932: [clang-tidy][modernize-raw-string-literal] Don't replace upper ASCII with raw literals

Richard via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 1 10:22:25 PDT 2018


LegalizeAdulthood accepted this revision.
LegalizeAdulthood added a comment.
This revision is now accepted and ready to land.

Other than a few minor nits, ship it.



================
Comment at: clang-tidy/modernize/RawStringLiteralCheck.cpp:110
+
+  // Upper ASCII are disallowed too.
+  for (unsigned char C = 0xFFu; C >= 0x80u; --C)
----------------
"Upper ASCII" is a misnomer.  ASCII only defines character codes 0-127.  Non-ASCII codes are what is being described here.


================
Comment at: clang-tidy/modernize/RawStringLiteralCheck.cpp:111
+  // Upper ASCII are disallowed too.
+  for (unsigned char C = 0xFFu; C >= 0x80u; --C)
+    DisallowedChars.set(C);
----------------
Why does this loop go down instead of up?  I would have expected a more conventional

for (unsigned char C = 0x80u; C <= 0xFFu; ++C)


================
Comment at: clang-tidy/modernize/RawStringLiteralCheck.h:39
   std::string DelimiterStem;
+  std::bitset<1 << CHAR_BIT> DisallowedChars;
   const bool ReplaceShorterLiterals;
----------------
Consider introducing a typedef for this ugly type name.


================
Comment at: test/clang-tidy/modernize-raw-string-literal.cpp:44
+char const *const MultibyteSnowman("\xE2\x98\x83");
+// CHECK-FIXES: {{^}}char const *const MultibyteSnowman("\xE2\x98\x83");{{$}}
 
----------------
Consider adding CHECK-FIXES lines for the other test cases that should remain unmolested by the check.


https://reviews.llvm.org/D45932





More information about the cfe-commits mailing list