[PATCH] D150843: [clang][Diagnostics] Refactor printableTextForNextCharacter

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 23 22:45:10 PDT 2023


tbaeder added inline comments.


================
Comment at: clang/lib/Frontend/TextDiagnostic.cpp:124-128
+  if (CharSize == 1 && llvm::isLegalUTF8Sequence(Begin, End) &&
+      llvm::sys::locale::isPrint(*Begin)) {
+    ++(*I);
+    return std::make_pair(SmallString<16>(Begin, End), true);
+  }
----------------
cor3ntin wrote:
> this could be simplified : the common case for ascii could be just looking at `isPrint(*Begin);` (which implies  CharSize == 1 and  llvm::isLegalUTF8Sequence(Begin, End))
> So you could do it before computing CharSize
This is not true in my testing fwiw.


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

https://reviews.llvm.org/D150843



More information about the cfe-commits mailing list