]> granicus.if.org Git - clang/commitdiff
Preprocessor::getCurrentFileLexer() now returns a PreprocessorLexer* instead of
authorTed Kremenek <kremenek@apple.com>
Thu, 20 Nov 2008 01:49:44 +0000 (01:49 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 20 Nov 2008 01:49:44 +0000 (01:49 +0000)
a Lexer*. This means it will either return the current (normal) file Lexer or a
PTHLexer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59694 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Lex/Preprocessor.h
lib/Lex/PPLexerChange.cpp

index d803cb6a97ae0f7bd0e7554a2a0b6a8a75067f84..177c84063c539b6219878aa588d11edcd502cb50 100644 (file)
@@ -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
index 0d5147c5b265110b0ed1678623f0558229c7d128..09b60768fc7a712e936bce6a6f35b9f84139dbb6 100644 (file)
@@ -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;
 }