diff options
-rw-r--r-- | include/clang/Analysis/PathSensitive/CheckerVisitor.def | 26 | ||||
-rw-r--r-- | include/clang/Analysis/PathSensitive/CheckerVisitor.h | 21 |
2 files changed, 28 insertions, 19 deletions
diff --git a/include/clang/Analysis/PathSensitive/CheckerVisitor.def b/include/clang/Analysis/PathSensitive/CheckerVisitor.def index 4144d1a0a7..1432cd184e 100644 --- a/include/clang/Analysis/PathSensitive/CheckerVisitor.def +++ b/include/clang/Analysis/PathSensitive/CheckerVisitor.def @@ -12,24 +12,26 @@ //===---------------------------------------------------------------------===// #ifndef PREVISIT -#define PREVISIT(NODE) +#define PREVISIT(NODE, FALLBACK) #endif #ifndef POSTVISIT -#define POSTVISIT(NODE) +#define POSTVISIT(NODE, FALLBACK) #endif -PREVISIT(ArraySubscriptExpr) -PREVISIT(BinaryOperator) -PREVISIT(CallExpr) -PREVISIT(CastExpr) -PREVISIT(DeclStmt) -PREVISIT(ObjCMessageExpr) -PREVISIT(ReturnStmt) +PREVISIT(ArraySubscriptExpr, Stmt) +PREVISIT(BinaryOperator, Stmt) +PREVISIT(CallExpr, Stmt) +PREVISIT(CastExpr, Stmt) +PREVISIT(CXXOperatorCallExpr, CallExpr) +PREVISIT(DeclStmt, Stmt) +PREVISIT(ObjCMessageExpr, Stmt) +PREVISIT(ReturnStmt, Stmt) -POSTVISIT(CallExpr) -POSTVISIT(BlockExpr) -POSTVISIT(BinaryOperator) +POSTVISIT(CallExpr, Stmt) +POSTVISIT(CXXOperatorCallExpr, CallExpr) +POSTVISIT(BlockExpr, Stmt) +POSTVISIT(BinaryOperator, Stmt) #undef PREVISIT #undef POSTVISIT diff --git a/include/clang/Analysis/PathSensitive/CheckerVisitor.h b/include/clang/Analysis/PathSensitive/CheckerVisitor.h index 7cef17eb65..f5145bbb7a 100644 --- a/include/clang/Analysis/PathSensitive/CheckerVisitor.h +++ b/include/clang/Analysis/PathSensitive/CheckerVisitor.h @@ -53,20 +53,20 @@ public: static_cast<const BinaryOperator*>(S)); break; -#define PREVISIT(NAME) \ +#define PREVISIT(NAME, FALLBACK) \ case Stmt::NAME ## Class:\ static_cast<ImplClass*>(this)->PreVisit ## NAME(C,static_cast<const NAME*>(S));\ break; #include "clang/Analysis/PathSensitive/CheckerVisitor.def" } } - + void PostVisit(CheckerContext &C, const Stmt *S) { switch (S->getStmtClass()) { default: assert(false && "Unsupport statement."); return; -#define POSTVISIT(NAME) \ +#define POSTVISIT(NAME, FALLBACK) \ case Stmt::NAME ## Class:\ static_cast<ImplClass*>(this)->\ PostVisit ## NAME(C,static_cast<const NAME*>(S));\ @@ -75,12 +75,19 @@ break; } } -#define PREVISIT(NAME) \ -void PreVisit ## NAME(CheckerContext &C, const NAME* S) {} + void PreVisitStmt(CheckerContext &C, const Stmt *S) {} + void PostVisitStmt(CheckerContext &C, const Stmt *S) {} + +#define PREVISIT(NAME, FALLBACK) \ +void PreVisit ## NAME(CheckerContext &C, const NAME* S) {\ + PreVisit ## FALLBACK(C, S);\ +} #include "clang/Analysis/PathSensitive/CheckerVisitor.def" -#define POSTVISIT(NAME) \ -void PostVisit ## NAME(CheckerContext &C, const NAME* S) {} +#define POSTVISIT(NAME, FALLBACK) \ +void PostVisit ## NAME(CheckerContext &C, const NAME* S) {\ + PostVisit ## FALLBACK(C, S);\ +} #include "clang/Analysis/PathSensitive/CheckerVisitor.def" }; |