diff --git a/clang/Lex/Lexer.cpp b/clang/Lex/Lexer.cpp index e8572ac16530..3c4bb5359485 100644 --- a/clang/Lex/Lexer.cpp +++ b/clang/Lex/Lexer.cpp @@ -341,21 +341,20 @@ FinishIdentifier: Result.SetKind(tok::identifier); // Look up this token, see if it is a macro, or if it is a language keyword. - const char *SpelledTokStart, *SpelledTokEnd; + IdentifierTokenInfo *II; if (!Result.needsCleaning()) { // No cleaning needed, just use the characters from the lexed buffer. - SpelledTokStart = IdStart; - SpelledTokEnd = IdEnd; + II = PP.getIdentifierInfo(IdStart, IdEnd); } else { // Cleaning needed, alloca a buffer, clean into it, then use the buffer. char *TmpBuf = (char*)alloca(Result.getLength()); unsigned Size = PP.getSpelling(Result, TmpBuf); - SpelledTokStart = TmpBuf; - SpelledTokEnd = TmpBuf+Size; + II = PP.getIdentifierInfo(TmpBuf, TmpBuf+Size); } + Result.SetIdentifierInfo(II); - Result.SetIdentifierInfo(PP.getIdentifierInfo(SpelledTokStart, - SpelledTokEnd)); + // Finally, now that we know we have an identifier, pass this off to the + // preprocessor, which may macro expand it or something. return PP.HandleIdentifier(Result); }