[cfe-commits] r42173 - in /cfe/trunk/include/clang/Analysis: CFGRecStmtDeclVisitor.h CFGRecStmtVisitor.h CFGStmtVisitor.h CFGVarDeclVisitor.h CFGVisitors/ CFGVisitors/CFGRecStmtDeclVisitor.h CFGVisitors/CFGRecStmtVisitor.h CFGVisitors/CFGStmtVisitor.h CFGVisitors/CFGVarDeclVisitor.h CFGVisitors/DataflowStmtVisitor.h DataflowStmtVisitor.h
Ted Kremenek
kremenek at apple.com
Thu Sep 20 14:40:36 PDT 2007
Author: kremenek
Date: Thu Sep 20 16:40:36 2007
New Revision: 42173
URL: http://llvm.org/viewvc/llvm-project?rev=42173&view=rev
Log:
Moved include/clang/Analysis/*Visitor.h to include/clang/Analysis/CFGVisitors.
We had enough visitors that it was cluttering the Analysis directory.
Added:
cfe/trunk/include/clang/Analysis/CFGVisitors/
cfe/trunk/include/clang/Analysis/CFGVisitors/CFGRecStmtDeclVisitor.h
- copied, changed from r42162, cfe/trunk/include/clang/Analysis/CFGRecStmtDeclVisitor.h
cfe/trunk/include/clang/Analysis/CFGVisitors/CFGRecStmtVisitor.h
- copied, changed from r42162, cfe/trunk/include/clang/Analysis/CFGRecStmtVisitor.h
cfe/trunk/include/clang/Analysis/CFGVisitors/CFGStmtVisitor.h
- copied unchanged from r42162, cfe/trunk/include/clang/Analysis/CFGStmtVisitor.h
cfe/trunk/include/clang/Analysis/CFGVisitors/CFGVarDeclVisitor.h
- copied, changed from r42162, cfe/trunk/include/clang/Analysis/CFGVarDeclVisitor.h
cfe/trunk/include/clang/Analysis/CFGVisitors/DataflowStmtVisitor.h
- copied, changed from r42162, cfe/trunk/include/clang/Analysis/DataflowStmtVisitor.h
Removed:
cfe/trunk/include/clang/Analysis/CFGRecStmtDeclVisitor.h
cfe/trunk/include/clang/Analysis/CFGRecStmtVisitor.h
cfe/trunk/include/clang/Analysis/CFGStmtVisitor.h
cfe/trunk/include/clang/Analysis/CFGVarDeclVisitor.h
cfe/trunk/include/clang/Analysis/DataflowStmtVisitor.h
Removed: cfe/trunk/include/clang/Analysis/CFGRecStmtDeclVisitor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/CFGRecStmtDeclVisitor.h?rev=42172&view=auto
==============================================================================
--- cfe/trunk/include/clang/Analysis/CFGRecStmtDeclVisitor.h (original)
+++ cfe/trunk/include/clang/Analysis/CFGRecStmtDeclVisitor.h (removed)
@@ -1,88 +0,0 @@
-//= CFGRecStmtDeclVisitor - Recursive visitor of CFG stmts/decls -*- C++ --*-=//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file was developed by Ted Kremenek and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements the template class CFGRecStmtDeclVisitor, which extends
-// CFGRecStmtVisitor by implementing (typed) visitation of decls.
-//
-// FIXME: This may not be fully complete. We currently explore only subtypes
-// of ScopedDecl.
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_ANALYSIS_CFG_REC_STMT_DECL_VISITOR_H
-#define LLVM_CLANG_ANALYSIS_CFG_REC_STMT_DECL_VISITOR_H
-
-#include "clang/Analysis/CFGRecStmtVisitor.h"
-#include "clang/AST/Decl.h"
-
-#define DISPATCH_CASE(CASE,CLASS) \
-case Decl::CASE: \
-static_cast<ImplClass*>(this)->Visit##CLASS(static_cast<CLASS*>(D));\
-break;
-
-#define DEFAULT_DISPATCH(CLASS) void Visit##CLASS(CLASS* D) {}
-
-namespace clang {
-template <typename ImplClass>
-class CFGRecStmtDeclVisitor : public CFGRecStmtVisitor<ImplClass> {
-public:
-
- void VisitDeclRefExpr(DeclRefExpr* DR) {
- static_cast<ImplClass*>(this)->VisitDeclChain(DR->getDecl());
- }
-
- void VisitDeclStmt(DeclStmt* DS) {
- static_cast<ImplClass*>(this)->VisitDeclChain(DS->getDecl());
- }
-
- void VisitDeclChain(ScopedDecl* D) {
- for (; D != NULL; D = D->getNextDeclarator())
- static_cast<ImplClass*>(this)->VisitScopedDecl(D);
- }
-
- void VisitScopedDecl(ScopedDecl* D) {
- switch (D->getKind()) {
- DISPATCH_CASE(Function,FunctionDecl)
- DISPATCH_CASE(BlockVariable,BlockVarDecl) // FIXME:Refine. VisitVarDecl?
- DISPATCH_CASE(FileVariable,FileVarDecl) // FIXME: (same)
- DISPATCH_CASE(ParmVariable,ParmVarDecl) // FIXME: (same)
- DISPATCH_CASE(EnumConstant,EnumConstantDecl)
- DISPATCH_CASE(Typedef,TypedefDecl)
- DISPATCH_CASE(Struct,RecordDecl) // FIXME: Refine. VisitStructDecl?
- DISPATCH_CASE(Union,RecordDecl) // FIXME: Refine.
- DISPATCH_CASE(Class,RecordDecl) // FIXME: Refine.
- DISPATCH_CASE(Enum,EnumDecl)
- DISPATCH_CASE(ObjcInterface,ObjcInterfaceDecl)
- DISPATCH_CASE(ObjcClass,ObjcClassDecl)
- DISPATCH_CASE(ObjcProtocol,ObjcProtocolDecl)
- DISPATCH_CASE(ObjcCategory,ObjcCategoryDecl)
- default:
- assert(false && "Subtype of ScopedDecl not handled.");
- }
- }
-
- DEFAULT_DISPATCH(FunctionDecl)
- DEFAULT_DISPATCH(BlockVarDecl)
- DEFAULT_DISPATCH(FileVarDecl)
- DEFAULT_DISPATCH(ParmVarDecl)
- DEFAULT_DISPATCH(EnumConstantDecl)
- DEFAULT_DISPATCH(TypedefDecl)
- DEFAULT_DISPATCH(RecordDecl)
- DEFAULT_DISPATCH(EnumDecl)
- DEFAULT_DISPATCH(ObjcInterfaceDecl)
- DEFAULT_DISPATCH(ObjcClassDecl)
- DEFAULT_DISPATCH(ObjcMethodDecl)
- DEFAULT_DISPATCH(ObjcProtocolDecl)
- DEFAULT_DISPATCH(ObjcCategoryDecl)
-};
-
-} // end namespace clang
-
-#undef DISPATCH_CASE
-#undef DEFAULT_DISPATCH
-#endif
Removed: cfe/trunk/include/clang/Analysis/CFGRecStmtVisitor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/CFGRecStmtVisitor.h?rev=42172&view=auto
==============================================================================
--- cfe/trunk/include/clang/Analysis/CFGRecStmtVisitor.h (original)
+++ cfe/trunk/include/clang/Analysis/CFGRecStmtVisitor.h (removed)
@@ -1,41 +0,0 @@
-//==- CFGRecStmtVisitor - Recursive visitor of CFG statements ---*- C++ --*-==//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file was developed by Ted Kremenek and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements the template class CFGRecStmtVisitor, which extends
-// CFGStmtVisitor by implementing a default recursive visit of all statements.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_ANALYSIS_CFG_REC_STMT_VISITOR_H
-#define LLVM_CLANG_ANALYSIS_CFG_REC_STMT_VISITOR_H
-
-#include "clang/Analysis/CFGStmtVisitor.h"
-
-namespace clang {
-template <typename ImplClass>
-class CFGRecStmtVisitor : public CFGStmtVisitor<ImplClass,void> {
-public:
-
- void Visit(Stmt* S) {
- static_cast< CFGStmtVisitor<ImplClass>* >(this)->Visit(S);
- static_cast< ImplClass* >(this)->VisitChildren(S);
- }
-
- void BlockStmt_Visit(Stmt* S) {
- static_cast< CFGStmtVisitor<ImplClass>* >(this)->BlockStmt_Visit(S);
- static_cast< ImplClass* >(this)->VisitChildren(S);
- }
-
- // Defining operator() allows the visitor to be used as a C++ style functor.
- void operator()(Stmt* S) { static_cast<ImplClass*>(this)->BlockStmt_Visit(S);}
-};
-
-} // end namespace clang
-
-#endif
Removed: cfe/trunk/include/clang/Analysis/CFGStmtVisitor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/CFGStmtVisitor.h?rev=42172&view=auto
==============================================================================
--- cfe/trunk/include/clang/Analysis/CFGStmtVisitor.h (original)
+++ cfe/trunk/include/clang/Analysis/CFGStmtVisitor.h (removed)
@@ -1,108 +0,0 @@
-//===--- CFGStmtVisitor.h - Visitor for Stmts in a CFG ----------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file was developed by Ted Kremenek and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the CFGStmtVisitor interface, which extends
-// StmtVisitor. This interface is useful for visiting statements in a CFG
-// where some statements have implicit control-flow and thus should
-// be treated specially.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_ANALYSIS_CFGSTMTVISITOR_H
-#define LLVM_CLANG_ANALYSIS_CFGSTMTVISITOR_H
-
-#include "clang/AST/StmtVisitor.h"
-#include "clang/AST/CFG.h"
-
-namespace clang {
-
-#define DISPATCH_CASE(CLASS) \
-case Stmt::CLASS ## Class: return \
-static_cast<ImplClass*>(this)->BlockStmt_Visit ## CLASS(static_cast<CLASS*>(S));
-
-#define DEFAULT_BLOCKSTMT_VISIT(CLASS) RetTy BlockStmt_Visit ## CLASS(CLASS *S)\
-{ return\
- static_cast<ImplClass*>(this)->BlockStmt_VisitImplicitControlFlowExpr(\
- cast<Expr>(S)); }
-
-template <typename ImplClass, typename RetTy=void>
-class CFGStmtVisitor : public StmtVisitor<ImplClass,RetTy> {
-public:
- /// BlockVisit_XXX - Visitor methods for visiting the "root" statements in
- /// CFGBlocks. Root statements are the statements that appear explicitly in
- /// the list of statements in a CFGBlock. For substatements, or when there
- /// is no implementation provided for a BlockStmt_XXX method, we default
- /// to using StmtVisitor's Visit method.
- RetTy BlockStmt_Visit(Stmt* S) {
- switch (S->getStmtClass()) {
- DISPATCH_CASE(CallExpr)
- DISPATCH_CASE(StmtExpr)
- DISPATCH_CASE(ConditionalOperator)
-
- case Stmt::BinaryOperatorClass: {
- BinaryOperator* B = cast<BinaryOperator>(S);
- if (B->isLogicalOp())
- return static_cast<ImplClass*>(this)->BlockStmt_VisitLogicalOp(B);
- else if (B->getOpcode() == BinaryOperator::Comma)
- return static_cast<ImplClass*>(this)->BlockStmt_VisitComma(B);
- // Fall through.
- }
-
- default:
- if (isa<Expr>(S))
- return
- static_cast<ImplClass*>(this)->BlockStmt_VisitExpr(cast<Expr>(S));
- else
- return static_cast<ImplClass*>(this)->BlockStmt_VisitStmt(S);
- }
- }
-
- DEFAULT_BLOCKSTMT_VISIT(CallExpr)
- DEFAULT_BLOCKSTMT_VISIT(StmtExpr)
- DEFAULT_BLOCKSTMT_VISIT(ConditionalOperator)
-
- RetTy BlockStmt_VisitImplicitControlFlowExpr(Expr* E) {
- return static_cast<ImplClass*>(this)->BlockStmt_VisitExpr(E);
- }
-
- RetTy BlockStmt_VisitExpr(Expr* E) {
- return static_cast<ImplClass*>(this)->BlockStmt_VisitStmt(E);
- }
-
- RetTy BlockStmt_VisitStmt(Stmt* S) {
- return static_cast<ImplClass*>(this)->Visit(S);
- }
-
- RetTy BlockStmt_VisitLogicalOp(BinaryOperator* B) {
- return
- static_cast<ImplClass*>(this)->BlockStmt_VisitImplicitControlFlowExpr(B);
- }
-
- RetTy BlockStmt_VisitComma(BinaryOperator* B) {
- return
- static_cast<ImplClass*>(this)->BlockStmt_VisitImplicitControlFlowExpr(B);
- }
-
- //===--------------------------------------------------------------------===//
- // Utility methods. Not called by default (but subclasses may use them).
- //===--------------------------------------------------------------------===//
-
- /// VisitChildren: Call "Visit" on each child of S.
- void VisitChildren(Stmt* S) {
- for (Stmt::child_iterator I=S->child_begin(), E=S->child_end(); I != E;++I)
- static_cast<ImplClass*>(this)->Visit(*I);
- }
-};
-
-#undef DEFAULT_BLOCKSTMT_VISIT
-#undef DISPATCH_CASE
-
-} // end namespace clang
-
-#endif
Removed: cfe/trunk/include/clang/Analysis/CFGVarDeclVisitor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/CFGVarDeclVisitor.h?rev=42172&view=auto
==============================================================================
--- cfe/trunk/include/clang/Analysis/CFGVarDeclVisitor.h (original)
+++ cfe/trunk/include/clang/Analysis/CFGVarDeclVisitor.h (removed)
@@ -1,64 +0,0 @@
-//==- CFGVarDeclVisitor - Generic visitor of VarDecls in a CFG --*- C++ --*-==//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file was developed by Ted Kremenek and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements the template class CFGVarDeclVisitor, which provides
-// a generic way to visit all the VarDecl's in a CFG.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_ANALYSIS_CFG_VARDECL_VISITOR_H
-#define LLVM_CLANG_ANALYSIS_CFG_VARDECL_VISITOR_H
-
-#include "clang/Analysis/CFGStmtVisitor.h"
-#include "clang/AST/Decl.h"
-#include "clang/AST/Stmt.h"
-#include "clang/AST/CFG.h"
-
-namespace clang {
-
-template <typename ImplClass>
-class CFGVarDeclVisitor : public CFGStmtVisitor<ImplClass> {
- const CFG& cfg;
-public:
- CFGVarDeclVisitor(const CFG& c) : cfg(c) {}
-
- void VisitStmt(Stmt* S) {
- static_cast<ImplClass*>(this)->VisitChildren(S);
- }
-
- void VisitDeclRefExpr(DeclRefExpr* DR) {
- static_cast<ImplClass*>(this)->VisitDeclChain(DR->getDecl());
- }
-
- void VisitDeclStmt(DeclStmt* DS) {
- static_cast<ImplClass*>(this)->VisitDeclChain(DS->getDecl());
- }
-
- void VisitDeclChain(ScopedDecl* D) {
- for (; D != NULL ; D = D->getNextDeclarator())
- static_cast<ImplClass*>(this)->VisitScopedDecl(D);
- }
-
- void VisitScopedDecl(ScopedDecl* D) {
- if (VarDecl* V = dyn_cast<VarDecl>(D))
- static_cast<ImplClass*>(this)->VisitVarDecl(V);
- }
-
- void VisitVarDecl(VarDecl* D) {}
-
- void VisitAllDecls() {
- for (CFG::const_iterator BI = cfg.begin(), BE = cfg.end(); BI != BE; ++BI)
- for (CFGBlock::const_iterator SI=BI->begin(),SE = BI->end();SI != SE;++SI)
- static_cast<ImplClass*>(this)->BlockStmt_Visit(const_cast<Stmt*>(*SI));
- }
-};
-
-} // end namespace clang
-
-#endif
Copied: cfe/trunk/include/clang/Analysis/CFGVisitors/CFGRecStmtDeclVisitor.h (from r42162, cfe/trunk/include/clang/Analysis/CFGRecStmtDeclVisitor.h)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/CFGVisitors/CFGRecStmtDeclVisitor.h?p2=cfe/trunk/include/clang/Analysis/CFGVisitors/CFGRecStmtDeclVisitor.h&p1=cfe/trunk/include/clang/Analysis/CFGRecStmtDeclVisitor.h&r1=42162&r2=42173&rev=42173&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/CFGRecStmtDeclVisitor.h (original)
+++ cfe/trunk/include/clang/Analysis/CFGVisitors/CFGRecStmtDeclVisitor.h Thu Sep 20 16:40:36 2007
@@ -17,7 +17,7 @@
#ifndef LLVM_CLANG_ANALYSIS_CFG_REC_STMT_DECL_VISITOR_H
#define LLVM_CLANG_ANALYSIS_CFG_REC_STMT_DECL_VISITOR_H
-#include "clang/Analysis/CFGRecStmtVisitor.h"
+#include "clang/Analysis/Visitors/CFGRecStmtVisitor.h"
#include "clang/AST/Decl.h"
#define DISPATCH_CASE(CASE,CLASS) \
Copied: cfe/trunk/include/clang/Analysis/CFGVisitors/CFGRecStmtVisitor.h (from r42162, cfe/trunk/include/clang/Analysis/CFGRecStmtVisitor.h)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/CFGVisitors/CFGRecStmtVisitor.h?p2=cfe/trunk/include/clang/Analysis/CFGVisitors/CFGRecStmtVisitor.h&p1=cfe/trunk/include/clang/Analysis/CFGRecStmtVisitor.h&r1=42162&r2=42173&rev=42173&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/CFGRecStmtVisitor.h (original)
+++ cfe/trunk/include/clang/Analysis/CFGVisitors/CFGRecStmtVisitor.h Thu Sep 20 16:40:36 2007
@@ -15,7 +15,7 @@
#ifndef LLVM_CLANG_ANALYSIS_CFG_REC_STMT_VISITOR_H
#define LLVM_CLANG_ANALYSIS_CFG_REC_STMT_VISITOR_H
-#include "clang/Analysis/CFGStmtVisitor.h"
+#include "clang/Analysis/Visitors/CFGStmtVisitor.h"
namespace clang {
template <typename ImplClass>
Copied: cfe/trunk/include/clang/Analysis/CFGVisitors/CFGVarDeclVisitor.h (from r42162, cfe/trunk/include/clang/Analysis/CFGVarDeclVisitor.h)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/CFGVisitors/CFGVarDeclVisitor.h?p2=cfe/trunk/include/clang/Analysis/CFGVisitors/CFGVarDeclVisitor.h&p1=cfe/trunk/include/clang/Analysis/CFGVarDeclVisitor.h&r1=42162&r2=42173&rev=42173&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/CFGVarDeclVisitor.h (original)
+++ cfe/trunk/include/clang/Analysis/CFGVisitors/CFGVarDeclVisitor.h Thu Sep 20 16:40:36 2007
@@ -15,7 +15,7 @@
#ifndef LLVM_CLANG_ANALYSIS_CFG_VARDECL_VISITOR_H
#define LLVM_CLANG_ANALYSIS_CFG_VARDECL_VISITOR_H
-#include "clang/Analysis/CFGStmtVisitor.h"
+#include "clang/Analysis/Visitors/CFGStmtVisitor.h"
#include "clang/AST/Decl.h"
#include "clang/AST/Stmt.h"
#include "clang/AST/CFG.h"
Copied: cfe/trunk/include/clang/Analysis/CFGVisitors/DataflowStmtVisitor.h (from r42162, cfe/trunk/include/clang/Analysis/DataflowStmtVisitor.h)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/CFGVisitors/DataflowStmtVisitor.h?p2=cfe/trunk/include/clang/Analysis/CFGVisitors/DataflowStmtVisitor.h&p1=cfe/trunk/include/clang/Analysis/DataflowStmtVisitor.h&r1=42162&r2=42173&rev=42173&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/DataflowStmtVisitor.h (original)
+++ cfe/trunk/include/clang/Analysis/CFGVisitors/DataflowStmtVisitor.h Thu Sep 20 16:40:36 2007
@@ -17,7 +17,7 @@
#ifndef LLVM_CLANG_ANALYSIS_DATAFLOW_STMTVISITOR_H
#define LLVM_CLANG_ANALYSIS_DATAFLOW_STMTVISITOR_H
-#include "clang/Analysis/CFGStmtVisitor.h"
+#include "clang/Analysis/Visitors/CFGStmtVisitor.h"
namespace clang {
Removed: cfe/trunk/include/clang/Analysis/DataflowStmtVisitor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/DataflowStmtVisitor.h?rev=42172&view=auto
==============================================================================
--- cfe/trunk/include/clang/Analysis/DataflowStmtVisitor.h (original)
+++ cfe/trunk/include/clang/Analysis/DataflowStmtVisitor.h (removed)
@@ -1,130 +0,0 @@
-//===--- DataFlowStmtVisitor.h - StmtVisitor for Dataflow -------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file was developed by Ted Kremenek and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the DataflowStmtVisitor interface, which extends
-// CFGStmtVisitor. This interface is useful for visiting statements in a CFG
-// with the understanding that statements are walked in order of the analysis
-// traversal.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_ANALYSIS_DATAFLOW_STMTVISITOR_H
-#define LLVM_CLANG_ANALYSIS_DATAFLOW_STMTVISITOR_H
-
-#include "clang/Analysis/CFGStmtVisitor.h"
-
-namespace clang {
-
-// Tag classes describing what direction the dataflow analysis goes.
-namespace dataflow {
- struct forward_analysis_tag {};
- struct backward_analysis_tag {};
-}
-
-template < typename ImplClass,
- typename AnalysisTag=dataflow::forward_analysis_tag >
-class DataflowStmtVisitor : public CFGStmtVisitor<ImplClass,void> {
-public:
- //===--------------------------------------------------------------------===//
- // Observer methods. These are called before a statement is visited, and
- // there is no special dispatch on statement type. This allows subclasses
- // to inject extra functionality (e.g. monitoring) that applies to all
- // visited statements.
- //===--------------------------------------------------------------------===//
-
- void ObserveStmt(Stmt* S) {}
-
- void ObserveBlockStmt(Stmt* S) {
- static_cast<ImplClass*>(this)->ObserveStmt(S);
- }
-
- //===--------------------------------------------------------------------===//
- // Statment visitor methods. These modify the behavior of CFGVisitor::Visit
- // and CFGVisitor::BlockStmt_Visit by performing a traversal of substatements
- // depending on the direction of the dataflow analysis. For forward
- // analyses, the traversal is postorder (representing evaluation order)
- // and for backward analysis it is preorder (reverse-evaluation order).
- //===--------------------------------------------------------------------===//
-
- void BlockStmt_Visit(Stmt* S) { BlockStmt_Visit(S,AnalysisTag()); }
-
- void BlockStmt_Visit(Stmt* S, dataflow::forward_analysis_tag) {
- // Process statements in a postorder traversal of the AST.
- if (!CFG::hasImplicitControlFlow(S) ||
- S->getStmtClass() == Stmt::CallExprClass)
- static_cast<ImplClass*>(this)->VisitChildren(S);
-
- static_cast<ImplClass*>(this)->ObserveBlockStmt(S);
- static_cast<CFGStmtVisitor<ImplClass,void>*>(this)->BlockStmt_Visit(S);
- }
-
- void BlockStmt_Visit(Stmt* S, dataflow::backward_analysis_tag) {
- // Process statements in a preorder traversal of the AST.
- static_cast<ImplClass*>(this)->ObserveBlockStmt(S);
- static_cast<CFGStmtVisitor<ImplClass,void>*>(this)->BlockStmt_Visit(S);
-
- if (!CFG::hasImplicitControlFlow(S) ||
- S->getStmtClass() == Stmt::CallExprClass)
- static_cast<ImplClass*>(this)->VisitChildren(S);
- }
-
- void Visit(Stmt* S) { Visit(S,AnalysisTag()); }
-
- void Visit(Stmt* S, dataflow::forward_analysis_tag) {
- if (CFG::hasImplicitControlFlow(S))
- return;
-
- // Process statements in a postorder traversal of the AST.
- static_cast<ImplClass*>(this)->VisitChildren(S);
- static_cast<ImplClass*>(this)->ObserveStmt(S);
- static_cast<CFGStmtVisitor<ImplClass,void>*>(this)->Visit(S);
- }
-
- void Visit(Stmt* S, dataflow::backward_analysis_tag) {
- if (CFG::hasImplicitControlFlow(S))
- return;
-
- // Process statements in a preorder traversal of the AST.
- static_cast<ImplClass*>(this)->ObserveStmt(S);
- static_cast<CFGStmtVisitor<ImplClass,void>*>(this)->Visit(S);
- static_cast<ImplClass*>(this)->VisitChildren(S);
- }
-
- //===--------------------------------------------------------------------===//
- // Methods for visiting entire CFGBlocks.
- //===--------------------------------------------------------------------===//
-
- void VisitBlockEntry(const CFGBlock* B) {}
- void VisitBlockExit(const CFGBlock* B) {}
-
- void VisitBlock(const CFGBlock* B) { VisitBlock(B,AnalysisTag()); }
-
- void VisitBlock(const CFGBlock* B, dataflow::forward_analysis_tag ) {
- static_cast<ImplClass*>(this)->VisitBlockEntry(B);
-
- for (CFGBlock::const_iterator I=B->begin(), E=B->end(); I!=E; ++I)
- static_cast<ImplClass*>(this)->BlockStmt_Visit(const_cast<Stmt*>(*I));
-
- static_cast<ImplClass*>(this)->VisitBlockExit(B);
- }
-
- void VisitBlock(const CFGBlock* B, dataflow::backward_analysis_tag ) {
- static_cast<ImplClass*>(this)->VisitBlockExit(B);
-
- for (CFGBlock::const_reverse_iterator I=B->rbegin(), E=B->rend(); I!=E; ++I)
- static_cast<ImplClass*>(this)->BlockStmt_Visit(const_cast<Stmt*>(*I));
-
- static_cast<ImplClass*>(this)->VisitBlockEntry(B);
- }
-
-};
-
-} // end namespace clang
-
-#endif
More information about the cfe-commits
mailing list