[PATCH] D126651: [clang-diff] Fix getStmtValue when dealing with wide, UTF16 UTF32 chars

Johannes Altmanninger via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 7 00:45:54 PDT 2022


johannes accepted this revision.
johannes added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang/lib/Tooling/ASTDiff/ASTDiff.cpp:477
+      } else if (String->isUTF16()) {
+        const auto *Chars = reinterpret_cast<const unsigned short *>(Bytes);
+        if (!convertUTF16ToUTF8String(ArrayRef<UTF16>(Chars, NumChars),
----------------
Nit: I wonder if we should use `UTF16` instead of `unsigned int`. Is there a guiding principle?


================
Comment at: clang/lib/Tooling/ASTDiff/ASTDiff.cpp:478
+        const auto *Chars = reinterpret_cast<const unsigned short *>(Bytes);
+        if (!convertUTF16ToUTF8String(ArrayRef<UTF16>(Chars, NumChars),
+                                      UTF8Str))
----------------
Nit: is there a reason for explicitly writing the ArrayRef type? Maybe it's an LLVM convention?


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

https://reviews.llvm.org/D126651



More information about the cfe-commits mailing list