aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/Lex/Preprocessor.h2
-rw-r--r--lib/Lex/PPLexerChange.cpp11
2 files changed, 7 insertions, 6 deletions
diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h
index d803cb6a97..177c84063c 100644
--- a/include/clang/Lex/Preprocessor.h
+++ b/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/lib/Lex/PPLexerChange.cpp b/lib/Lex/PPLexerChange.cpp
index 0d5147c5b2..09b60768fc 100644
--- a/lib/Lex/PPLexerChange.cpp
+++ b/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;
}