eliminate EmptyAction, merging it into MinimalAction instead.

llvm-svn: 39134
This commit is contained in:
Chris Lattner 2006-11-05 18:44:26 +00:00
parent 0663d2afd9
commit c62b6c232f
4 changed files with 23 additions and 37 deletions

View File

@ -22,7 +22,7 @@ using namespace llvm;
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 @@ namespace {
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 @@ namespace {
std::cout << "PopScope\n";
// Pass up to EmptyActions so that the symbol table is maintained right.
EmptyAction::PopScope(Loc, S);
MinimalAction::PopScope(Loc, S);
}
};
}

View File

@ -942,7 +942,7 @@ int main(int argc, char **argv) {
break;
case ParseNoop: // -parse-noop
ParseFile(PP, new EmptyAction(), MainFileID);
ParseFile(PP, new MinimalAction(), MainFileID);
break;
case ParseSyntaxOnly: // -fsyntax-only

View File

@ -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 @@ struct TypeNameInfo {
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 @@ bool EmptyAction::isTypeName(const IdentifierInfo &II, Scope *S) const {
/// 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 @@ EmptyAction::ParseDeclarator(Scope *S, Declarator &D, ExprTy *Init,
/// 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 @@ EmptyAction::ParsedClassDeclaration(Scope *S,
/// 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);
}
}
}
}

View File

@ -282,24 +282,6 @@ public:
/// the parser doesn't have to build complex data structures and thus runs more
/// 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.
@ -318,10 +300,15 @@ public:
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