diff options
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/include/clang/Lex/PTHLexer.h | 2 | ||||
| -rw-r--r-- | clang/lib/Lex/PTHLexer.cpp | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/clang/include/clang/Lex/PTHLexer.h b/clang/include/clang/Lex/PTHLexer.h index 8315a22f3f1..6f53c617505 100644 --- a/clang/include/clang/Lex/PTHLexer.h +++ b/clang/include/clang/Lex/PTHLexer.h @@ -68,7 +68,7 @@ private: /// 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; } diff --git a/clang/lib/Lex/PTHLexer.cpp b/clang/lib/Lex/PTHLexer.cpp index 16aca4aacbe..a88470bbad6 100644 --- a/clang/lib/Lex/PTHLexer.cpp +++ b/clang/lib/Lex/PTHLexer.cpp @@ -27,6 +27,18 @@ PTHLexer::PTHLexer(Preprocessor& pp, SourceLocation fileloc, 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()) { |

