forked from OSchip/llvm-project
parent
5e9a878126
commit
469d357425
|
@ -25,6 +25,7 @@ using namespace clang;
|
|||
#define MAKE_VISITOR(CLASS) \
|
||||
void CLASS::visit(StmtVisitor *V) { return V->Visit ## CLASS(this); }
|
||||
|
||||
MAKE_VISITOR(Expr)
|
||||
MAKE_VISITOR(DeclRefExpr)
|
||||
MAKE_VISITOR(IntegerConstant)
|
||||
MAKE_VISITOR(FloatingConstant)
|
||||
|
|
|
@ -28,7 +28,7 @@ void Stmt::dump() const {
|
|||
if (isExpr()) std::cerr << ")";
|
||||
}
|
||||
|
||||
|
||||
void Stmt ::visit(StmtVisitor *V) { return V->VisitStmt(this); }
|
||||
void CompoundStmt::visit(StmtVisitor *V) { return V->VisitCompoundStmt(this); }
|
||||
void IfStmt ::visit(StmtVisitor *V) { return V->VisitIfStmt(this); }
|
||||
void ReturnStmt ::visit(StmtVisitor *V) { return V->VisitReturnStmt(this); }
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
DE3452810AEF1B1800DBC861 /* Stmt.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE3452800AEF1B1800DBC861 /* Stmt.h */; };
|
||||
DE345B500AFB1CFE00DBC861 /* ASTBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE345B4F0AFB1CFE00DBC861 /* ASTBuilder.cpp */; };
|
||||
DE345C1A0AFC658B00DBC861 /* StmtVisitor.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE345C190AFC658B00DBC861 /* StmtVisitor.h */; };
|
||||
DE345C570AFC69E800DBC861 /* StmtVisitor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE345C560AFC69E800DBC861 /* StmtVisitor.cpp */; };
|
||||
DE46BF280AE0A82D00CC047C /* TargetInfo.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE46BF270AE0A82D00CC047C /* TargetInfo.h */; };
|
||||
DE5932D10AD60FF400BC794C /* clang.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE5932CD0AD60FF400BC794C /* clang.cpp */; };
|
||||
DE5932D20AD60FF400BC794C /* clang.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE5932CE0AD60FF400BC794C /* clang.h */; };
|
||||
|
@ -144,6 +145,7 @@
|
|||
DE3452800AEF1B1800DBC861 /* Stmt.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Stmt.h; path = clang/AST/Stmt.h; sourceTree = "<group>"; };
|
||||
DE345B4F0AFB1CFE00DBC861 /* ASTBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = ASTBuilder.cpp; path = AST/ASTBuilder.cpp; sourceTree = "<group>"; };
|
||||
DE345C190AFC658B00DBC861 /* StmtVisitor.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = StmtVisitor.h; path = clang/AST/StmtVisitor.h; sourceTree = "<group>"; };
|
||||
DE345C560AFC69E800DBC861 /* StmtVisitor.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = StmtVisitor.cpp; path = AST/StmtVisitor.cpp; sourceTree = "<group>"; };
|
||||
DE46BF270AE0A82D00CC047C /* TargetInfo.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = TargetInfo.h; sourceTree = "<group>"; };
|
||||
DE5932CD0AD60FF400BC794C /* clang.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = clang.cpp; path = Driver/clang.cpp; sourceTree = "<group>"; };
|
||||
DE5932CE0AD60FF400BC794C /* clang.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = clang.h; path = Driver/clang.h; sourceTree = "<group>"; };
|
||||
|
@ -298,6 +300,7 @@
|
|||
DEC8DAAC0A94400300353FCA /* ASTStreamer.cpp */,
|
||||
DE0FCB330A9C21F100248FD5 /* Expr.cpp */,
|
||||
DE3452400AEF1A2D00DBC861 /* Stmt.cpp */,
|
||||
DE345C560AFC69E800DBC861 /* StmtVisitor.cpp */,
|
||||
);
|
||||
name = AST;
|
||||
sourceTree = "<group>";
|
||||
|
@ -451,6 +454,7 @@
|
|||
DE3451580AEC176100DBC861 /* MacroExpander.cpp in Sources */,
|
||||
DE3452410AEF1A2D00DBC861 /* Stmt.cpp in Sources */,
|
||||
DE345B500AFB1CFE00DBC861 /* ASTBuilder.cpp in Sources */,
|
||||
DE345C570AFC69E800DBC861 /* StmtVisitor.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
|
@ -35,6 +35,7 @@ public:
|
|||
|
||||
// FIXME: move to isa/dyncast etc.
|
||||
virtual bool isExpr() const { return true; }
|
||||
virtual void visit(StmtVisitor *Visitor);
|
||||
};
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
virtual bool isExpr() const { return false; }
|
||||
|
||||
// Implement visitor support.
|
||||
virtual void visit(StmtVisitor *Visitor) = 0;
|
||||
virtual void visit(StmtVisitor *Visitor);
|
||||
private:
|
||||
virtual void dump_impl() const = 0;
|
||||
};
|
||||
|
|
|
@ -12,10 +12,12 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_CLANG_AST_STMTVISITOR_H
|
||||
#define LLVM_CLANG_AST_STMT_H
|
||||
#define LLVM_CLANG_AST_STMTVISITOR_H
|
||||
|
||||
namespace llvm {
|
||||
namespace clang {
|
||||
class Stmt;
|
||||
class Expr;
|
||||
class CompoundStmt;
|
||||
class IfStmt;
|
||||
class ReturnStmt;
|
||||
|
@ -43,24 +45,28 @@ struct StmtVisitor {
|
|||
///
|
||||
virtual void VisitNull() {}
|
||||
|
||||
// Visitation methods for various subclasses.
|
||||
virtual void VisitCompoundStmt(CompoundStmt *Node) {}
|
||||
virtual void VisitIfStmt (IfStmt *Node) {}
|
||||
virtual void VisitReturnStmt (ReturnStmt *Node) {}
|
||||
virtual void VisitStmt(Stmt *Node) {}
|
||||
virtual void VisitExpr(Expr *Node);
|
||||
|
||||
virtual void VisitDeclRefExpr(DeclRefExpr *Node) {}
|
||||
virtual void VisitIntegerConstant(IntegerConstant *Node) {}
|
||||
virtual void VisitFloatingConstant(FloatingConstant *Node) {}
|
||||
virtual void VisitStringExpr(StringExpr *Node) {}
|
||||
virtual void VisitParenExpr(ParenExpr *Node) {}
|
||||
virtual void VisitUnaryOperator(UnaryOperator *Node) {}
|
||||
virtual void VisitSizeOfAlignOfTypeExpr(SizeOfAlignOfTypeExpr *Node) {}
|
||||
virtual void VisitArraySubscriptExpr(ArraySubscriptExpr *Node) {}
|
||||
virtual void VisitCallExpr(CallExpr *Node) {}
|
||||
virtual void VisitMemberExpr(MemberExpr *Node) {}
|
||||
virtual void VisitCastExpr(CastExpr *Node) {}
|
||||
virtual void VisitBinaryOperator(BinaryOperator *Node) {}
|
||||
virtual void VisitConditionalOperator(ConditionalOperator *Node) {}
|
||||
// Visitation methods for various Stmt subclasses.
|
||||
virtual void VisitCompoundStmt(CompoundStmt *Node);
|
||||
virtual void VisitIfStmt(IfStmt *Node);
|
||||
virtual void VisitReturnStmt(ReturnStmt *Node);
|
||||
|
||||
// Visitation methods for various Expr subclasses.
|
||||
virtual void VisitDeclRefExpr(DeclRefExpr *Node);
|
||||
virtual void VisitIntegerConstant(IntegerConstant *Node);
|
||||
virtual void VisitFloatingConstant(FloatingConstant *Node);
|
||||
virtual void VisitStringExpr(StringExpr *Node);
|
||||
virtual void VisitParenExpr(ParenExpr *Node);
|
||||
virtual void VisitUnaryOperator(UnaryOperator *Node);
|
||||
virtual void VisitSizeOfAlignOfTypeExpr(SizeOfAlignOfTypeExpr *Node);
|
||||
virtual void VisitArraySubscriptExpr(ArraySubscriptExpr *Node);
|
||||
virtual void VisitCallExpr(CallExpr *Node);
|
||||
virtual void VisitMemberExpr(MemberExpr *Node);
|
||||
virtual void VisitCastExpr(CastExpr *Node);
|
||||
virtual void VisitBinaryOperator(BinaryOperator *Node);
|
||||
virtual void VisitConditionalOperator(ConditionalOperator *Node);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue