[cfe-commits] r39134 - in /cfe/cfe/trunk: Driver/PrintParserCallbacks.cpp Driver/clang.cpp Parse/MinimalAction.cpp include/clang/Parse/Action.h

sabre at cs.uiuc.edu sabre at cs.uiuc.edu
Wed Jul 11 09:27:53 PDT 2007


Author: sabre
Date: Wed Jul 11 11:27:53 2007
New Revision: 39134

URL: http://llvm.org/viewvc/llvm-project?rev=39134&view=rev
Log:
eliminate EmptyAction, merging it into MinimalAction instead.

Modified:
    cfe/cfe/trunk/Driver/PrintParserCallbacks.cpp
    cfe/cfe/trunk/Driver/clang.cpp
    cfe/cfe/trunk/Parse/MinimalAction.cpp
    cfe/cfe/trunk/include/clang/Parse/Action.h

Modified: cfe/cfe/trunk/Driver/PrintParserCallbacks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Driver/PrintParserCallbacks.cpp?rev=39134&r1=39133&r2=39134&view=diff

==============================================================================
--- cfe/cfe/trunk/Driver/PrintParserCallbacks.cpp (original)
+++ cfe/cfe/trunk/Driver/PrintParserCallbacks.cpp Wed Jul 11 11:27:53 2007
@@ -22,7 +22,7 @@
 using namespace clang;
 
 namespace {
-  class ParserPrintActions : public EmptyAction {
+  class ParserPrintActions : public MinimalAction {
     
     /// ParseDeclarator - This callback is invoked when a declarator is parsed
     /// and 'Init' specifies the initializer if any.  This is for things like:
@@ -38,7 +38,7 @@
       std::cout << "\n";
       
       // Pass up to EmptyActions so that the symbol table is maintained right.
-      return EmptyAction::ParseDeclarator(S, D, Init, LastInGroup);
+      return MinimalAction::ParseDeclarator(S, D, Init, LastInGroup);
     }
     
     /// PopScope - This callback is called immediately before the specified scope
@@ -47,7 +47,7 @@
       std::cout << "PopScope\n";
       
       // Pass up to EmptyActions so that the symbol table is maintained right.
-      EmptyAction::PopScope(Loc, S);
+      MinimalAction::PopScope(Loc, S);
     }
   };
 }

Modified: cfe/cfe/trunk/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Driver/clang.cpp?rev=39134&r1=39133&r2=39134&view=diff

==============================================================================
--- cfe/cfe/trunk/Driver/clang.cpp (original)
+++ cfe/cfe/trunk/Driver/clang.cpp Wed Jul 11 11:27:53 2007
@@ -942,7 +942,7 @@
     break;
 
   case ParseNoop:                    // -parse-noop
-    ParseFile(PP, new EmptyAction(), MainFileID);
+    ParseFile(PP, new MinimalAction(), MainFileID);
     break;
     
   case ParseSyntaxOnly:              // -fsyntax-only

Modified: cfe/cfe/trunk/Parse/MinimalAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/MinimalAction.cpp?rev=39134&r1=39133&r2=39134&view=diff

==============================================================================
--- cfe/cfe/trunk/Parse/MinimalAction.cpp (original)
+++ cfe/cfe/trunk/Parse/MinimalAction.cpp Wed Jul 11 11:27:53 2007
@@ -1,4 +1,4 @@
-//===--- EmptyAction.cpp - Minimalistic action implementation -------------===//
+//===--- MinimalAction.cpp - Implement the MinimalAction class ------------===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 //
-//  This file implements the EmptyAction interface.
+//  This file implements the MinimalAction interface.
 //
 //===----------------------------------------------------------------------===//
 
@@ -27,13 +27,12 @@
     isTypeName = istypename;
 	Prev = prev;
   }
-    
 };
 
 /// isTypeName - This looks at the IdentifierInfo::FETokenInfo field to
 /// determine whether the name is a type name (objc class name or typedef) or
 /// not in this scope.
-bool EmptyAction::isTypeName(const IdentifierInfo &II, Scope *S) const {
+bool MinimalAction::isTypeName(const IdentifierInfo &II, Scope *S) const {
   TypeNameInfo *TI = II.getFETokenInfo<TypeNameInfo>();
   return TI != 0 && TI->isTypeName;
 }
@@ -42,8 +41,8 @@
 /// IdentifierInfo::FETokenInfo field to keep track of this fact, until S is
 /// popped.
 Action::DeclTy *
-EmptyAction::ParseDeclarator(Scope *S, Declarator &D, ExprTy *Init,
-                             DeclTy *LastInGroup) {
+MinimalAction::ParseDeclarator(Scope *S, Declarator &D, ExprTy *Init,
+                               DeclTy *LastInGroup) {
   IdentifierInfo *II = D.getIdentifier();
   
   // If there is no identifier associated with this declarator, bail out.
@@ -69,9 +68,9 @@
 /// ParsedClassDeclaration - 
 /// Scope will always be top level file scope. 
 Action::DeclTy *
-EmptyAction::ParsedClassDeclaration(Scope *S,
-                                    IdentifierInfo **IdentList,
-                                    unsigned NumElts) {
+MinimalAction::ParsedClassDeclaration(Scope *S,
+                                      IdentifierInfo **IdentList,
+                                      unsigned NumElts) {
   for (unsigned i = 0; i != NumElts; ++i) {
     TypeNameInfo *TI =
       new TypeNameInfo(1, IdentList[i]->getFETokenInfo<TypeNameInfo>());
@@ -86,18 +85,18 @@
 
 /// PopScope - When a scope is popped, if any typedefs are now out-of-scope,
 /// they are removed from the IdentifierInfo::FETokenInfo field.
-void EmptyAction::PopScope(SourceLocation Loc, Scope *S) {
+void MinimalAction::PopScope(SourceLocation Loc, Scope *S) {
   for (Scope::decl_iterator I = S->decl_begin(), E = S->decl_end();
        I != E; ++I) {
     IdentifierInfo &II = *static_cast<IdentifierInfo*>(*I);
     TypeNameInfo *TI = II.getFETokenInfo<TypeNameInfo>();
     assert(TI && "This decl didn't get pushed??");
     
-	if (TI) {
+    if (TI) {
       TypeNameInfo *Next = TI->Prev;
       delete TI;
-    
+      
       II.setFETokenInfo(Next);
-	}
+    }
   }
 }

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

==============================================================================
--- cfe/cfe/trunk/include/clang/Parse/Action.h (original)
+++ cfe/cfe/trunk/include/clang/Parse/Action.h Wed Jul 11 11:27:53 2007
@@ -283,24 +283,6 @@
 /// quickly.
 class MinimalAction : public Action {
 public:
-};
-
-/// SemanticAction - Clients the implement this interface expect Decl nodes to 
-/// be created, name lookup to be performed, and full semantic analysis of the
-/// source program to be performed.
-class SemanticAction : public Action {
-public:
-  
-};
-
-
-
-/// EmptyAction - This is a simple (bare-minimum) implementation of the Action
-/// class, which only keeps track of which typedefs are in-scope.  This class is
-/// useful to subclass if clients want to implement some actions without having
-/// to reimplement all of the scoping rules.
-class EmptyAction : public MinimalAction {
-public:
   /// isTypeName - This looks at the IdentifierInfo::FETokenInfo field to
   /// determine whether the name is a typedef or not in this scope.
   virtual bool isTypeName(const IdentifierInfo &II, Scope *S) const;
@@ -318,10 +300,15 @@
   virtual DeclTy *ParsedClassDeclaration(Scope *S,
                                          IdentifierInfo **IdentList,
                                          unsigned NumElts);
-  
 };
 
-
+/// SemanticAction - Clients the implement this interface expect Decl nodes to 
+/// be created, name lookup to be performed, and full semantic analysis of the
+/// source program to be performed.
+class SemanticAction : public Action {
+public:
+  
+};
 
 }  // end namespace clang
 }  // end namespace llvm





More information about the cfe-commits mailing list