зеркало из https://github.com/microsoft/clang-1.git
Teach CheckerVisitor about CXXOperatorCallExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91509 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
1c8008715b
Коммит
6b8ee78873
|
@ -12,24 +12,26 @@
|
||||||
//===---------------------------------------------------------------------===//
|
//===---------------------------------------------------------------------===//
|
||||||
|
|
||||||
#ifndef PREVISIT
|
#ifndef PREVISIT
|
||||||
#define PREVISIT(NODE)
|
#define PREVISIT(NODE, FALLBACK)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef POSTVISIT
|
#ifndef POSTVISIT
|
||||||
#define POSTVISIT(NODE)
|
#define POSTVISIT(NODE, FALLBACK)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PREVISIT(ArraySubscriptExpr)
|
PREVISIT(ArraySubscriptExpr, Stmt)
|
||||||
PREVISIT(BinaryOperator)
|
PREVISIT(BinaryOperator, Stmt)
|
||||||
PREVISIT(CallExpr)
|
PREVISIT(CallExpr, Stmt)
|
||||||
PREVISIT(CastExpr)
|
PREVISIT(CastExpr, Stmt)
|
||||||
PREVISIT(DeclStmt)
|
PREVISIT(CXXOperatorCallExpr, CallExpr)
|
||||||
PREVISIT(ObjCMessageExpr)
|
PREVISIT(DeclStmt, Stmt)
|
||||||
PREVISIT(ReturnStmt)
|
PREVISIT(ObjCMessageExpr, Stmt)
|
||||||
|
PREVISIT(ReturnStmt, Stmt)
|
||||||
|
|
||||||
POSTVISIT(CallExpr)
|
POSTVISIT(CallExpr, Stmt)
|
||||||
POSTVISIT(BlockExpr)
|
POSTVISIT(CXXOperatorCallExpr, CallExpr)
|
||||||
POSTVISIT(BinaryOperator)
|
POSTVISIT(BlockExpr, Stmt)
|
||||||
|
POSTVISIT(BinaryOperator, Stmt)
|
||||||
|
|
||||||
#undef PREVISIT
|
#undef PREVISIT
|
||||||
#undef POSTVISIT
|
#undef POSTVISIT
|
||||||
|
|
|
@ -53,20 +53,20 @@ public:
|
||||||
static_cast<const BinaryOperator*>(S));
|
static_cast<const BinaryOperator*>(S));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#define PREVISIT(NAME) \
|
#define PREVISIT(NAME, FALLBACK) \
|
||||||
case Stmt::NAME ## Class:\
|
case Stmt::NAME ## Class:\
|
||||||
static_cast<ImplClass*>(this)->PreVisit ## NAME(C,static_cast<const NAME*>(S));\
|
static_cast<ImplClass*>(this)->PreVisit ## NAME(C,static_cast<const NAME*>(S));\
|
||||||
break;
|
break;
|
||||||
#include "clang/Analysis/PathSensitive/CheckerVisitor.def"
|
#include "clang/Analysis/PathSensitive/CheckerVisitor.def"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostVisit(CheckerContext &C, const Stmt *S) {
|
void PostVisit(CheckerContext &C, const Stmt *S) {
|
||||||
switch (S->getStmtClass()) {
|
switch (S->getStmtClass()) {
|
||||||
default:
|
default:
|
||||||
assert(false && "Unsupport statement.");
|
assert(false && "Unsupport statement.");
|
||||||
return;
|
return;
|
||||||
#define POSTVISIT(NAME) \
|
#define POSTVISIT(NAME, FALLBACK) \
|
||||||
case Stmt::NAME ## Class:\
|
case Stmt::NAME ## Class:\
|
||||||
static_cast<ImplClass*>(this)->\
|
static_cast<ImplClass*>(this)->\
|
||||||
PostVisit ## NAME(C,static_cast<const NAME*>(S));\
|
PostVisit ## NAME(C,static_cast<const NAME*>(S));\
|
||||||
|
@ -75,12 +75,19 @@ break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PREVISIT(NAME) \
|
void PreVisitStmt(CheckerContext &C, const Stmt *S) {}
|
||||||
void PreVisit ## NAME(CheckerContext &C, const NAME* 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"
|
#include "clang/Analysis/PathSensitive/CheckerVisitor.def"
|
||||||
|
|
||||||
#define POSTVISIT(NAME) \
|
#define POSTVISIT(NAME, FALLBACK) \
|
||||||
void PostVisit ## NAME(CheckerContext &C, const NAME* S) {}
|
void PostVisit ## NAME(CheckerContext &C, const NAME* S) {\
|
||||||
|
PostVisit ## FALLBACK(C, S);\
|
||||||
|
}
|
||||||
#include "clang/Analysis/PathSensitive/CheckerVisitor.def"
|
#include "clang/Analysis/PathSensitive/CheckerVisitor.def"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче