1//===- CheckerManager.h - Static Analyzer Checker Manager -------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// Defines the Static Analyzer Checker Manager.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CLANG_STATICANALYZER_CORE_CHECKERMANAGER_H
14#define LLVM_CLANG_STATICANALYZER_CORE_CHECKERMANAGER_H
15
16#include "clang/Analysis/ProgramPoint.h"
17#include "clang/Basic/LangOptions.h"
18#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h"
19#include "clang/StaticAnalyzer/Core/PathSensitive/Store.h"
20#include "llvm/ADT/ArrayRef.h"
21#include "llvm/ADT/DenseMap.h"
22#include "llvm/ADT/SmallVector.h"
23#include "llvm/ADT/StringRef.h"
24#include <vector>
25
26namespace clang {
27
28class AnalyzerOptions;
29class CallExpr;
30class CXXNewExpr;
31class Decl;
32class LocationContext;
33class Stmt;
34class TranslationUnitDecl;
35
36namespace ento {
37
38class AnalysisManager;
39class BugReporter;
40class CallEvent;
41class CheckerBase;
42class CheckerContext;
43class CheckerRegistry;
44class ExplodedGraph;
45class ExplodedNode;
46class ExplodedNodeSet;
47class ExprEngine;
48class MemRegion;
49struct NodeBuilderContext;
50class ObjCMethodCall;
51class RegionAndSymbolInvalidationTraits;
52class SVal;
53class SymbolReaper;
54
55template <typename T> class CheckerFn;
56
57template <typename RET, typename... Ps>
58class CheckerFn<RET(Ps...)> {
59 using Func = RET (*)(void *, Ps...);
60
61 Func Fn;
62
63public:
64 CheckerBase *Checker;
65
66 CheckerFn(CheckerBase *checker, Func fn) : Fn(fn), Checker(checker) {}
67
68 RET operator()(Ps... ps) const {
69 return Fn(Checker, ps...);
70 }
71};
72
73/// Describes the different reasons a pointer escapes
74/// during analysis.
75enum PointerEscapeKind {
76 /// A pointer escapes due to binding its value to a location
77 /// that the analyzer cannot track.
78 PSK_EscapeOnBind,
79
80 /// The pointer has been passed to a function call directly.
81 PSK_DirectEscapeOnCall,
82
83 /// The pointer has been passed to a function indirectly.
84 /// For example, the pointer is accessible through an
85 /// argument to a function.
86 PSK_IndirectEscapeOnCall,
87
88 /// The reason for pointer escape is unknown. For example,
89 /// a region containing this pointer is invalidated.
90 PSK_EscapeOther
91};
92
93// This wrapper is used to ensure that only StringRefs originating from the
94// CheckerRegistry are used as check names. We want to make sure all check
95// name strings have a lifetime that keeps them alive at least until the path
96// diagnostics have been processed.
97class CheckName {
98 friend class ::clang::ento::CheckerRegistry;
99
100 StringRef Name;
101
102 explicit CheckName(StringRef Name) : Name(Name) {}
103
104public:
105 CheckName() = default;
106
107 StringRef getName() const { return Name; }
108};
109
110enum class ObjCMessageVisitKind {
111 Pre,
112 Post,
113 MessageNil
114};
115
116class CheckerManager {
117 ASTContext &Context;
118 const LangOptions LangOpts;
119 AnalyzerOptions &AOptions;
120 CheckName CurrentCheckName;
121
122public:
123 CheckerManager(ASTContext &Context, AnalyzerOptions &AOptions)
124 : Context(Context), LangOpts(Context.getLangOpts()), AOptions(AOptions) {}
125
126 ~CheckerManager();
127
128 void setCurrentCheckName(CheckName name) { CurrentCheckName = name; }
129 CheckName getCurrentCheckName() const { return CurrentCheckName; }
130
131 bool hasPathSensitiveCheckers() const;
132
133 void finishedCheckerRegistration();
134
135 const LangOptions &getLangOpts() const { return LangOpts; }
136 AnalyzerOptions &getAnalyzerOptions() { return AOptions; }
137 ASTContext &getASTContext() { return Context; }
138
139 using CheckerRef = CheckerBase *;
140 using CheckerTag = const void *;
141 using CheckerDtor = CheckerFn<void ()>;
142
143//===----------------------------------------------------------------------===//
144// Checker registration.
145//===----------------------------------------------------------------------===//
146
147 /// Used to register checkers.
148 /// All arguments are automatically passed through to the checker
149 /// constructor.
150 ///
151 /// \returns a pointer to the checker object.
152 template <typename CHECKER, typename... AT>
153 CHECKER *registerChecker(AT &&... Args) {
154 CheckerTag tag = getTag<CHECKER>();
155 CheckerRef &ref = CheckerTags[tag];
156 assert(!ref && "Checker already registered, use getChecker!");
157
158 CHECKER *checker = new CHECKER(std::forward<AT>(Args)...);
159 checker->Name = CurrentCheckName;
160 CheckerDtors.push_back(CheckerDtor(checker, destruct<CHECKER>));
161 CHECKER::_register(checker, *this);
162 ref = checker;
163 return checker;
164 }
165
166 template <typename CHECKER>
167 CHECKER *getChecker() {
168 CheckerTag tag = getTag<CHECKER>();
169 assert(CheckerTags.count(tag) != 0 &&
170 "Requested checker is not registered! Maybe you should add it as a "
171 "dependency in Checkers.td?");
172 return static_cast<CHECKER *>(CheckerTags[tag]);
173 }
174
175//===----------------------------------------------------------------------===//
176// Functions for running checkers for AST traversing.
177//===----------------------------------------------------------------------===//
178
179 /// Run checkers handling Decls.
180 void runCheckersOnASTDecl(const Decl *D, AnalysisManager& mgr,
181 BugReporter &BR);
182
183 /// Run checkers handling Decls containing a Stmt body.
184 void runCheckersOnASTBody(const Decl *D, AnalysisManager& mgr,
185 BugReporter &BR);
186
187//===----------------------------------------------------------------------===//
188// Functions for running checkers for path-sensitive checking.
189//===----------------------------------------------------------------------===//
190
191 /// Run checkers for pre-visiting Stmts.
192 ///
193 /// The notification is performed for every explored CFGElement, which does
194 /// not include the control flow statements such as IfStmt.
195 ///
196 /// \sa runCheckersForBranchCondition, runCheckersForPostStmt
197 void runCheckersForPreStmt(ExplodedNodeSet &Dst,
198 const ExplodedNodeSet &Src,
199 const Stmt *S,
200 ExprEngine &Eng) {
201 runCheckersForStmt(/*isPreVisit=*/true, Dst, Src, S, Eng);
202 }
203
204 /// Run checkers for post-visiting Stmts.
205 ///
206 /// The notification is performed for every explored CFGElement, which does
207 /// not include the control flow statements such as IfStmt.
208 ///
209 /// \sa runCheckersForBranchCondition, runCheckersForPreStmt
210 void runCheckersForPostStmt(ExplodedNodeSet &Dst,
211 const ExplodedNodeSet &Src,
212 const Stmt *S,
213 ExprEngine &Eng,
214 bool wasInlined = false) {
215 runCheckersForStmt(/*isPreVisit=*/false, Dst, Src, S, Eng, wasInlined);
216 }
217
218 /// Run checkers for visiting Stmts.
219 void runCheckersForStmt(bool isPreVisit,
220 ExplodedNodeSet &Dst, const ExplodedNodeSet &Src,
221 const Stmt *S, ExprEngine &Eng,
222 bool wasInlined = false);
223
224 /// Run checkers for pre-visiting obj-c messages.
225 void runCheckersForPreObjCMessage(ExplodedNodeSet &Dst,
226 const ExplodedNodeSet &Src,
227 const ObjCMethodCall &msg,
228 ExprEngine &Eng) {
229 runCheckersForObjCMessage(ObjCMessageVisitKind::Pre, Dst, Src, msg, Eng);
230 }
231
232 /// Run checkers for post-visiting obj-c messages.
233 void runCheckersForPostObjCMessage(ExplodedNodeSet &Dst,
234 const ExplodedNodeSet &Src,
235 const ObjCMethodCall &msg,
236 ExprEngine &Eng,
237 bool wasInlined = false) {
238 runCheckersForObjCMessage(ObjCMessageVisitKind::Post, Dst, Src, msg, Eng,
239 wasInlined);
240 }
241
242 /// Run checkers for visiting an obj-c message to nil.
243 void runCheckersForObjCMessageNil(ExplodedNodeSet &Dst,
244 const ExplodedNodeSet &Src,
245 const ObjCMethodCall &msg,
246 ExprEngine &Eng) {
247 runCheckersForObjCMessage(ObjCMessageVisitKind::MessageNil, Dst, Src, msg,
248 Eng);
249 }
250
251 /// Run checkers for visiting obj-c messages.
252 void runCheckersForObjCMessage(ObjCMessageVisitKind visitKind,
253 ExplodedNodeSet &Dst,
254 const ExplodedNodeSet &Src,
255 const ObjCMethodCall &msg, ExprEngine &Eng,
256 bool wasInlined = false);
257
258 /// Run checkers for pre-visiting obj-c messages.
259 void runCheckersForPreCall(ExplodedNodeSet &Dst, const ExplodedNodeSet &Src,
260 const CallEvent &Call, ExprEngine &Eng) {
261 runCheckersForCallEvent(/*isPreVisit=*/true, Dst, Src, Call, Eng);
262 }
263
264 /// Run checkers for post-visiting obj-c messages.
265 void runCheckersForPostCall(ExplodedNodeSet &Dst, const ExplodedNodeSet &Src,
266 const CallEvent &Call, ExprEngine &Eng,
267 bool wasInlined = false) {
268 runCheckersForCallEvent(/*isPreVisit=*/false, Dst, Src, Call, Eng,
269 wasInlined);
270 }
271
272 /// Run checkers for visiting obj-c messages.
273 void runCheckersForCallEvent(bool isPreVisit, ExplodedNodeSet &Dst,
274 const ExplodedNodeSet &Src,
275 const CallEvent &Call, ExprEngine &Eng,
276 bool wasInlined = false);
277
278 /// Run checkers for load/store of a location.
279 void runCheckersForLocation(ExplodedNodeSet &Dst,
280 const ExplodedNodeSet &Src,
281 SVal location,
282 bool isLoad,
283 const Stmt *NodeEx,
284 const Stmt *BoundEx,
285 ExprEngine &Eng);
286
287 /// Run checkers for binding of a value to a location.
288 void runCheckersForBind(ExplodedNodeSet &Dst,
289 const ExplodedNodeSet &Src,
290 SVal location, SVal val,
291 const Stmt *S, ExprEngine &Eng,
292 const ProgramPoint &PP);
293
294 /// Run checkers for end of analysis.
295 void runCheckersForEndAnalysis(ExplodedGraph &G, BugReporter &BR,
296 ExprEngine &Eng);
297
298 /// Run checkers on beginning of function.
299 void runCheckersForBeginFunction(ExplodedNodeSet &Dst,
300 const BlockEdge &L,
301 ExplodedNode *Pred,
302 ExprEngine &Eng);
303
304 /// Run checkers on end of function.
305 void runCheckersForEndFunction(NodeBuilderContext &BC,
306 ExplodedNodeSet &Dst,
307 ExplodedNode *Pred,
308 ExprEngine &Eng,
309 const ReturnStmt *RS);
310
311 /// Run checkers for branch condition.
312 void runCheckersForBranchCondition(const Stmt *condition,
313 ExplodedNodeSet &Dst, ExplodedNode *Pred,
314 ExprEngine &Eng);
315
316 /// Run checkers between C++ operator new and constructor calls.
317 void runCheckersForNewAllocator(const CXXNewExpr *NE, SVal Target,
318 ExplodedNodeSet &Dst,
319 ExplodedNode *Pred,
320 ExprEngine &Eng,
321 bool wasInlined = false);
322
323 /// Run checkers for live symbols.
324 ///
325 /// Allows modifying SymbolReaper object. For example, checkers can explicitly
326 /// register symbols of interest as live. These symbols will not be marked
327 /// dead and removed.
328 void runCheckersForLiveSymbols(ProgramStateRef state,
329 SymbolReaper &SymReaper);
330
331 /// Run checkers for dead symbols.
332 ///
333 /// Notifies checkers when symbols become dead. For example, this allows
334 /// checkers to aggressively clean up/reduce the checker state and produce
335 /// precise diagnostics.
336 void runCheckersForDeadSymbols(ExplodedNodeSet &Dst,
337 const ExplodedNodeSet &Src,
338 SymbolReaper &SymReaper, const Stmt *S,
339 ExprEngine &Eng,
340 ProgramPoint::Kind K);
341
342 /// Run checkers for region changes.
343 ///
344 /// This corresponds to the check::RegionChanges callback.
345 /// \param state The current program state.
346 /// \param invalidated A set of all symbols potentially touched by the change.
347 /// \param ExplicitRegions The regions explicitly requested for invalidation.
348 /// For example, in the case of a function call, these would be arguments.
349 /// \param Regions The transitive closure of accessible regions,
350 /// i.e. all regions that may have been touched by this change.
351 /// \param Call The call expression wrapper if the regions are invalidated
352 /// by a call.
353 ProgramStateRef
354 runCheckersForRegionChanges(ProgramStateRef state,
355 const InvalidatedSymbols *invalidated,
356 ArrayRef<const MemRegion *> ExplicitRegions,
357 ArrayRef<const MemRegion *> Regions,
358 const LocationContext *LCtx,
359 const CallEvent *Call);
360
361 /// Run checkers when pointers escape.
362 ///
363 /// This notifies the checkers about pointer escape, which occurs whenever
364 /// the analyzer cannot track the symbol any more. For example, as a
365 /// result of assigning a pointer into a global or when it's passed to a
366 /// function call the analyzer cannot model.
367 ///
368 /// \param State The state at the point of escape.
369 /// \param Escaped The list of escaped symbols.
370 /// \param Call The corresponding CallEvent, if the symbols escape as
371 /// parameters to the given call.
372 /// \param Kind The reason of pointer escape.
373 /// \param ITraits Information about invalidation for a particular
374 /// region/symbol.
375 /// \returns Checkers can modify the state by returning a new one.
376 ProgramStateRef
377 runCheckersForPointerEscape(ProgramStateRef State,
378 const InvalidatedSymbols &Escaped,
379 const CallEvent *Call,
380 PointerEscapeKind Kind,
381 RegionAndSymbolInvalidationTraits *ITraits);
382
383 /// Run checkers for handling assumptions on symbolic values.
384 ProgramStateRef runCheckersForEvalAssume(ProgramStateRef state,
385 SVal Cond, bool Assumption);
386
387 /// Run checkers for evaluating a call.
388 ///
389 /// Warning: Currently, the CallEvent MUST come from a CallExpr!
390 void runCheckersForEvalCall(ExplodedNodeSet &Dst,
391 const ExplodedNodeSet &Src,
392 const CallEvent &CE, ExprEngine &Eng);
393
394 /// Run checkers for the entire Translation Unit.
395 void runCheckersOnEndOfTranslationUnit(const TranslationUnitDecl *TU,
396 AnalysisManager &mgr,
397 BugReporter &BR);
398
399 /// Run checkers for debug-printing a ProgramState.
400 ///
401 /// Unlike most other callbacks, any checker can simply implement the virtual
402 /// method CheckerBase::printState if it has custom data to print.
403 /// \param Out The output stream
404 /// \param State The state being printed
405 /// \param NL The preferred representation of a newline.
406 /// \param Sep The preferred separator between different kinds of data.
407 void runCheckersForPrintState(raw_ostream &Out, ProgramStateRef State,
408 const char *NL, const char *Sep);
409
410//===----------------------------------------------------------------------===//
411// Internal registration functions for AST traversing.
412//===----------------------------------------------------------------------===//
413
414 // Functions used by the registration mechanism, checkers should not touch
415 // these directly.
416
417 using CheckDeclFunc =
418 CheckerFn<void (const Decl *, AnalysisManager&, BugReporter &)>;
419
420 using HandlesDeclFunc = bool (*)(const Decl *D);
421
422 void _registerForDecl(CheckDeclFunc checkfn, HandlesDeclFunc isForDeclFn);
423
424 void _registerForBody(CheckDeclFunc checkfn);
425
426//===----------------------------------------------------------------------===//
427// Internal registration functions for path-sensitive checking.
428//===----------------------------------------------------------------------===//
429
430 using CheckStmtFunc = CheckerFn<void (const Stmt *, CheckerContext &)>;
431
432 using CheckObjCMessageFunc =
433 CheckerFn<void (const ObjCMethodCall &, CheckerContext &)>;
434
435 using CheckCallFunc =
436 CheckerFn<void (const CallEvent &, CheckerContext &)>;
437
438 using CheckLocationFunc =
439 CheckerFn<void (const SVal &location, bool isLoad, const Stmt *S,
440 CheckerContext &)>;
441
442 using CheckBindFunc =
443 CheckerFn<void (const SVal &location, const SVal &val, const Stmt *S,
444 CheckerContext &)>;
445
446 using CheckEndAnalysisFunc =
447 CheckerFn<void (ExplodedGraph &, BugReporter &, ExprEngine &)>;
448
449 using CheckBeginFunctionFunc = CheckerFn<void (CheckerContext &)>;
450
451 using CheckEndFunctionFunc =
452 CheckerFn<void (const ReturnStmt *, CheckerContext &)>;
453
454 using CheckBranchConditionFunc =
455 CheckerFn<void (const Stmt *, CheckerContext &)>;
456
457 using CheckNewAllocatorFunc =
458 CheckerFn<void (const CXXNewExpr *, SVal, CheckerContext &)>;
459
460 using CheckDeadSymbolsFunc =
461 CheckerFn<void (SymbolReaper &, CheckerContext &)>;
462
463 using CheckLiveSymbolsFunc = CheckerFn<void (ProgramStateRef,SymbolReaper &)>;
464
465 using CheckRegionChangesFunc =
466 CheckerFn<ProgramStateRef (ProgramStateRef,
467 const InvalidatedSymbols *symbols,
468 ArrayRef<const MemRegion *> ExplicitRegions,
469 ArrayRef<const MemRegion *> Regions,
470 const LocationContext *LCtx,
471 const CallEvent *Call)>;
472
473 using CheckPointerEscapeFunc =
474 CheckerFn<ProgramStateRef (ProgramStateRef,
475 const InvalidatedSymbols &Escaped,
476 const CallEvent *Call, PointerEscapeKind Kind,
477 RegionAndSymbolInvalidationTraits *ITraits)>;
478
479 using EvalAssumeFunc =
480 CheckerFn<ProgramStateRef (ProgramStateRef, const SVal &cond,
481 bool assumption)>;
482
483 using EvalCallFunc = CheckerFn<bool (const CallExpr *, CheckerContext &)>;
484
485 using CheckEndOfTranslationUnit =
486 CheckerFn<void (const TranslationUnitDecl *, AnalysisManager &,
487 BugReporter &)>;
488
489 using HandlesStmtFunc = bool (*)(const Stmt *D);
490
491 void _registerForPreStmt(CheckStmtFunc checkfn,
492 HandlesStmtFunc isForStmtFn);
493 void _registerForPostStmt(CheckStmtFunc checkfn,
494 HandlesStmtFunc isForStmtFn);
495
496 void _registerForPreObjCMessage(CheckObjCMessageFunc checkfn);
497 void _registerForPostObjCMessage(CheckObjCMessageFunc checkfn);
498
499 void _registerForObjCMessageNil(CheckObjCMessageFunc checkfn);
500
501 void _registerForPreCall(CheckCallFunc checkfn);
502 void _registerForPostCall(CheckCallFunc checkfn);
503
504 void _registerForLocation(CheckLocationFunc checkfn);
505
506 void _registerForBind(CheckBindFunc checkfn);
507
508 void _registerForEndAnalysis(CheckEndAnalysisFunc checkfn);
509
510 void _registerForBeginFunction(CheckBeginFunctionFunc checkfn);
511 void _registerForEndFunction(CheckEndFunctionFunc checkfn);
512
513 void _registerForBranchCondition(CheckBranchConditionFunc checkfn);
514
515 void _registerForNewAllocator(CheckNewAllocatorFunc checkfn);
516
517 void _registerForLiveSymbols(CheckLiveSymbolsFunc checkfn);
518
519 void _registerForDeadSymbols(CheckDeadSymbolsFunc checkfn);
520
521 void _registerForRegionChanges(CheckRegionChangesFunc checkfn);
522
523 void _registerForPointerEscape(CheckPointerEscapeFunc checkfn);
524
525 void _registerForConstPointerEscape(CheckPointerEscapeFunc checkfn);
526
527 void _registerForEvalAssume(EvalAssumeFunc checkfn);
528
529 void _registerForEvalCall(EvalCallFunc checkfn);
530
531 void _registerForEndOfTranslationUnit(CheckEndOfTranslationUnit checkfn);
532
533//===----------------------------------------------------------------------===//
534// Internal registration functions for events.
535//===----------------------------------------------------------------------===//
536
537 using EventTag = void *;
538 using CheckEventFunc = CheckerFn<void (const void *event)>;
539
540 template <typename EVENT>
541 void _registerListenerForEvent(CheckEventFunc checkfn) {
542 EventInfo &info = Events[&EVENT::Tag];
543 info.Checkers.push_back(checkfn);
544 }
545
546 template <typename EVENT>
547 void _registerDispatcherForEvent() {
548 EventInfo &info = Events[&EVENT::Tag];
549 info.HasDispatcher = true;
550 }
551
552 template <typename EVENT>
553 void _dispatchEvent(const EVENT &event) const {
554 EventsTy::const_iterator I = Events.find(&EVENT::Tag);
555 if (I == Events.end())
556 return;
557 const EventInfo &info = I->second;
558 for (const auto Checker : info.Checkers)
559 Checker(&event);
560 }
561
562//===----------------------------------------------------------------------===//
563// Implementation details.
564//===----------------------------------------------------------------------===//
565
566private:
567 template <typename CHECKER>
568 static void destruct(void *obj) { delete static_cast<CHECKER *>(obj); }
569
570 template <typename T>
571 static void *getTag() { static int tag; return &tag; }
572
573 llvm::DenseMap<CheckerTag, CheckerRef> CheckerTags;
574
575 std::vector<CheckerDtor> CheckerDtors;
576
577 struct DeclCheckerInfo {
578 CheckDeclFunc CheckFn;
579 HandlesDeclFunc IsForDeclFn;
580 };
581 std::vector<DeclCheckerInfo> DeclCheckers;
582
583 std::vector<CheckDeclFunc> BodyCheckers;
584
585 using CachedDeclCheckers = SmallVector<CheckDeclFunc, 4>;
586 using CachedDeclCheckersMapTy = llvm::DenseMap<unsigned, CachedDeclCheckers>;
587 CachedDeclCheckersMapTy CachedDeclCheckersMap;
588
589 struct StmtCheckerInfo {
590 CheckStmtFunc CheckFn;
591 HandlesStmtFunc IsForStmtFn;
592 bool IsPreVisit;
593 };
594 std::vector<StmtCheckerInfo> StmtCheckers;
595
596 using CachedStmtCheckers = SmallVector<CheckStmtFunc, 4>;
597 using CachedStmtCheckersMapTy = llvm::DenseMap<unsigned, CachedStmtCheckers>;
598 CachedStmtCheckersMapTy CachedStmtCheckersMap;
599
600 const CachedStmtCheckers &getCachedStmtCheckersFor(const Stmt *S,
601 bool isPreVisit);
602
603 /// Returns the checkers that have registered for callbacks of the
604 /// given \p Kind.
605 const std::vector<CheckObjCMessageFunc> &
606 getObjCMessageCheckers(ObjCMessageVisitKind Kind);
607
608 std::vector<CheckObjCMessageFunc> PreObjCMessageCheckers;
609 std::vector<CheckObjCMessageFunc> PostObjCMessageCheckers;
610 std::vector<CheckObjCMessageFunc> ObjCMessageNilCheckers;
611
612 std::vector<CheckCallFunc> PreCallCheckers;
613 std::vector<CheckCallFunc> PostCallCheckers;
614
615 std::vector<CheckLocationFunc> LocationCheckers;
616
617 std::vector<CheckBindFunc> BindCheckers;
618
619 std::vector<CheckEndAnalysisFunc> EndAnalysisCheckers;
620
621 std::vector<CheckBeginFunctionFunc> BeginFunctionCheckers;
622 std::vector<CheckEndFunctionFunc> EndFunctionCheckers;
623
624 std::vector<CheckBranchConditionFunc> BranchConditionCheckers;
625
626 std::vector<CheckNewAllocatorFunc> NewAllocatorCheckers;
627
628 std::vector<CheckLiveSymbolsFunc> LiveSymbolsCheckers;
629
630 std::vector<CheckDeadSymbolsFunc> DeadSymbolsCheckers;
631
632 std::vector<CheckRegionChangesFunc> RegionChangesCheckers;
633
634 std::vector<CheckPointerEscapeFunc> PointerEscapeCheckers;
635
636 std::vector<EvalAssumeFunc> EvalAssumeCheckers;
637
638 std::vector<EvalCallFunc> EvalCallCheckers;
639
640 std::vector<CheckEndOfTranslationUnit> EndOfTranslationUnitCheckers;
641
642 struct EventInfo {
643 SmallVector<CheckEventFunc, 4> Checkers;
644 bool HasDispatcher = false;
645
646 EventInfo() = default;
647 };
648
649 using EventsTy = llvm::DenseMap<EventTag, EventInfo>;
650 EventsTy Events;
651};
652
653} // namespace ento
654
655} // namespace clang
656
657#endif // LLVM_CLANG_STATICANALYZER_CORE_CHECKERMANAGER_H
658