Add a new StmtNodes.def file as a catalog of all the Stmt's. This helps

eliminate repetitive code.

llvm-svn: 39117
This commit is contained in:
Chris Lattner 2006-11-04 20:49:30 +00:00
parent 85ed873bdc
commit 6fef2fb277
3 changed files with 42 additions and 26 deletions

View File

@ -20,30 +20,8 @@ StmtVisitor::~StmtVisitor() {
// Out-of-line virtual dtor.
}
#define DELEGATE_VISITOR(FROM, TO) \
// Implement all of the delegation visitor methods.
#define STMT(FROM, TO) \
void StmtVisitor::Visit##FROM(FROM *Node) { Visit##TO(Node); }
#include "clang/AST/StmtNodes.def"
DELEGATE_VISITOR(Expr, Stmt)
// Stmt subclasses to Stmt.
DELEGATE_VISITOR(CompoundStmt, Stmt)
DELEGATE_VISITOR(IfStmt , Stmt)
DELEGATE_VISITOR(WhileStmt , Stmt)
DELEGATE_VISITOR(DoStmt , Stmt)
DELEGATE_VISITOR(ForStmt , Stmt)
DELEGATE_VISITOR(ReturnStmt , Stmt)
// Expr subclasses to Expr.
DELEGATE_VISITOR(DeclRefExpr , Expr)
DELEGATE_VISITOR(IntegerConstant , Expr)
DELEGATE_VISITOR(FloatingConstant , Expr)
DELEGATE_VISITOR(StringExpr , Expr)
DELEGATE_VISITOR(ParenExpr , Expr)
DELEGATE_VISITOR(UnaryOperator , Expr)
DELEGATE_VISITOR(SizeOfAlignOfTypeExpr, Expr)
DELEGATE_VISITOR(ArraySubscriptExpr , Expr)
DELEGATE_VISITOR(CallExpr , Expr)
DELEGATE_VISITOR(MemberExpr , Expr)
DELEGATE_VISITOR(CastExpr , Expr)
DELEGATE_VISITOR(BinaryOperator , Expr)
DELEGATE_VISITOR(ConditionalOperator , Expr)

View File

@ -124,7 +124,7 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
8DD76F6C0486A84900D96B5E /* clang */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = clang; sourceTree = BUILT_PRODUCTS_DIR; };
8DD76F6C0486A84900D96B5E /* clang */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "compiled.mach-o.executable"; path = clang; sourceTree = BUILT_PRODUCTS_DIR; };
DE06B73D0A8307640050E87E /* LangOptions.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = LangOptions.h; sourceTree = "<group>"; };
DE06BECA0A854E4B0050E87E /* Scope.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Scope.h; path = clang/Parse/Scope.h; sourceTree = "<group>"; };
DE06CC170A899E110050E87E /* Statement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Statement.cpp; path = Parse/Statement.cpp; sourceTree = "<group>"; };

View File

@ -0,0 +1,38 @@
//===-- StmtNodes.def - Metadata about Stmt AST nodes -----------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by Chris Lattner and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines the AST Node info database.
//
//===----------------------------------------------------------------------===//
// Normal Statements.
STMT(CompoundStmt, Stmt)
STMT(IfStmt , Stmt)
STMT(WhileStmt , Stmt)
STMT(DoStmt , Stmt)
STMT(ForStmt , Stmt)
STMT(ReturnStmt , Stmt)
// Expressions.
STMT(Expr , Stmt)
STMT(DeclRefExpr , Expr)
STMT(IntegerConstant , Expr)
STMT(FloatingConstant , Expr)
STMT(StringExpr , Expr)
STMT(ParenExpr , Expr)
STMT(UnaryOperator , Expr)
STMT(SizeOfAlignOfTypeExpr, Expr)
STMT(ArraySubscriptExpr , Expr)
STMT(CallExpr , Expr)
STMT(MemberExpr , Expr)
STMT(CastExpr , Expr)
STMT(BinaryOperator , Expr)
STMT(ConditionalOperator , Expr)
#undef STMT