diff options
| author | Ted Kremenek <kremenek@apple.com> | 2008-11-20 01:49:44 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2008-11-20 01:49:44 +0000 |
| commit | b33ce32bda743baf56a4640fc9bbb477088063aa (patch) | |
| tree | 5ac6090a238841cd6f7138cf8106c277545a01d1 | |
| parent | 300590b5841d462e7c6373a16ba999aaa455e1e2 (diff) | |
| download | bcm5719-llvm-b33ce32bda743baf56a4640fc9bbb477088063aa.tar.gz bcm5719-llvm-b33ce32bda743baf56a4640fc9bbb477088063aa.zip | |
Preprocessor::getCurrentFileLexer() now returns a PreprocessorLexer* instead of
a Lexer*. This means it will either return the current (normal) file Lexer or a
PTHLexer.
llvm-svn: 59694
| -rw-r--r-- | clang/include/clang/Lex/Preprocessor.h | 2 | ||||
| -rw-r--r-- | clang/lib/Lex/PPLexerChange.cpp | 11 |
2 files changed, 7 insertions, 6 deletions
diff --git a/clang/include/clang/Lex/Preprocessor.h b/clang/include/clang/Lex/Preprocessor.h index d803cb6a97a..177c84063c5 100644 --- a/clang/include/clang/Lex/Preprocessor.h +++ b/clang/include/clang/Lex/Preprocessor.h @@ -211,7 +211,7 @@ public: /// getCurrentLexer - Return the current file lexer being lexed from. Note /// that this ignores any potentially active macro expansions and _Pragma /// expansions going on at the time. - Lexer *getCurrentFileLexer() const; + PreprocessorLexer *getCurrentFileLexer() const; /// getPPCallbacks/setPPCallbacks - Accessors for preprocessor callbacks. /// Note that this class takes ownership of any PPCallbacks object given to diff --git a/clang/lib/Lex/PPLexerChange.cpp b/clang/lib/Lex/PPLexerChange.cpp index 0d5147c5b26..09b60768fc7 100644 --- a/clang/lib/Lex/PPLexerChange.cpp +++ b/clang/lib/Lex/PPLexerChange.cpp @@ -43,14 +43,15 @@ bool Preprocessor::isInPrimaryFile() const { /// getCurrentLexer - Return the current file lexer being lexed from. Note /// that this ignores any potentially active macro expansions and _Pragma /// expansions going on at the time. -Lexer *Preprocessor::getCurrentFileLexer() const { - if (CurLexer && !CurLexer->Is_PragmaLexer) return CurLexer.get(); +PreprocessorLexer *Preprocessor::getCurrentFileLexer() const { + if (IsNonPragmaNonMacroLexer()) + return CurPPLexer; // Look for a stacked lexer. for (unsigned i = IncludeMacroStack.size(); i != 0; --i) { - Lexer *L = IncludeMacroStack[i-1].TheLexer; - if (L && !L->Is_PragmaLexer) // Ignore macro & _Pragma expansions. - return L; + const IncludeStackInfo& ISI = IncludeMacroStack[i-1]; + if (IsNonPragmaNonMacroLexer(ISI)) + return ISI.ThePPLexer; } return 0; } |

