mirror of
https://github.com/intel/llvm.git
synced 2026-01-31 15:44:23 +08:00
Lex: Don't call getIdentifierInfo on annotation tokens
These calls are usually guarded by checks for isAnnotation() but it looks like we missed a spot. This would cause the included test to crash clang. llvm-svn: 232616
This commit is contained in:
@@ -598,7 +598,7 @@ MacroArgs *Preprocessor::ReadFunctionLikeMacroArgs(Token &MacroName,
|
||||
// If this is a comment token in the argument list and we're just in
|
||||
// -C mode (not -CC mode), discard the comment.
|
||||
continue;
|
||||
} else if (Tok.getIdentifierInfo() != nullptr) {
|
||||
} else if (!Tok.isAnnotation() && Tok.getIdentifierInfo() != nullptr) {
|
||||
// Reading macro arguments can cause macros that we are currently
|
||||
// expanding from to be popped off the expansion stack. Doing so causes
|
||||
// them to be reenabled for expansion. Here we record whether any
|
||||
|
||||
8
clang/test/Preprocessor/annotate_in_macro_arg.c
Normal file
8
clang/test/Preprocessor/annotate_in_macro_arg.c
Normal file
@@ -0,0 +1,8 @@
|
||||
// RUN: %clang_cc1 -verify %s
|
||||
#define M1() // expected-note{{macro 'M1' defined here}}
|
||||
|
||||
M1( // expected-error{{unterminated function-like macro invocation}}
|
||||
|
||||
#if M1() // expected-error{{expected value in expression}}
|
||||
#endif
|
||||
#pragma pack()
|
||||
Reference in New Issue
Block a user