- Move PTHLexer::GetToken() to be inside PTHLexer.cpp.
- When lexing in raw mode, null out identifiers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59744
91177308-0d34-0410-b5e6-
96231b3b80d8
/// GetToken - Returns the next token. This method does not advance the
/// PTHLexer to the next token.
- Token GetToken() { return Tokens[CurTokenIdx]; }
+ Token GetToken();
/// AdvanceToken - Advances the PTHLexer to the next token.
void AdvanceToken() { ++CurTokenIdx; }
assert(Tokens[LastTokenIdx].is(tok::eof));
}
+Token PTHLexer::GetToken() {
+ Token Tok = Tokens[CurTokenIdx];
+
+ // If we are in raw mode, zero out identifier pointers. This is
+ // needed for 'pragma poison'. Note that this requires that the Preprocessor
+ // can go back to the original source when it calls getSpelling().
+ if (LexingRawMode && Tok.is(tok::identifier))
+ Tok.setIdentifierInfo(0);
+
+ return Tok;
+}
+
void PTHLexer::Lex(Token& Tok) {
LexNextToken:
if (AtLastToken()) {