[cfe-commits] r55218 - in /cfe/trunk: include/clang/Parse/Action.h lib/Parse/Parser.cpp

Chris Lattner sabre at nondot.org
Fri Aug 22 19:06:51 PDT 2008


Author: lattner
Date: Fri Aug 22 21:06:50 2008
New Revision: 55218

URL: http://llvm.org/viewvc/llvm-project?rev=55218&view=rev
Log:
add action to know about end of translation unit.

Modified:
    cfe/trunk/include/clang/Parse/Action.h
    cfe/trunk/lib/Parse/Parser.cpp

Modified: cfe/trunk/include/clang/Parse/Action.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Action.h?rev=55218&r1=55217&r2=55218&view=diff

==============================================================================
--- cfe/trunk/include/clang/Parse/Action.h (original)
+++ cfe/trunk/include/clang/Parse/Action.h Fri Aug 22 21:06:50 2008
@@ -181,6 +181,8 @@
     return 0;
   }
   
+  virtual void ActOnEndOfTranslationUnit() {}
+  
   //===--------------------------------------------------------------------===//
   // Type Parsing Callbacks.
   //===--------------------------------------------------------------------===//

Modified: cfe/trunk/lib/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Parser.cpp?rev=55218&r1=55217&r2=55218&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/Parser.cpp (original)
+++ cfe/trunk/lib/Parse/Parser.cpp Fri Aug 22 21:06:50 2008
@@ -285,7 +285,7 @@
 ///         external-declaration
 ///         translation-unit external-declaration
 void Parser::ParseTranslationUnit() {
-  Initialize();
+  Initialize();  // pushes a scope.
 
   DeclTy *Res;
   while (!ParseTopLevelDecl(Res))
@@ -293,6 +293,8 @@
   
   ExitScope();
   assert(CurScope == 0 && "Scope imbalance!");
+  
+  Actions.ActOnEndOfTranslationUnit();
 }
 
 /// ParseExternalDeclaration:





More information about the cfe-commits mailing list