clang  10.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 checker
95 /// name strings have a lifetime that keeps them alive at least until the path
96 /// diagnostics have been processed, since they are expected to be constexpr
97 /// string literals (most likely generated by TblGen).
99  friend class ::clang::ento::CheckerRegistry;
100 
101  StringRef Name;
102 
103  explicit CheckerNameRef(StringRef Name) : Name(Name) {}
104 
105 public:
106  CheckerNameRef() = default;
107 
108  StringRef getName() const { return Name; }
109  operator StringRef() const { return Name; }
110 };
111 
113  Pre,
114  Post,
115  MessageNil
116 };
117 
119  ASTContext &Context;
120  const LangOptions LangOpts;
121  AnalyzerOptions &AOptions;
122  CheckerNameRef CurrentCheckerName;
123 
124 public:
126  : Context(Context), LangOpts(Context.getLangOpts()), AOptions(AOptions) {}
127 
128  ~CheckerManager();
129 
130  void setCurrentCheckerName(CheckerNameRef name) { CurrentCheckerName = name; }
131  CheckerNameRef getCurrentCheckerName() const { return CurrentCheckerName; }
132 
133  bool hasPathSensitiveCheckers() const;
134 
135  void finishedCheckerRegistration();
136 
137  const LangOptions &getLangOpts() const { return LangOpts; }
138  AnalyzerOptions &getAnalyzerOptions() { return AOptions; }
139  ASTContext &getASTContext() { return Context; }
140 
141  /// Emits an error through a DiagnosticsEngine about an invalid user supplied
142  /// checker option value.
143  void reportInvalidCheckerOptionValue(const CheckerBase *C,
144  StringRef OptionName,
145  StringRef ExpectedValueDesc);
146 
148  using CheckerTag = const void *;
150 
151 //===----------------------------------------------------------------------===//
152 // Checker registration.
153 //===----------------------------------------------------------------------===//
154 
155  /// Used to register checkers.
156  /// All arguments are automatically passed through to the checker
157  /// constructor.
158  ///
159  /// \returns a pointer to the checker object.
160  template <typename CHECKER, typename... AT>
161  CHECKER *registerChecker(AT &&... Args) {
162  CheckerTag tag = getTag<CHECKER>();
163  CheckerRef &ref = CheckerTags[tag];
164  assert(!ref && "Checker already registered, use getChecker!");
165 
166  CHECKER *checker = new CHECKER(std::forward<AT>(Args)...);
167  checker->Name = CurrentCheckerName;
168  CheckerDtors.push_back(CheckerDtor(checker, destruct<CHECKER>));
169  CHECKER::_register(checker, *this);
170  ref = checker;
171  return checker;
172  }
173 
174  template <typename CHECKER>
176  CheckerTag tag = getTag<CHECKER>();
177  assert(CheckerTags.count(tag) != 0 &&
178  "Requested checker is not registered! Maybe you should add it as a "
179  "dependency in Checkers.td?");
180  return static_cast<CHECKER *>(CheckerTags[tag]);
181  }
182 
183 //===----------------------------------------------------------------------===//
184 // Functions for running checkers for AST traversing.
185 //===----------------------------------------------------------------------===//
186 
187  /// Run checkers handling Decls.
188  void runCheckersOnASTDecl(const Decl *D, AnalysisManager& mgr,
189  BugReporter &BR);
190 
191  /// Run checkers handling Decls containing a Stmt body.
192  void runCheckersOnASTBody(const Decl *D, AnalysisManager& mgr,
193  BugReporter &BR);
194 
195 //===----------------------------------------------------------------------===//
196 // Functions for running checkers for path-sensitive checking.
197 //===----------------------------------------------------------------------===//
198 
199  /// Run checkers for pre-visiting Stmts.
200  ///
201  /// The notification is performed for every explored CFGElement, which does
202  /// not include the control flow statements such as IfStmt.
203  ///
204  /// \sa runCheckersForBranchCondition, runCheckersForPostStmt
206  const ExplodedNodeSet &Src,
207  const Stmt *S,
208  ExprEngine &Eng) {
209  runCheckersForStmt(/*isPreVisit=*/true, Dst, Src, S, Eng);
210  }
211 
212  /// Run checkers for post-visiting Stmts.
213  ///
214  /// The notification is performed for every explored CFGElement, which does
215  /// not include the control flow statements such as IfStmt.
216  ///
217  /// \sa runCheckersForBranchCondition, runCheckersForPreStmt
219  const ExplodedNodeSet &Src,
220  const Stmt *S,
221  ExprEngine &Eng,
222  bool wasInlined = false) {
223  runCheckersForStmt(/*isPreVisit=*/false, Dst, Src, S, Eng, wasInlined);
224  }
225 
226  /// Run checkers for visiting Stmts.
227  void runCheckersForStmt(bool isPreVisit,
228  ExplodedNodeSet &Dst, const ExplodedNodeSet &Src,
229  const Stmt *S, ExprEngine &Eng,
230  bool wasInlined = false);
231 
232  /// Run checkers for pre-visiting obj-c messages.
234  const ExplodedNodeSet &Src,
235  const ObjCMethodCall &msg,
236  ExprEngine &Eng) {
237  runCheckersForObjCMessage(ObjCMessageVisitKind::Pre, Dst, Src, msg, Eng);
238  }
239 
240  /// Run checkers for post-visiting obj-c messages.
242  const ExplodedNodeSet &Src,
243  const ObjCMethodCall &msg,
244  ExprEngine &Eng,
245  bool wasInlined = false) {
246  runCheckersForObjCMessage(ObjCMessageVisitKind::Post, Dst, Src, msg, Eng,
247  wasInlined);
248  }
249 
250  /// Run checkers for visiting an obj-c message to nil.
252  const ExplodedNodeSet &Src,
253  const ObjCMethodCall &msg,
254  ExprEngine &Eng) {
255  runCheckersForObjCMessage(ObjCMessageVisitKind::MessageNil, Dst, Src, msg,
256  Eng);
257  }
258 
259  /// Run checkers for visiting obj-c messages.
260  void runCheckersForObjCMessage(ObjCMessageVisitKind visitKind,
261  ExplodedNodeSet &Dst,
262  const ExplodedNodeSet &Src,
263  const ObjCMethodCall &msg, ExprEngine &Eng,
264  bool wasInlined = false);
265 
266  /// Run checkers for pre-visiting obj-c messages.
268  const CallEvent &Call, ExprEngine &Eng) {
269  runCheckersForCallEvent(/*isPreVisit=*/true, Dst, Src, Call, Eng);
270  }
271 
272  /// Run checkers for post-visiting obj-c messages.
274  const CallEvent &Call, ExprEngine &Eng,
275  bool wasInlined = false) {
276  runCheckersForCallEvent(/*isPreVisit=*/false, Dst, Src, Call, Eng,
277  wasInlined);
278  }
279 
280  /// Run checkers for visiting obj-c messages.
281  void runCheckersForCallEvent(bool isPreVisit, ExplodedNodeSet &Dst,
282  const ExplodedNodeSet &Src,
283  const CallEvent &Call, ExprEngine &Eng,
284  bool wasInlined = false);
285 
286  /// Run checkers for load/store of a location.
287  void runCheckersForLocation(ExplodedNodeSet &Dst,
288  const ExplodedNodeSet &Src,
289  SVal location,
290  bool isLoad,
291  const Stmt *NodeEx,
292  const Stmt *BoundEx,
293  ExprEngine &Eng);
294 
295  /// Run checkers for binding of a value to a location.
296  void runCheckersForBind(ExplodedNodeSet &Dst,
297  const ExplodedNodeSet &Src,
298  SVal location, SVal val,
299  const Stmt *S, ExprEngine &Eng,
300  const ProgramPoint &PP);
301 
302  /// Run checkers for end of analysis.
303  void runCheckersForEndAnalysis(ExplodedGraph &G, BugReporter &BR,
304  ExprEngine &Eng);
305 
306  /// Run checkers on beginning of function.
307  void runCheckersForBeginFunction(ExplodedNodeSet &Dst,
308  const BlockEdge &L,
309  ExplodedNode *Pred,
310  ExprEngine &Eng);
311 
312  /// Run checkers on end of function.
313  void runCheckersForEndFunction(NodeBuilderContext &BC,
314  ExplodedNodeSet &Dst,
315  ExplodedNode *Pred,
316  ExprEngine &Eng,
317  const ReturnStmt *RS);
318 
319  /// Run checkers for branch condition.
320  void runCheckersForBranchCondition(const Stmt *condition,
321  ExplodedNodeSet &Dst, ExplodedNode *Pred,
322  ExprEngine &Eng);
323 
324  /// Run checkers between C++ operator new and constructor calls.
325  void runCheckersForNewAllocator(const CXXNewExpr *NE, SVal Target,
326  ExplodedNodeSet &Dst,
327  ExplodedNode *Pred,
328  ExprEngine &Eng,
329  bool wasInlined = false);
330 
331  /// Run checkers for live symbols.
332  ///
333  /// Allows modifying SymbolReaper object. For example, checkers can explicitly
334  /// register symbols of interest as live. These symbols will not be marked
335  /// dead and removed.
336  void runCheckersForLiveSymbols(ProgramStateRef state,
337  SymbolReaper &SymReaper);
338 
339  /// Run checkers for dead symbols.
340  ///
341  /// Notifies checkers when symbols become dead. For example, this allows
342  /// checkers to aggressively clean up/reduce the checker state and produce
343  /// precise diagnostics.
344  void runCheckersForDeadSymbols(ExplodedNodeSet &Dst,
345  const ExplodedNodeSet &Src,
346  SymbolReaper &SymReaper, const Stmt *S,
347  ExprEngine &Eng,
349 
350  /// Run checkers for region changes.
351  ///
352  /// This corresponds to the check::RegionChanges callback.
353  /// \param state The current program state.
354  /// \param invalidated A set of all symbols potentially touched by the change.
355  /// \param ExplicitRegions The regions explicitly requested for invalidation.
356  /// For example, in the case of a function call, these would be arguments.
357  /// \param Regions The transitive closure of accessible regions,
358  /// i.e. all regions that may have been touched by this change.
359  /// \param Call The call expression wrapper if the regions are invalidated
360  /// by a call.
362  runCheckersForRegionChanges(ProgramStateRef state,
363  const InvalidatedSymbols *invalidated,
364  ArrayRef<const MemRegion *> ExplicitRegions,
366  const LocationContext *LCtx,
367  const CallEvent *Call);
368 
369  /// Run checkers when pointers escape.
370  ///
371  /// This notifies the checkers about pointer escape, which occurs whenever
372  /// the analyzer cannot track the symbol any more. For example, as a
373  /// result of assigning a pointer into a global or when it's passed to a
374  /// function call the analyzer cannot model.
375  ///
376  /// \param State The state at the point of escape.
377  /// \param Escaped The list of escaped symbols.
378  /// \param Call The corresponding CallEvent, if the symbols escape as
379  /// parameters to the given call.
380  /// \param Kind The reason of pointer escape.
381  /// \param ITraits Information about invalidation for a particular
382  /// region/symbol.
383  /// \returns Checkers can modify the state by returning a new one.
385  runCheckersForPointerEscape(ProgramStateRef State,
386  const InvalidatedSymbols &Escaped,
387  const CallEvent *Call,
390 
391  /// Run checkers for handling assumptions on symbolic values.
392  ProgramStateRef runCheckersForEvalAssume(ProgramStateRef state,
393  SVal Cond, bool Assumption);
394 
395  /// Run checkers for evaluating a call.
396  ///
397  /// Warning: Currently, the CallEvent MUST come from a CallExpr!
398  void runCheckersForEvalCall(ExplodedNodeSet &Dst,
399  const ExplodedNodeSet &Src,
400  const CallEvent &CE, ExprEngine &Eng);
401 
402  /// Run checkers for the entire Translation Unit.
403  void runCheckersOnEndOfTranslationUnit(const TranslationUnitDecl *TU,
404  AnalysisManager &mgr,
405  BugReporter &BR);
406 
407  /// Run checkers for debug-printing a ProgramState.
408  ///
409  /// Unlike most other callbacks, any checker can simply implement the virtual
410  /// method CheckerBase::printState if it has custom data to print.
411  ///
412  /// \param Out The output stream
413  /// \param State The state being printed
414  /// \param NL The preferred representation of a newline.
415  /// \param Space The preferred space between the left side and the message.
416  /// \param IsDot Whether the message will be printed in 'dot' format.
417  void runCheckersForPrintStateJson(raw_ostream &Out, ProgramStateRef State,
418  const char *NL = "\n",
419  unsigned int Space = 0,
420  bool IsDot = false) const;
421 
422  //===----------------------------------------------------------------------===//
423  // Internal registration functions for AST traversing.
424  //===----------------------------------------------------------------------===//
425 
426  // Functions used by the registration mechanism, checkers should not touch
427  // these directly.
428 
429  using CheckDeclFunc =
431 
432  using HandlesDeclFunc = bool (*)(const Decl *D);
433 
434  void _registerForDecl(CheckDeclFunc checkfn, HandlesDeclFunc isForDeclFn);
435 
436  void _registerForBody(CheckDeclFunc checkfn);
437 
438 //===----------------------------------------------------------------------===//
439 // Internal registration functions for path-sensitive checking.
440 //===----------------------------------------------------------------------===//
441 
443 
444  using CheckObjCMessageFunc =
446 
447  using CheckCallFunc =
449 
450  using CheckLocationFunc =
451  CheckerFn<void (const SVal &location, bool isLoad, const Stmt *S,
453 
454  using CheckBindFunc =
455  CheckerFn<void (const SVal &location, const SVal &val, const Stmt *S,
457 
458  using CheckEndAnalysisFunc =
460 
462 
463  using CheckEndFunctionFunc =
465 
468 
469  using CheckNewAllocatorFunc =
471 
472  using CheckDeadSymbolsFunc =
474 
476 
477  using CheckRegionChangesFunc =
479  const InvalidatedSymbols *symbols,
480  ArrayRef<const MemRegion *> ExplicitRegions,
482  const LocationContext *LCtx,
483  const CallEvent *Call)>;
484 
485  using CheckPointerEscapeFunc =
487  const InvalidatedSymbols &Escaped,
488  const CallEvent *Call, PointerEscapeKind Kind,
490 
491  using EvalAssumeFunc =
493  bool assumption)>;
494 
496 
500 
501  using HandlesStmtFunc = bool (*)(const Stmt *D);
502 
503  void _registerForPreStmt(CheckStmtFunc checkfn,
504  HandlesStmtFunc isForStmtFn);
505  void _registerForPostStmt(CheckStmtFunc checkfn,
506  HandlesStmtFunc isForStmtFn);
507 
508  void _registerForPreObjCMessage(CheckObjCMessageFunc checkfn);
509  void _registerForPostObjCMessage(CheckObjCMessageFunc checkfn);
510 
511  void _registerForObjCMessageNil(CheckObjCMessageFunc checkfn);
512 
513  void _registerForPreCall(CheckCallFunc checkfn);
514  void _registerForPostCall(CheckCallFunc checkfn);
515 
516  void _registerForLocation(CheckLocationFunc checkfn);
517 
518  void _registerForBind(CheckBindFunc checkfn);
519 
520  void _registerForEndAnalysis(CheckEndAnalysisFunc checkfn);
521 
522  void _registerForBeginFunction(CheckBeginFunctionFunc checkfn);
523  void _registerForEndFunction(CheckEndFunctionFunc checkfn);
524 
525  void _registerForBranchCondition(CheckBranchConditionFunc checkfn);
526 
527  void _registerForNewAllocator(CheckNewAllocatorFunc checkfn);
528 
529  void _registerForLiveSymbols(CheckLiveSymbolsFunc checkfn);
530 
531  void _registerForDeadSymbols(CheckDeadSymbolsFunc checkfn);
532 
533  void _registerForRegionChanges(CheckRegionChangesFunc checkfn);
534 
535  void _registerForPointerEscape(CheckPointerEscapeFunc checkfn);
536 
537  void _registerForConstPointerEscape(CheckPointerEscapeFunc checkfn);
538 
539  void _registerForEvalAssume(EvalAssumeFunc checkfn);
540 
541  void _registerForEvalCall(EvalCallFunc checkfn);
542 
543  void _registerForEndOfTranslationUnit(CheckEndOfTranslationUnit checkfn);
544 
545 //===----------------------------------------------------------------------===//
546 // Internal registration functions for events.
547 //===----------------------------------------------------------------------===//
548 
549  using EventTag = void *;
551 
552  template <typename EVENT>
554  EventInfo &info = Events[&EVENT::Tag];
555  info.Checkers.push_back(checkfn);
556  }
557 
558  template <typename EVENT>
560  EventInfo &info = Events[&EVENT::Tag];
561  info.HasDispatcher = true;
562  }
563 
564  template <typename EVENT>
565  void _dispatchEvent(const EVENT &event) const {
566  EventsTy::const_iterator I = Events.find(&EVENT::Tag);
567  if (I == Events.end())
568  return;
569  const EventInfo &info = I->second;
570  for (const auto Checker : info.Checkers)
571  Checker(&event);
572  }
573 
574 //===----------------------------------------------------------------------===//
575 // Implementation details.
576 //===----------------------------------------------------------------------===//
577 
578 private:
579  template <typename CHECKER>
580  static void destruct(void *obj) { delete static_cast<CHECKER *>(obj); }
581 
582  template <typename T>
583  static void *getTag() { static int tag; return &tag; }
584 
585  llvm::DenseMap<CheckerTag, CheckerRef> CheckerTags;
586 
587  std::vector<CheckerDtor> CheckerDtors;
588 
589  struct DeclCheckerInfo {
590  CheckDeclFunc CheckFn;
591  HandlesDeclFunc IsForDeclFn;
592  };
593  std::vector<DeclCheckerInfo> DeclCheckers;
594 
595  std::vector<CheckDeclFunc> BodyCheckers;
596 
598  using CachedDeclCheckersMapTy = llvm::DenseMap<unsigned, CachedDeclCheckers>;
599  CachedDeclCheckersMapTy CachedDeclCheckersMap;
600 
601  struct StmtCheckerInfo {
602  CheckStmtFunc CheckFn;
603  HandlesStmtFunc IsForStmtFn;
604  bool IsPreVisit;
605  };
606  std::vector<StmtCheckerInfo> StmtCheckers;
607 
609  using CachedStmtCheckersMapTy = llvm::DenseMap<unsigned, CachedStmtCheckers>;
610  CachedStmtCheckersMapTy CachedStmtCheckersMap;
611 
612  const CachedStmtCheckers &getCachedStmtCheckersFor(const Stmt *S,
613  bool isPreVisit);
614 
615  /// Returns the checkers that have registered for callbacks of the
616  /// given \p Kind.
617  const std::vector<CheckObjCMessageFunc> &
618  getObjCMessageCheckers(ObjCMessageVisitKind Kind);
619 
620  std::vector<CheckObjCMessageFunc> PreObjCMessageCheckers;
621  std::vector<CheckObjCMessageFunc> PostObjCMessageCheckers;
622  std::vector<CheckObjCMessageFunc> ObjCMessageNilCheckers;
623 
624  std::vector<CheckCallFunc> PreCallCheckers;
625  std::vector<CheckCallFunc> PostCallCheckers;
626 
627  std::vector<CheckLocationFunc> LocationCheckers;
628 
629  std::vector<CheckBindFunc> BindCheckers;
630 
631  std::vector<CheckEndAnalysisFunc> EndAnalysisCheckers;
632 
633  std::vector<CheckBeginFunctionFunc> BeginFunctionCheckers;
634  std::vector<CheckEndFunctionFunc> EndFunctionCheckers;
635 
636  std::vector<CheckBranchConditionFunc> BranchConditionCheckers;
637 
638  std::vector<CheckNewAllocatorFunc> NewAllocatorCheckers;
639 
640  std::vector<CheckLiveSymbolsFunc> LiveSymbolsCheckers;
641 
642  std::vector<CheckDeadSymbolsFunc> DeadSymbolsCheckers;
643 
644  std::vector<CheckRegionChangesFunc> RegionChangesCheckers;
645 
646  std::vector<CheckPointerEscapeFunc> PointerEscapeCheckers;
647 
648  std::vector<EvalAssumeFunc> EvalAssumeCheckers;
649 
650  std::vector<EvalCallFunc> EvalCallCheckers;
651 
652  std::vector<CheckEndOfTranslationUnit> EndOfTranslationUnitCheckers;
653 
654  struct EventInfo {
656  bool HasDispatcher = false;
657 
658  EventInfo() = default;
659  };
660 
661  using EventsTy = llvm::DenseMap<EventTag, EventInfo>;
662  EventsTy Events;
663 };
664 
665 } // namespace ento
666 
667 } // namespace clang
668 
669 #endif // LLVM_CLANG_STATICANALYZER_CORE_CHECKERMANAGER_H
This wrapper is used to ensure that only StringRefs originating from the CheckerRegistry are used as ...
void _dispatchEvent(const EVENT &event) const
Stmt - This represents one statement.
Definition: Stmt.h:66
Information about invalidation for a particular region/symbol.
Definition: MemRegion.h:1445
#define CHECKER(FULLNAME, CLASS, HELPTEXT, DOC_URI, IS_HIDDEN)
void setCurrentCheckerName(CheckerNameRef name)
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:88
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 ...
RangeSelector name(std::string ID)
Given a node with a "name", (like NamedDecl, DeclRefExpr or CxxCtorInitializer) selects the name&#39;s to...
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:160
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:938
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 runCheckersForPostCall(ExplodedNodeSet &Dst, const ExplodedNodeSet &Src, const CallEvent &Call, ExprEngine &Eng, bool wasInlined=false)
Run checkers for post-visiting obj-c messages.
CheckerFn(CheckerBase *checker, Func fn)
CheckerNameRef getCurrentCheckerName() 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:2610
BugReporter is a utility class for generating PathDiagnostics for analysis.
Definition: BugReporter.h:576
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:2005
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.
bool NE(InterpState &S, CodePtr OpPC)
Definition: Interp.h:226
Represents an abstract call to a function or method along a particular path.
Definition: CallEvent.h:138
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