[PATCH] D144054: [Lex] Fix a crash in updateConsecutiveMacroArgTokens.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 14 15:48:46 PST 2023


hokein added inline comments.


================
Comment at: clang/test/Lexer/update_consecutive_macro_crash.cpp:8
+void foo() {
+  X(int{,}); // expected-error {{too many arguments provided to function-like macro invocation}} \
+                 expected-error {{expected expression}} \
----------------
More details about the issue :

- due to the error recovery, the clang lexer inserts a pair of `()` around the macro argument `int{,}`, so we will see [`(`, `int`, `{`, `,`, `}`, `)`] tokens
- however, the size of file id for the macro argument only take account the written tokens which are [`int`, `{`, `,`, `}`], and the extra inserted `)` token is at the `Limit` source location which triggers an empty `Partition`. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144054



More information about the cfe-commits mailing list