13#ifndef LLVM_CLANG_STATICANALYZER_CORE_CHECKER_H
14#define LLVM_CLANG_STATICANALYZER_CORE_CHECKER_H
20#include "llvm/Support/Casting.h"
28template <
typename DECL>
30 template <
typename CHECKER>
33 ((
const CHECKER *)checker)->checkASTDecl(cast<DECL>(
D), mgr, BR);
36 static bool _handlesDecl(
const Decl *
D) {
40 template <
typename CHECKER>
49 template <
typename CHECKER>
52 ((
const CHECKER *)checker)->checkASTCodeBody(
D, mgr, BR);
56 template <
typename CHECKER>
59 _checkBody<CHECKER>));
64 template <
typename CHECKER>
65 static void _checkEndOfTranslationUnit(
void *checker,
69 ((
const CHECKER *)checker)->checkEndOfTranslationUnit(TU, mgr, BR);
73 template <
typename CHECKER>
77 _checkEndOfTranslationUnit<CHECKER>));
81template <
typename STMT>
83 template <
typename CHECKER>
85 ((
const CHECKER *)checker)->checkPreStmt(cast<STMT>(S),
C);
88 static bool _handlesStmt(
const Stmt *S) {
92 template <
typename CHECKER>
100template <
typename STMT>
102 template <
typename CHECKER>
104 ((
const CHECKER *)checker)->checkPostStmt(cast<STMT>(S),
C);
107 static bool _handlesStmt(
const Stmt *S) {
111 template <
typename CHECKER>
114 _checkStmt<CHECKER>),
120 template <
typename CHECKER>
121 static void _checkObjCMessage(
void *checker,
const ObjCMethodCall &msg,
123 ((
const CHECKER *)checker)->checkPreObjCMessage(msg,
C);
127 template <
typename CHECKER>
135 template <
typename CHECKER>
136 static void _checkObjCMessage(
void *checker,
const ObjCMethodCall &msg,
138 ((
const CHECKER *)checker)->checkObjCMessageNil(msg,
C);
142 template <
typename CHECKER>
150 template <
typename CHECKER>
151 static void _checkObjCMessage(
void *checker,
const ObjCMethodCall &msg,
153 ((
const CHECKER *)checker)->checkPostObjCMessage(msg,
C);
157 template <
typename CHECKER>
165 template <
typename CHECKER>
166 static void _checkCall(
void *checker,
const CallEvent &msg,
168 ((
const CHECKER *)checker)->checkPreCall(msg,
C);
172 template <
typename CHECKER>
180 template <
typename CHECKER>
181 static void _checkCall(
void *checker,
const CallEvent &msg,
183 ((
const CHECKER *)checker)->checkPostCall(msg,
C);
187 template <
typename CHECKER>
195 template <
typename CHECKER>
196 static void _checkLocation(
void *checker,
SVal location,
bool isLoad,
198 ((
const CHECKER *)checker)->checkLocation(location, isLoad, S,
C);
202 template <
typename CHECKER>
210 template <
typename CHECKER>
211 static void _checkBind(
void *checker,
SVal location,
SVal val,
const Stmt *S,
213 ((
const CHECKER *)checker)->checkBind(location, val, S,
C);
217 template <
typename CHECKER>
225 template <
typename CHECKER>
226 static void _checkEndAnalysis(
void *checker,
ExplodedGraph &G,
228 ((
const CHECKER *)checker)->checkEndAnalysis(G, BR, Eng);
232 template <
typename CHECKER>
240 template <
typename CHECKER>
242 ((
const CHECKER *)checker)->checkBeginFunction(
C);
246 template <
typename CHECKER>
249 checker, _checkBeginFunction<CHECKER>));
254 template <
typename CHECKER>
255 static void _checkEndFunction(
void *checker,
const ReturnStmt *RS,
257 ((
const CHECKER *)checker)->checkEndFunction(RS,
C);
261 template <
typename CHECKER>
269 template <
typename CHECKER>
270 static void _checkBranchCondition(
void *checker,
const Stmt *
Condition,
276 template <
typename CHECKER>
280 _checkBranchCondition<CHECKER>));
285 template <
typename CHECKER>
292 template <
typename CHECKER>
296 _checkNewAllocator<CHECKER>));
301 template <
typename CHECKER>
304 ((
const CHECKER *)checker)->checkLiveSymbols(state, SR);
308 template <
typename CHECKER>
316 template <
typename CHECKER>
317 static void _checkDeadSymbols(
void *checker,
319 ((
const CHECKER *)checker)->checkDeadSymbols(SR,
C);
323 template <
typename CHECKER>
331 template <
typename CHECKER>
333 _checkRegionChanges(
void *checker,
340 return ((
const CHECKER *) checker)->checkRegionChanges(state, invalidated,
346 template <
typename CHECKER>
350 _checkRegionChanges<CHECKER>));
355 template <
typename CHECKER>
357 _checkPointerEscape(
void *
Checker,
376 RegularEscape.insert(Sym);
378 if (RegularEscape.empty())
388 template <
typename CHECKER>
392 _checkPointerEscape<CHECKER>));
397 template <
typename CHECKER>
399 _checkConstPointerEscape(
void *
Checker,
415 ConstEscape.insert(Sym);
418 if (ConstEscape.empty())
428 template <
typename CHECKER>
432 _checkConstPointerEscape<CHECKER>));
437template <
typename EVENT>
439 template <
typename CHECKER>
440 static void _checkEvent(
void *checker,
const void *event) {
441 ((
const CHECKER *)checker)->checkEvent(*(
const EVENT *)event);
444 template <
typename CHECKER>
456 template <
typename CHECKER>
458 SVal cond,
bool assumption) {
459 return ((
const CHECKER *)checker)->evalAssume(state, cond, assumption);
463 template <
typename CHECKER>
471 template <
typename CHECKER>
478 template <
typename CHECKER>
489 friend class ::clang::ento::CheckerManager;
497 const char *NL,
const char *Sep)
const { }
501raw_ostream&
operator<<(raw_ostream &Out,
const CheckerBase &Checker);
511template <
typename CHECK1,
typename... CHECKs>
514 template <
typename CHECKER>
516 CHECK1::_register(checker, mgr);
521template <
typename CHECK1>
524 template <
typename CHECKER>
526 CHECK1::_register(checker, mgr);
530template <
typename EVENT>
536 template <
typename CHECKER>
#define CHECKER(FULLNAME, CLASS, HELPTEXT, DOC_URI, IS_HIDDEN)
enum clang::sema::@1656::IndirectLocalPathEntry::EntryKind Kind
Defines the clang::LangOptions interface.
Decl - This represents one declaration (or definition), e.g.
It wraps the AnalysisDeclContext to represent both the call stack with the help of StackFrameContext ...
ProgramPoints can be "tagged" as representing points specific to a given analysis entity.
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
Stmt - This represents one statement.
The top declaration context.
BugReporter is a utility class for generating PathDiagnostics for analysis.
Represents the memory allocation call in a C++ new-expression.
Represents an abstract call to a function or method along a particular path.
CheckerNameRef getCheckerName() const
virtual void printState(raw_ostream &Out, ProgramStateRef State, const char *NL, const char *Sep) const
See CheckerManager::runCheckersForPrintState.
StringRef getTagDescription() const override
void _registerForLiveSymbols(CheckLiveSymbolsFunc checkfn)
void _registerForEndOfTranslationUnit(CheckEndOfTranslationUnit checkfn)
void _registerForBeginFunction(CheckBeginFunctionFunc checkfn)
void _registerForNewAllocator(CheckNewAllocatorFunc checkfn)
void _registerForPreCall(CheckCallFunc checkfn)
void _registerForObjCMessageNil(CheckObjCMessageFunc checkfn)
void _registerForDecl(CheckDeclFunc checkfn, HandlesDeclFunc isForDeclFn)
void _registerForPreObjCMessage(CheckObjCMessageFunc checkfn)
CheckerFn< void(const void *event)> CheckEventFunc
void _registerListenerForEvent(CheckEventFunc checkfn)
void _registerForEvalAssume(EvalAssumeFunc checkfn)
void _registerForEndAnalysis(CheckEndAnalysisFunc checkfn)
void _registerForBody(CheckDeclFunc checkfn)
void _registerForDeadSymbols(CheckDeadSymbolsFunc checkfn)
void _registerForPostObjCMessage(CheckObjCMessageFunc checkfn)
void _registerForRegionChanges(CheckRegionChangesFunc checkfn)
void _registerForBind(CheckBindFunc checkfn)
void _registerForPointerEscape(CheckPointerEscapeFunc checkfn)
void _registerForPreStmt(CheckStmtFunc checkfn, HandlesStmtFunc isForStmtFn)
void _registerForPostStmt(CheckStmtFunc checkfn, HandlesStmtFunc isForStmtFn)
void _registerForBranchCondition(CheckBranchConditionFunc checkfn)
void _dispatchEvent(const EVENT &event) const
void _registerForEvalCall(EvalCallFunc checkfn)
void _registerForEndFunction(CheckEndFunctionFunc checkfn)
void _registerDispatcherForEvent()
void _registerForLocation(CheckLocationFunc checkfn)
void _registerForPostCall(CheckCallFunc checkfn)
This wrapper is used to ensure that only StringRefs originating from the CheckerRegistry are used as ...
Tag that can use a checker name as a message provider (see SimpleProgramPointTag).
static void _register(CHECKER *checker, CheckerManager &mgr)
static void _register(CHECKER *checker, CheckerManager &mgr)
EventDispatcher()=default
static void _register(CHECKER *checker, CheckerManager &mgr)
void dispatchEvent(const EVENT &event) const
Represents any expression that calls an Objective-C method.
Information about invalidation for a particular region/symbol.
@ TK_PreserveContents
Tells that a region's contents is not changed.
@ TK_SuppressEscape
Suppress pointer-escaping of a region.
bool hasTrait(SymbolRef Sym, InvalidationKinds IK) const
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.
static void _register(CHECKER *checker, CheckerManager &mgr)
static void _register(CHECKER *checker, CheckerManager &mgr)
static void _register(CHECKER *checker, CheckerManager &mgr)
static void _register(CHECKER *checker, CheckerManager &mgr)
static void _register(CHECKER *checker, CheckerManager &mgr)
static void _register(CHECKER *checker, CheckerManager &mgr)
static void _register(CHECKER *checker, CheckerManager &mgr)
static void _register(CHECKER *checker, CheckerManager &mgr)
static void _register(CHECKER *checker, CheckerManager &mgr)
static void _register(CHECKER *checker, CheckerManager &mgr)
static void _register(CHECKER *checker, CheckerManager &mgr)
static void _register(CHECKER *checker, CheckerManager &mgr)
static void _register(CHECKER *checker, CheckerManager &mgr)
static void _register(CHECKER *checker, CheckerManager &mgr)
static void _register(CHECKER *checker, CheckerManager &mgr)
static void _register(CHECKER *checker, CheckerManager &mgr)
static void _register(CHECKER *checker, CheckerManager &mgr)
static void _register(CHECKER *checker, CheckerManager &mgr)
static void _register(CHECKER *checker, CheckerManager &mgr)
static void _register(CHECKER *checker, CheckerManager &mgr)
static void _register(CHECKER *checker, CheckerManager &mgr)
static void _register(CHECKER *checker, CheckerManager &mgr)
static void _register(CHECKER *checker, CheckerManager &mgr)
static void _register(CHECKER *checker, CheckerManager &mgr)
static void _register(CHECKER *checker, CheckerManager &mgr)
PointerEscapeKind
Describes the different reasons a pointer escapes during analysis.
raw_ostream & operator<<(raw_ostream &Out, const CheckerBase &Checker)
Dump checker name to stream.
llvm::DenseSet< SymbolRef > InvalidatedSymbols
The JSON file list parser is used to communicate input to InstallAPI.
We dereferenced a location that may be null.