From: Argyrios Kyrtzidis Date: Fri, 22 May 2009 21:09:31 +0000 (+0000) Subject: The TokenLexer may encounter annotations if the parser enters them using Preprocessor... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6f421f91849418883186592051fce05339ee62e9;p=clang The TokenLexer may encounter annotations if the parser enters them using Preprocessor::EnterTokenStream. So check for annotation before using the Token's IdentifierInfo. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72278 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Lex/TokenLexer.cpp b/lib/Lex/TokenLexer.cpp index af56af6bd3..f1af42aea5 100644 --- a/lib/Lex/TokenLexer.cpp +++ b/lib/Lex/TokenLexer.cpp @@ -342,9 +342,10 @@ void TokenLexer::Lex(Token &Tok) { } // Handle recursive expansion! - if (IdentifierInfo *II = Tok.getIdentifierInfo()) { + if (!Tok.isAnnotation() && Tok.getIdentifierInfo() != 0) { // Change the kind of this identifier to the appropriate token kind, e.g. // turning "for" into a keyword. + IdentifierInfo *II = Tok.getIdentifierInfo(); Tok.setKind(II->getTokenID()); // If this identifier was poisoned and from a paste, emit an error. This