[PATCH] D155610: [Clang][Sema] Fix display of characters on static assertion failure

Hubert Tong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 15 21:24:51 PDT 2023


hubert.reinterpretcast added inline comments.


================
Comment at: clang/lib/Sema/SemaDeclCXX.cpp:16867-16868
 
+/// Convert character's code unit value to a string.
+/// The code point needs to be zero-extended to 32-bits.
+static void WriteCharValueForDiagnostic(uint32_t Value, const BuiltinType *BTy,
----------------
Suggest wording tweaks.


================
Comment at: clang/lib/Sema/SemaDeclCXX.cpp:16894-16895
+    if (llvm::ConvertCodePointToUTF8(Value, Ptr)) {
+      for (char *I = Arr; I != Ptr; ++I)
+        OS << *I;
+    } else {
----------------
Try using `StringRef`.


================
Comment at: clang/lib/Sema/SemaDeclCXX.cpp:16897
+    } else {
+      // FIXME: This assumes Unicode literal encodings
+      OS << "\\x"
----------------
Since the function interface has been clarified, this part actually doesn't need a FIXME. The FIXME should instead be added to the comment above the function declaration.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155610/new/

https://reviews.llvm.org/D155610



More information about the cfe-commits mailing list