[PATCH] D159345: [Clang] Handle non-ASCII after line splicing

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 1 23:13:30 PDT 2023


cor3ntin added inline comments.


================
Comment at: clang/lib/Lex/Lexer.cpp:1761
+  getCharAndSize(CurPtr, FirstCodeUnitSize);
+  const char *CharStart = CurPtr + FirstCodeUnitSize - 1;
+  const char *UnicodePtr = CharStart;
----------------
shafik wrote:
> Do we need to verify that `FirstCodeUnitSize` is not zero?
Nope, we always get a char of getCharAndSize so it's either 1 in the normal case, or N if there are escaped newlines or trigraphs


================
Comment at: clang/lib/Lex/Lexer.cpp:1798
 
+  ConsumeChar(CurPtr, FirstCodeUnitSize, Tok);
   CurPtr = UnicodePtr;
----------------
shafik wrote:
> So if we get here it mean we have the splice to skip?
Yes. And we need to emit a diag. It's a bit subtle so i added a comment. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159345



More information about the cfe-commits mailing list