tbaeder added inline comments.

================
Comment at: clang/lib/Frontend/TextDiagnostic.cpp:121
+  unsigned CharSize = llvm::getNumBytesForUTF8(*Begin);
+  const unsigned char *End = Begin + CharSize;
 
----------------
tahonermann wrote:
> This could assign `End` to a location past the end of the source line when 
> the source line ends with an ill-formed code unit sequence (e.g., a truncated 
> 4-byte sequence). Constructing such a pointer is likely to get one in trouble.
If we use `bytes_end()` (unconditionally) we will check the entire source line 
every time we call this function (which always happens in a loop), which is 
what I was trying to avoid.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150843

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to