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 
140  using CheckerTag = const 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>
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
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
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.
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.
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.
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.
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.
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,
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.
354  runCheckersForRegionChanges(ProgramStateRef state,
355  const InvalidatedSymbols *invalidated,
356  ArrayRef<const MemRegion *> ExplicitRegions,
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.
377  runCheckersForPointerEscape(ProgramStateRef State,
378  const InvalidatedSymbols &Escaped,
379  const CallEvent *Call,
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 =
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 
431 
432  using CheckObjCMessageFunc =
434 
435  using CheckCallFunc =
437 
438  using CheckLocationFunc =
439  CheckerFn<void (const SVal &location, bool isLoad, const Stmt *S,
441 
442  using CheckBindFunc =
443  CheckerFn<void (const SVal &location, const SVal &val, const Stmt *S,
445 
446  using CheckEndAnalysisFunc =
448 
450 
451  using CheckEndFunctionFunc =
453 
456 
457  using CheckNewAllocatorFunc =
459 
460  using CheckDeadSymbolsFunc =
462 
464 
465  using CheckRegionChangesFunc =
467  const InvalidatedSymbols *symbols,
468  ArrayRef<const MemRegion *> ExplicitRegions,
470  const LocationContext *LCtx,
471  const CallEvent *Call)>;
472 
473  using CheckPointerEscapeFunc =
475  const InvalidatedSymbols &Escaped,
476  const CallEvent *Call, PointerEscapeKind Kind,
478 
479  using EvalAssumeFunc =
481  bool assumption)>;
482 
484 
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 *;
539 
540  template <typename EVENT>
542  EventInfo &info = Events[&EVENT::Tag];
543  info.Checkers.push_back(checkfn);
544  }
545 
546  template <typename EVENT>
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 
566 private:
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 
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 
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 {
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
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:86
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:31
The reason for pointer escape is unknown.
ReturnStmt - This represents a return, optionally of an expression: return; return 4;...
Definition: Stmt.h:2462
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:1913
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