[cfe-commits] r59694 - in /cfe/trunk: include/clang/Lex/Preprocessor.h lib/Lex/PPLexerChange.cpp
Ted Kremenek
kremenek at apple.com
Wed Nov 19 17:49:45 PST 2008
Author: kremenek
Date: Wed Nov 19 19:49:44 2008
New Revision: 59694
URL: http://llvm.org/viewvc/llvm-project?rev=59694&view=rev
Log:
Preprocessor::getCurrentFileLexer() now returns a PreprocessorLexer* instead of
a Lexer*. This means it will either return the current (normal) file Lexer or a
PTHLexer.
Modified:
cfe/trunk/include/clang/Lex/Preprocessor.h
cfe/trunk/lib/Lex/PPLexerChange.cpp
Modified: cfe/trunk/include/clang/Lex/Preprocessor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/Preprocessor.h?rev=59694&r1=59693&r2=59694&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/Preprocessor.h (original)
+++ cfe/trunk/include/clang/Lex/Preprocessor.h Wed Nov 19 19:49:44 2008
@@ -211,7 +211,7 @@
/// 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
Modified: cfe/trunk/lib/Lex/PPLexerChange.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPLexerChange.cpp?rev=59694&r1=59693&r2=59694&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPLexerChange.cpp (original)
+++ cfe/trunk/lib/Lex/PPLexerChange.cpp Wed Nov 19 19:49:44 2008
@@ -43,14 +43,15 @@
/// 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;
}
More information about the cfe-commits
mailing list