clang  9.0.0svn
CheckerManager.h
Go to the documentation of this file.
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 
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 
26 namespace clang {
27 
28 class AnalyzerOptions;
29 class CallExpr;
30 class CXXNewExpr;
31 class Decl;
32 class LocationContext;
33 class Stmt;
34 class TranslationUnitDecl;
35 
36 namespace ento {
37 
38 class AnalysisManager;
39 class BugReporter;
40 class CallEvent;
41 class CheckerBase;
42 class CheckerContext;
43 class CheckerRegistry;
44 class ExplodedGraph;
45 class ExplodedNode;
46 class ExplodedNodeSet;
47 class ExprEngine;
48 class MemRegion;
49 struct NodeBuilderContext;
50 class ObjCMethodCall;
51 class RegionAndSymbolInvalidationTraits;
52 class SVal;
53 class SymbolReaper;
54 
55 template <typename T> class CheckerFn;
56 
57 template <typename RET, typename... Ps>
58 class CheckerFn<RET(Ps...)> {
59  using Func = RET (*)(void *, Ps...);
60 
61  Func Fn;
62 
63 public:
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.
76  /// A pointer escapes due to binding its value to a location
77  /// that the analyzer cannot track.
79 
80  /// The pointer has been passed to a function call directly.
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.
87 
88  /// The reason for pointer escape is unknown. For example,
89  /// a region containing this pointer is invalidated.
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.
97 class CheckName {
98  friend class ::clang::ento::CheckerRegistry;
99 
100  StringRef Name;
101 
102  explicit CheckName(StringRef Name) : Name(Name) {}
103 
104 public:
105  CheckName() = default;
106 
107  StringRef getName() const { return Name; }
108 };
109 
111  Pre,
112  Post,
113  MessageNil
114 };
115 
117  ASTContext &Context;
118  const LangOptions LangOpts;
119  AnalyzerOptions &AOptions;
120  CheckName CurrentCheckName;
121 
122 public:
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  /// Emits an error through a DiagnosticsEngine about an invalid user supplied
140  /// checker option value.
141  void reportInvalidCheckerOptionValue(const CheckerBase *C,
142  StringRef OptionName,
143  StringRef ExpectedValueDesc);
144 
146  using CheckerTag = const void *;
148 
149 //===----------------------------------------------------------------------===//
150 // Checker registration.
151 //===----------------------------------------------------------------------===//
152 
153  /// Used to register checkers.
154  /// All arguments are automatically passed through to the checker
155  /// constructor.
156  ///
157  /// \returns a pointer to the checker object.
158  template <typename CHECKER, typename... AT>
159  CHECKER *registerChecker(AT &&... Args) {
160  CheckerTag tag = getTag<CHECKER>();
161  CheckerRef &ref = CheckerTags[tag];
162  assert(!ref && "Checker already registered, use getChecker!");
163 
164  CHECKER *checker = new CHECKER(std::forward<AT>(Args)...);
165  checker->Name = CurrentCheckName;
166  CheckerDtors.push_back(CheckerDtor(checker, destruct<CHECKER>));
167  CHECKER::_register(checker, *this);
168  ref = checker;
169  return checker;
170  }
171 
172  template <typename CHECKER>
174  CheckerTag tag = getTag<CHECKER>();
175  assert(CheckerTags.count(tag) != 0 &&
176  "Requested checker is not registered! Maybe you should add it as a "
177  "dependency in Checkers.td?");
178  return static_cast<CHECKER *>(CheckerTags[tag]);
179  }
180 
181 //===----------------------------------------------------------------------===//
182 // Functions for running checkers for AST traversing.
183 //===----------------------------------------------------------------------===//
184 
185  /// Run checkers handling Decls.
186  void runCheckersOnASTDecl(const Decl *D, AnalysisManager& mgr,
187  BugReporter &BR);
188 
189  /// Run checkers handling Decls containing a Stmt body.
190  void runCheckersOnASTBody(const Decl *D, AnalysisManager& mgr,
191  BugReporter &BR);
192 
193 //===----------------------------------------------------------------------===//
194 // Functions for running checkers for path-sensitive checking.
195 //===----------------------------------------------------------------------===//
196 
197  /// Run checkers for pre-visiting Stmts.
198  ///
199  /// The notification is performed for every explored CFGElement, which does
200  /// not include the control flow statements such as IfStmt.
201  ///
202  /// \sa runCheckersForBranchCondition, runCheckersForPostStmt
204  const ExplodedNodeSet &Src,
205  const Stmt *S,
206  ExprEngine &Eng) {
207  runCheckersForStmt(/*isPreVisit=*/true, Dst, Src, S, Eng);
208  }
209 
210  /// Run checkers for post-visiting Stmts.
211  ///
212  /// The notification is performed for every explored CFGElement, which does
213  /// not include the control flow statements such as IfStmt.
214  ///
215  /// \sa runCheckersForBranchCondition, runCheckersForPreStmt
217  const ExplodedNodeSet &Src,
218  const Stmt *S,
219  ExprEngine &Eng,
220  bool wasInlined = false) {
221  runCheckersForStmt(/*isPreVisit=*/false, Dst, Src, S, Eng, wasInlined);
222  }
223 
224  /// Run checkers for visiting Stmts.
225  void runCheckersForStmt(bool isPreVisit,
226  ExplodedNodeSet &Dst, const ExplodedNodeSet &Src,
227  const Stmt *S, ExprEngine &Eng,
228  bool wasInlined = false);
229 
230  /// Run checkers for pre-visiting obj-c messages.
232  const ExplodedNodeSet &Src,
233  const ObjCMethodCall &msg,
234  ExprEngine &Eng) {
235  runCheckersForObjCMessage(ObjCMessageVisitKind::Pre, Dst, Src, msg, Eng);
236  }
237 
238  /// Run checkers for post-visiting obj-c messages.
240  const ExplodedNodeSet &Src,
241  const ObjCMethodCall &msg,
242  ExprEngine &Eng,
243  bool wasInlined = false) {
244  runCheckersForObjCMessage(ObjCMessageVisitKind::Post, Dst, Src, msg, Eng,
245  wasInlined);
246  }
247 
248  /// Run checkers for visiting an obj-c message to nil.
250  const ExplodedNodeSet &Src,
251  const ObjCMethodCall &msg,
252  ExprEngine &Eng) {
253  runCheckersForObjCMessage(ObjCMessageVisitKind::MessageNil, Dst, Src, msg,
254  Eng);
255  }
256 
257  /// Run checkers for visiting obj-c messages.
258  void runCheckersForObjCMessage(ObjCMessageVisitKind visitKind,
259  ExplodedNodeSet &Dst,
260  const ExplodedNodeSet &Src,
261  const ObjCMethodCall &msg, ExprEngine &Eng,
262  bool wasInlined = false);
263 
264  /// Run checkers for pre-visiting obj-c messages.
266  const CallEvent &Call, ExprEngine &Eng) {
267  runCheckersForCallEvent(/*isPreVisit=*/true, Dst, Src, Call, Eng);
268  }
269 
270  /// Run checkers for post-visiting obj-c messages.
272  const CallEvent &Call, ExprEngine &Eng,
273  bool wasInlined = false) {
274  runCheckersForCallEvent(/*isPreVisit=*/false, Dst, Src, Call, Eng,
275  wasInlined);
276  }
277 
278  /// Run checkers for visiting obj-c messages.
279  void runCheckersForCallEvent(bool isPreVisit, ExplodedNodeSet &Dst,
280  const ExplodedNodeSet &Src,
281  const CallEvent &Call, ExprEngine &Eng,
282  bool wasInlined = false);
283 
284  /// Run checkers for load/store of a location.
285  void runCheckersForLocation(ExplodedNodeSet &Dst,
286  const ExplodedNodeSet &Src,
287  SVal location,
288  bool isLoad,
289  const Stmt *NodeEx,
290  const Stmt *BoundEx,
291  ExprEngine &Eng);
292 
293  /// Run checkers for binding of a value to a location.
294  void runCheckersForBind(ExplodedNodeSet &Dst,
295  const ExplodedNodeSet &Src,
296  SVal location, SVal val,
297  const Stmt *S, ExprEngine &Eng,
298  const ProgramPoint &PP);
299 
300  /// Run checkers for end of analysis.
301  void runCheckersForEndAnalysis(ExplodedGraph &G, BugReporter &BR,
302  ExprEngine &Eng);
303 
304  /// Run checkers on beginning of function.
305  void runCheckersForBeginFunction(ExplodedNodeSet &Dst,
306  const BlockEdge &L,
307  ExplodedNode *Pred,
308  ExprEngine &Eng);
309 
310  /// Run checkers on end of function.
311  void runCheckersForEndFunction(NodeBuilderContext &BC,
312  ExplodedNodeSet &Dst,
313  ExplodedNode *Pred,
314  ExprEngine &Eng,
315  const ReturnStmt *RS);
316 
317  /// Run checkers for branch condition.
318  void runCheckersForBranchCondition(const Stmt *condition,
319  ExplodedNodeSet &Dst, ExplodedNode *Pred,
320  ExprEngine &Eng);
321 
322  /// Run checkers between C++ operator new and constructor calls.
323  void runCheckersForNewAllocator(const CXXNewExpr *NE, SVal Target,
324  ExplodedNodeSet &Dst,
325  ExplodedNode *Pred,
326  ExprEngine &Eng,
327  bool wasInlined = false);
328 
329  /// Run checkers for live symbols.
330  ///
331  /// Allows modifying SymbolReaper object. For example, checkers can explicitly
332  /// register symbols of interest as live. These symbols will not be marked
333  /// dead and removed.
334  void runCheckersForLiveSymbols(ProgramStateRef state,
335  SymbolReaper &SymReaper);
336 
337  /// Run checkers for dead symbols.
338  ///
339  /// Notifies checkers when symbols become dead. For example, this allows
340  /// checkers to aggressively clean up/reduce the checker state and produce
341  /// precise diagnostics.
342  void runCheckersForDeadSymbols(ExplodedNodeSet &Dst,
343  const ExplodedNodeSet &Src,
344  SymbolReaper &SymReaper, const Stmt *S,
345  ExprEngine &Eng,
347 
348  /// Run checkers for region changes.
349  ///
350  /// This corresponds to the check::RegionChanges callback.
351  /// \param state The current program state.
352  /// \param invalidated A set of all symbols potentially touched by the change.
353  /// \param ExplicitRegions The regions explicitly requested for invalidation.
354  /// For example, in the case of a function call, these would be arguments.
355  /// \param Regions The transitive closure of accessible regions,
356  /// i.e. all regions that may have been touched by this change.
357  /// \param Call The call expression wrapper if the regions are invalidated
358  /// by a call.
360  runCheckersForRegionChanges(ProgramStateRef state,
361  const InvalidatedSymbols *invalidated,
362  ArrayRef<const MemRegion *> ExplicitRegions,
364  const LocationContext *LCtx,
365  const CallEvent *Call);
366 
367  /// Run checkers when pointers escape.
368  ///
369  /// This notifies the checkers about pointer escape, which occurs whenever
370  /// the analyzer cannot track the symbol any more. For example, as a
371  /// result of assigning a pointer into a global or when it's passed to a
372  /// function call the analyzer cannot model.
373  ///
374  /// \param State The state at the point of escape.
375  /// \param Escaped The list of escaped symbols.
376  /// \param Call The corresponding CallEvent, if the symbols escape as
377  /// parameters to the given call.
378  /// \param Kind The reason of pointer escape.
379  /// \param ITraits Information about invalidation for a particular
380  /// region/symbol.
381  /// \returns Checkers can modify the state by returning a new one.
383  runCheckersForPointerEscape(ProgramStateRef State,
384  const InvalidatedSymbols &Escaped,
385  const CallEvent *Call,
388 
389  /// Run checkers for handling assumptions on symbolic values.
390  ProgramStateRef runCheckersForEvalAssume(ProgramStateRef state,
391  SVal Cond, bool Assumption);
392 
393  /// Run checkers for evaluating a call.
394  ///
395  /// Warning: Currently, the CallEvent MUST come from a CallExpr!
396  void runCheckersForEvalCall(ExplodedNodeSet &Dst,
397  const ExplodedNodeSet &Src,
398  const CallEvent &CE, ExprEngine &Eng);
399 
400  /// Run checkers for the entire Translation Unit.
401  void runCheckersOnEndOfTranslationUnit(const TranslationUnitDecl *TU,
402  AnalysisManager &mgr,
403  BugReporter &BR);
404 
405  /// Run checkers for debug-printing a ProgramState.
406  ///
407  /// Unlike most other callbacks, any checker can simply implement the virtual
408  /// method CheckerBase::printState if it has custom data to print.
409  /// \param Out The output stream
410  /// \param State The state being printed
411  /// \param NL The preferred representation of a newline.
412  /// \param Sep The preferred separator between different kinds of data.
413  void runCheckersForPrintState(raw_ostream &Out, ProgramStateRef State,
414  const char *NL, const char *Sep);
415 
416 //===----------------------------------------------------------------------===//
417 // Internal registration functions for AST traversing.
418 //===----------------------------------------------------------------------===//
419 
420  // Functions used by the registration mechanism, checkers should not touch
421  // these directly.
422 
423  using CheckDeclFunc =
425 
426  using HandlesDeclFunc = bool (*)(const Decl *D);
427 
428  void _registerForDecl(CheckDeclFunc checkfn, HandlesDeclFunc isForDeclFn);
429 
430  void _registerForBody(CheckDeclFunc checkfn);
431 
432 //===----------------------------------------------------------------------===//
433 // Internal registration functions for path-sensitive checking.
434 //===----------------------------------------------------------------------===//
435 
437 
438  using CheckObjCMessageFunc =
440 
441  using CheckCallFunc =
443 
444  using CheckLocationFunc =
445  CheckerFn<void (const SVal &location, bool isLoad, const Stmt *S,
447 
448  using CheckBindFunc =
449  CheckerFn<void (const SVal &location, const SVal &val, const Stmt *S,
451 
452  using CheckEndAnalysisFunc =
454 
456 
457  using CheckEndFunctionFunc =
459 
462 
463  using CheckNewAllocatorFunc =
465 
466  using CheckDeadSymbolsFunc =
468 
470 
471  using CheckRegionChangesFunc =
473  const InvalidatedSymbols *symbols,
474  ArrayRef<const MemRegion *> ExplicitRegions,
476  const LocationContext *LCtx,
477  const CallEvent *Call)>;
478 
479  using CheckPointerEscapeFunc =
481  const InvalidatedSymbols &Escaped,
482  const CallEvent *Call, PointerEscapeKind Kind,
484 
485  using EvalAssumeFunc =
487  bool assumption)>;
488 
490 
494 
495  using HandlesStmtFunc = bool (*)(const Stmt *D);
496 
497  void _registerForPreStmt(CheckStmtFunc checkfn,
498  HandlesStmtFunc isForStmtFn);
499  void _registerForPostStmt(CheckStmtFunc checkfn,
500  HandlesStmtFunc isForStmtFn);
501 
502  void _registerForPreObjCMessage(CheckObjCMessageFunc checkfn);
503  void _registerForPostObjCMessage(CheckObjCMessageFunc checkfn);
504 
505  void _registerForObjCMessageNil(CheckObjCMessageFunc checkfn);
506 
507  void _registerForPreCall(CheckCallFunc checkfn);
508  void _registerForPostCall(CheckCallFunc checkfn);
509 
510  void _registerForLocation(CheckLocationFunc checkfn);
511 
512  void _registerForBind(CheckBindFunc checkfn);
513 
514  void _registerForEndAnalysis(CheckEndAnalysisFunc checkfn);
515 
516  void _registerForBeginFunction(CheckBeginFunctionFunc checkfn);
517  void _registerForEndFunction(CheckEndFunctionFunc checkfn);
518 
519  void _registerForBranchCondition(CheckBranchConditionFunc checkfn);
520 
521  void _registerForNewAllocator(CheckNewAllocatorFunc checkfn);
522 
523  void _registerForLiveSymbols(CheckLiveSymbolsFunc checkfn);
524 
525  void _registerForDeadSymbols(CheckDeadSymbolsFunc checkfn);
526 
527  void _registerForRegionChanges(CheckRegionChangesFunc checkfn);
528 
529  void _registerForPointerEscape(CheckPointerEscapeFunc checkfn);
530 
531  void _registerForConstPointerEscape(CheckPointerEscapeFunc checkfn);
532 
533  void _registerForEvalAssume(EvalAssumeFunc checkfn);
534 
535  void _registerForEvalCall(EvalCallFunc checkfn);
536 
537  void _registerForEndOfTranslationUnit(CheckEndOfTranslationUnit checkfn);
538 
539 //===----------------------------------------------------------------------===//
540 // Internal registration functions for events.
541 //===----------------------------------------------------------------------===//
542 
543  using EventTag = void *;
545 
546  template <typename EVENT>
548  EventInfo &info = Events[&EVENT::Tag];
549  info.Checkers.push_back(checkfn);
550  }
551 
552  template <typename EVENT>
554  EventInfo &info = Events[&EVENT::Tag];
555  info.HasDispatcher = true;
556  }
557 
558  template <typename EVENT>
559  void _dispatchEvent(const EVENT &event) const {
560  EventsTy::const_iterator I = Events.find(&EVENT::Tag);
561  if (I == Events.end())
562  return;
563  const EventInfo &info = I->second;
564  for (const auto Checker : info.Checkers)
565  Checker(&event);
566  }
567 
568 //===----------------------------------------------------------------------===//
569 // Implementation details.
570 //===----------------------------------------------------------------------===//
571 
572 private:
573  template <typename CHECKER>
574  static void destruct(void *obj) { delete static_cast<CHECKER *>(obj); }
575 
576  template <typename T>
577  static void *getTag() { static int tag; return &tag; }
578 
579  llvm::DenseMap<CheckerTag, CheckerRef> CheckerTags;
580 
581  std::vector<CheckerDtor> CheckerDtors;
582 
583  struct DeclCheckerInfo {
584  CheckDeclFunc CheckFn;
585  HandlesDeclFunc IsForDeclFn;
586  };
587  std::vector<DeclCheckerInfo> DeclCheckers;
588 
589  std::vector<CheckDeclFunc> BodyCheckers;
590 
592  using CachedDeclCheckersMapTy = llvm::DenseMap<unsigned, CachedDeclCheckers>;
593  CachedDeclCheckersMapTy CachedDeclCheckersMap;
594 
595  struct StmtCheckerInfo {
596  CheckStmtFunc CheckFn;
597  HandlesStmtFunc IsForStmtFn;
598  bool IsPreVisit;
599  };
600  std::vector<StmtCheckerInfo> StmtCheckers;
601 
603  using CachedStmtCheckersMapTy = llvm::DenseMap<unsigned, CachedStmtCheckers>;
604  CachedStmtCheckersMapTy CachedStmtCheckersMap;
605 
606  const CachedStmtCheckers &getCachedStmtCheckersFor(const Stmt *S,
607  bool isPreVisit);
608 
609  /// Returns the checkers that have registered for callbacks of the
610  /// given \p Kind.
611  const std::vector<CheckObjCMessageFunc> &
612  getObjCMessageCheckers(ObjCMessageVisitKind Kind);
613 
614  std::vector<CheckObjCMessageFunc> PreObjCMessageCheckers;
615  std::vector<CheckObjCMessageFunc> PostObjCMessageCheckers;
616  std::vector<CheckObjCMessageFunc> ObjCMessageNilCheckers;
617 
618  std::vector<CheckCallFunc> PreCallCheckers;
619  std::vector<CheckCallFunc> PostCallCheckers;
620 
621  std::vector<CheckLocationFunc> LocationCheckers;
622 
623  std::vector<CheckBindFunc> BindCheckers;
624 
625  std::vector<CheckEndAnalysisFunc> EndAnalysisCheckers;
626 
627  std::vector<CheckBeginFunctionFunc> BeginFunctionCheckers;
628  std::vector<CheckEndFunctionFunc> EndFunctionCheckers;
629 
630  std::vector<CheckBranchConditionFunc> BranchConditionCheckers;
631 
632  std::vector<CheckNewAllocatorFunc> NewAllocatorCheckers;
633 
634  std::vector<CheckLiveSymbolsFunc> LiveSymbolsCheckers;
635 
636  std::vector<CheckDeadSymbolsFunc> DeadSymbolsCheckers;
637 
638  std::vector<CheckRegionChangesFunc> RegionChangesCheckers;
639 
640  std::vector<CheckPointerEscapeFunc> PointerEscapeCheckers;
641 
642  std::vector<EvalAssumeFunc> EvalAssumeCheckers;
643 
644  std::vector<EvalCallFunc> EvalCallCheckers;
645 
646  std::vector<CheckEndOfTranslationUnit> EndOfTranslationUnitCheckers;
647 
648  struct EventInfo {
650  bool HasDispatcher = false;
651 
652  EventInfo() = default;
653  };
654 
655  using EventsTy = llvm::DenseMap<EventTag, EventInfo>;
656  EventsTy Events;
657 };
658 
659 } // namespace ento
660 
661 } // namespace clang
662 
663 #endif // LLVM_CLANG_STATICANALYZER_CORE_CHECKERMANAGER_H
void _dispatchEvent(const EVENT &event) const
Stmt - This represents one statement.
Definition: Stmt.h:65
Information about invalidation for a particular region/symbol.
Definition: MemRegion.h:1439
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:87
IntrusiveRefCntPtr< const ProgramState > ProgramStateRef
The pointer has been passed to a function indirectly.
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
void runCheckersForObjCMessageNil(ExplodedNodeSet &Dst, const ExplodedNodeSet &Src, const ObjCMethodCall &msg, ExprEngine &Eng)
Run checkers for visiting an obj-c message to nil.
A pointer escapes due to binding its value to a location that the analyzer cannot track...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:154
LineState State
CheckerManager(ASTContext &Context, AnalyzerOptions &AOptions)
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:49
void runCheckersForPostObjCMessage(ExplodedNodeSet &Dst, const ExplodedNodeSet &Src, const ObjCMethodCall &msg, ExprEngine &Eng, bool wasInlined=false)
Run checkers for post-visiting obj-c messages.
i32 captured_struct **param SharedsTy A type which contains references the shared variables *param Shareds Context with the list of shared variables from the p *TaskFunction *param Data Additional data for task generation like final * state
Represents any expression that calls an Objective-C method.
Definition: CallEvent.h:969
bool(*)(const Stmt *D) HandlesStmtFunc
void runCheckersForPreCall(ExplodedNodeSet &Dst, const ExplodedNodeSet &Src, const CallEvent &Call, ExprEngine &Eng)
Run checkers for pre-visiting obj-c messages.
void setCurrentCheckName(CheckName name)
void runCheckersForPostCall(ExplodedNodeSet &Dst, const ExplodedNodeSet &Src, const CallEvent &Call, ExprEngine &Eng, bool wasInlined=false)
Run checkers for post-visiting obj-c messages.
CheckName getCurrentCheckName() const
CheckerFn(CheckerBase *checker, Func fn)
StringRef getName() const
void runCheckersForPostStmt(ExplodedNodeSet &Dst, const ExplodedNodeSet &Src, const Stmt *S, ExprEngine &Eng, bool wasInlined=false)
Run checkers for post-visiting Stmts.
Defines the clang::LangOptions interface.
void runCheckersForPreObjCMessage(ExplodedNodeSet &Dst, const ExplodedNodeSet &Src, const ObjCMethodCall &msg, ExprEngine &Eng)
Run checkers for pre-visiting obj-c messages.
The pointer has been passed to a function call directly.
#define bool
Definition: stdbool.h:15
The reason for pointer escape is unknown.
ReturnStmt - This represents a return, optionally of an expression: return; return 4;...
Definition: Stmt.h:2550
BugReporter is a utility class for generating PathDiagnostics for analysis.
Definition: BugReporter.h:411
Kind
void _registerListenerForEvent(CheckEventFunc checkfn)
CHECKER * registerChecker(AT &&... Args)
Used to register checkers.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
Definition: ExprCXX.h:1989
SVal - This represents a symbolic expression, which can be either an L-value or an R-value...
Definition: SVals.h:75
A class responsible for cleaning up unused symbols.
void runCheckersForPreStmt(ExplodedNodeSet &Dst, const ExplodedNodeSet &Src, const Stmt *S, ExprEngine &Eng)
Run checkers for pre-visiting Stmts.
Dataflow Directional Tag Classes.
#define CHECKER(FULLNAME, CLASS, HELPTEXT, DOC_URI)
Represents an abstract call to a function or method along a particular path.
Definition: CallEvent.h:170
AnalyzerOptions & getAnalyzerOptions()
PointerEscapeKind
Describes the different reasons a pointer escapes during analysis.
Stores options for the analyzer from the command line.
bool(*)(const Decl *D) HandlesDeclFunc
The top declaration context.
Definition: Decl.h:107
const LangOptions & getLangOpts() const