24 using namespace clang;
29 class AnalysisOrderChecker
30 :
public Checker<check::PreStmt<CastExpr>,
31 check::PostStmt<CastExpr>,
32 check::PreStmt<ArraySubscriptExpr>,
33 check::PostStmt<ArraySubscriptExpr>,
34 check::PreStmt<CXXNewExpr>,
35 check::PostStmt<CXXNewExpr>,
36 check::PreStmt<OffsetOfExpr>,
37 check::PostStmt<OffsetOfExpr>,
45 bool isCallbackEnabled(
AnalyzerOptions &Opts, StringRef CallbackName)
const {
50 bool isCallbackEnabled(
CheckerContext &C, StringRef CallbackName)
const {
52 return isCallbackEnabled(Opts, CallbackName);
57 ->getAnalysisManager().getAnalyzerOptions();
58 return isCallbackEnabled(Opts, CallbackName);
63 if (isCallbackEnabled(C,
"PreStmtCastExpr"))
69 if (isCallbackEnabled(C,
"PostStmtCastExpr"))
76 if (isCallbackEnabled(C,
"PreStmtArraySubscriptExpr"))
77 llvm::errs() <<
"PreStmt<ArraySubscriptExpr>\n";
82 if (isCallbackEnabled(C,
"PostStmtArraySubscriptExpr"))
83 llvm::errs() <<
"PostStmt<ArraySubscriptExpr>\n";
87 if (isCallbackEnabled(C,
"PreStmtCXXNewExpr"))
88 llvm::errs() <<
"PreStmt<CXXNewExpr>\n";
92 if (isCallbackEnabled(C,
"PostStmtCXXNewExpr"))
93 llvm::errs() <<
"PostStmt<CXXNewExpr>\n";
97 if (isCallbackEnabled(C,
"PreStmtOffsetOfExpr"))
98 llvm::errs() <<
"PreStmt<OffsetOfExpr>\n";
102 if (isCallbackEnabled(C,
"PostStmtOffsetOfExpr"))
103 llvm::errs() <<
"PostStmt<OffsetOfExpr>\n";
107 if (isCallbackEnabled(C,
"PreCall")) {
108 llvm::errs() <<
"PreCall";
110 llvm::errs() <<
" (" << ND->getQualifiedNameAsString() <<
')';
111 llvm::errs() <<
'\n';
116 if (isCallbackEnabled(C,
"PostCall")) {
117 llvm::errs() <<
"PostCall";
119 llvm::errs() <<
" (" << ND->getQualifiedNameAsString() <<
')';
120 llvm::errs() <<
'\n';
126 if (isCallbackEnabled(C,
"NewAllocator"))
127 llvm::errs() <<
"NewAllocator\n";
131 if (isCallbackEnabled(C,
"Bind"))
132 llvm::errs() <<
"Bind\n";
136 if (isCallbackEnabled(State,
"LiveSymbols"))
137 llvm::errs() <<
"LiveSymbols\n";
146 if (isCallbackEnabled(State,
"RegionChanges"))
147 llvm::errs() <<
"RegionChanges\n";
Stmt - This represents one statement.
AnalysisManager & getAnalysisManager()
Defines the clang::Expr interface and subclasses for C++ expressions.
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
AnalyzerOptions & getAnalyzerOptions() override
virtual const Decl * getDecl() const
Returns the declaration of the function or method that will be called.
bool getBooleanOption(StringRef Name, bool DefaultVal, const ento::CheckerBase *C=nullptr, bool SearchInParents=false)
Interprets an option's string value as a boolean.
CHECKER * registerChecker(AT... Args)
Used to register checkers.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
SVal - This represents a symbolic expression, which can be either an L-value or an R-value...
A class responsible for cleaning up unused symbols.
Dataflow Directional Tag Classes.
Represents an abstract call to a function or method along a particular path.
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
static const char * getCastKindName(CastKind CK)
This represents a decl that may have a name.
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type, member-designator).