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:
David Majnemer
2015-03-18 07:53:20 +00:00
parent aaf2b84f99
commit d8dee1f54b
2 changed files with 9 additions and 1 deletions

View File

@@ -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

View 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()