clang  16.0.0git
CallEvent.h
Go to the documentation of this file.
1 //===- CallEvent.h - Wrapper for all function and method calls --*- 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 /// \file This file defines CallEvent and its subclasses, which represent path-
10 /// sensitive instances of different kinds of function and method calls
11 /// (C, C++, and Objective-C).
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_CALLEVENT_H
16 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_CALLEVENT_H
17 
18 #include "clang/AST/Decl.h"
19 #include "clang/AST/DeclBase.h"
20 #include "clang/AST/DeclCXX.h"
21 #include "clang/AST/DeclObjC.h"
22 #include "clang/AST/Expr.h"
23 #include "clang/AST/ExprCXX.h"
24 #include "clang/AST/ExprObjC.h"
25 #include "clang/AST/Stmt.h"
26 #include "clang/AST/Type.h"
28 #include "clang/Basic/LLVM.h"
35 #include "llvm/ADT/ArrayRef.h"
36 #include "llvm/ADT/IntrusiveRefCntPtr.h"
37 #include "llvm/ADT/PointerIntPair.h"
38 #include "llvm/ADT/PointerUnion.h"
39 #include "llvm/ADT/STLExtras.h"
40 #include "llvm/ADT/SmallVector.h"
41 #include "llvm/ADT/StringRef.h"
42 #include "llvm/ADT/iterator_range.h"
43 #include "llvm/Support/Allocator.h"
44 #include "llvm/Support/Casting.h"
45 #include "llvm/Support/ErrorHandling.h"
46 #include <cassert>
47 #include <limits>
48 #include <utility>
49 
50 namespace clang {
51 
52 class LocationContext;
53 class ProgramPoint;
54 class ProgramPointTag;
55 class StackFrameContext;
56 
57 namespace ento {
58 
76 };
77 
78 class CallEvent;
79 
80 template<typename T = CallEvent>
81 class CallEventRef : public IntrusiveRefCntPtr<const T> {
82 public:
83  CallEventRef(const T *Call) : IntrusiveRefCntPtr<const T>(Call) {}
84  CallEventRef(const CallEventRef &Orig) : IntrusiveRefCntPtr<const T>(Orig) {}
85 
87  return this->get()->template cloneWithState<T>(State);
88  }
89 
90  // Allow implicit conversions to a superclass type, since CallEventRef
91  // behaves like a pointer-to-const.
92  template <typename SuperT>
93  operator CallEventRef<SuperT> () const {
94  return this->get();
95  }
96 };
97 
98 /// \class RuntimeDefinition
99 /// Defines the runtime definition of the called function.
100 ///
101 /// Encapsulates the information we have about which Decl will be used
102 /// when the call is executed on the given path. When dealing with dynamic
103 /// dispatch, the information is based on DynamicTypeInfo and might not be
104 /// precise.
106  /// The Declaration of the function which could be called at runtime.
107  /// NULL if not available.
108  const Decl *D = nullptr;
109 
110  /// The region representing an object (ObjC/C++) on which the method is
111  /// called. With dynamic dispatch, the method definition depends on the
112  /// runtime type of this object. NULL when the DynamicTypeInfo is
113  /// precise.
114  const MemRegion *R = nullptr;
115 
116  /// A definition is foreign if it has been imported and newly created by the
117  /// ASTImporter. This can be true only if CTU is enabled.
118  const bool Foreign = false;
119 
120 public:
121  RuntimeDefinition() = default;
122  RuntimeDefinition(const Decl *InD): D(InD) {}
123  RuntimeDefinition(const Decl *InD, bool Foreign) : D(InD), Foreign(Foreign) {}
124  RuntimeDefinition(const Decl *InD, const MemRegion *InR): D(InD), R(InR) {}
125 
126  const Decl *getDecl() { return D; }
127  bool isForeign() const { return Foreign; }
128 
129  /// Check if the definition we have is precise.
130  /// If not, it is possible that the call dispatches to another definition at
131  /// execution time.
132  bool mayHaveOtherDefinitions() { return R != nullptr; }
133 
134  /// When other definitions are possible, returns the region whose runtime type
135  /// determines the method definition.
136  const MemRegion *getDispatchRegion() { return R; }
137 };
138 
139 /// Represents an abstract call to a function or method along a
140 /// particular path.
141 ///
142 /// CallEvents are created through the factory methods of CallEventManager.
143 ///
144 /// CallEvents should always be cheap to create and destroy. In order for
145 /// CallEventManager to be able to re-use CallEvent-sized memory blocks,
146 /// subclasses of CallEvent may not add any data members to the base class.
147 /// Use the "Data" and "Location" fields instead.
148 class CallEvent {
149 public:
151 
152 private:
153  ProgramStateRef State;
154  const LocationContext *LCtx;
155  llvm::PointerUnion<const Expr *, const Decl *> Origin;
156  mutable Optional<bool> Foreign; // Set by CTU analysis.
157 
158 protected:
159  // This is user data for subclasses.
160  const void *Data;
161 
162  // This is user data for subclasses.
163  // This should come right before RefCount, so that the two fields can be
164  // packed together on LP64 platforms.
166 
167 private:
168  template <typename T> friend struct llvm::IntrusiveRefCntPtrInfo;
169 
170  mutable unsigned RefCount = 0;
171 
172  void Retain() const { ++RefCount; }
173  void Release() const;
174 
175 protected:
176  friend class CallEventManager;
177 
179  : State(std::move(state)), LCtx(lctx), Origin(E) {}
180 
182  : State(std::move(state)), LCtx(lctx), Origin(D) {}
183 
184  // DO NOT MAKE PUBLIC
185  CallEvent(const CallEvent &Original)
186  : State(Original.State), LCtx(Original.LCtx), Origin(Original.Origin),
187  Data(Original.Data), Location(Original.Location) {}
188 
189  /// Copies this CallEvent, with vtable intact, into a new block of memory.
190  virtual void cloneTo(void *Dest) const = 0;
191 
192  /// Get the value of arbitrary expressions at this point in the path.
193  SVal getSVal(const Stmt *S) const {
194  return getState()->getSVal(S, getLocationContext());
195  }
196 
198 
199  /// Used to specify non-argument regions that will be invalidated as a
200  /// result of this call.
201  virtual void getExtraInvalidatedValues(ValueList &Values,
202  RegionAndSymbolInvalidationTraits *ETraits) const {}
203 
204 public:
205  CallEvent &operator=(const CallEvent &) = delete;
206  virtual ~CallEvent() = default;
207 
208  /// Returns the kind of call this is.
209  virtual Kind getKind() const = 0;
210  virtual StringRef getKindAsString() const = 0;
211 
212  /// Returns the declaration of the function or method that will be
213  /// called. May be null.
214  virtual const Decl *getDecl() const {
215  return Origin.dyn_cast<const Decl *>();
216  }
217 
218  bool isForeign() const {
219  assert(Foreign && "Foreign must be set before querying");
220  return *Foreign;
221  }
222  void setForeign(bool B) const { Foreign = B; }
223 
224  /// The state in which the call is being evaluated.
225  const ProgramStateRef &getState() const {
226  return State;
227  }
228 
229  /// The context in which the call is being evaluated.
231  return LCtx;
232  }
233 
234  /// Returns the definition of the function or method that will be
235  /// called.
236  virtual RuntimeDefinition getRuntimeDefinition() const = 0;
237 
238  /// Returns the expression whose value will be the result of this call.
239  /// May be null.
240  virtual const Expr *getOriginExpr() const {
241  return Origin.dyn_cast<const Expr *>();
242  }
243 
244  /// Returns the number of arguments (explicit and implicit).
245  ///
246  /// Note that this may be greater than the number of parameters in the
247  /// callee's declaration, and that it may include arguments not written in
248  /// the source.
249  virtual unsigned getNumArgs() const = 0;
250 
251  /// Returns true if the callee is known to be from a system header.
252  bool isInSystemHeader() const {
253  const Decl *D = getDecl();
254  if (!D)
255  return false;
256 
258  if (Loc.isValid()) {
259  const SourceManager &SM =
260  getState()->getStateManager().getContext().getSourceManager();
261  return SM.isInSystemHeader(D->getLocation());
262  }
263 
264  // Special case for implicitly-declared global operator new/delete.
265  // These should be considered system functions.
266  if (const auto *FD = dyn_cast<FunctionDecl>(D))
267  return FD->isOverloadedOperator() && FD->isImplicit() && FD->isGlobal();
268 
269  return false;
270  }
271 
272  /// Returns a source range for the entire call, suitable for
273  /// outputting in diagnostics.
274  virtual SourceRange getSourceRange() const {
275  return getOriginExpr()->getSourceRange();
276  }
277 
278  /// Returns the value of a given argument at the time of the call.
279  virtual SVal getArgSVal(unsigned Index) const;
280 
281  /// Returns the expression associated with a given argument.
282  /// May be null if this expression does not appear in the source.
283  virtual const Expr *getArgExpr(unsigned Index) const { return nullptr; }
284 
285  /// Returns the source range for errors associated with this argument.
286  ///
287  /// May be invalid if the argument is not written in the source.
288  virtual SourceRange getArgSourceRange(unsigned Index) const;
289 
290  /// Returns the result type, adjusted for references.
291  QualType getResultType() const;
292 
293  /// Returns the return value of the call.
294  ///
295  /// This should only be called if the CallEvent was created using a state in
296  /// which the return value has already been bound to the origin expression.
297  SVal getReturnValue() const;
298 
299  /// Returns true if the type of any of the non-null arguments satisfies
300  /// the condition.
301  bool hasNonNullArgumentsWithType(bool (*Condition)(QualType)) const;
302 
303  /// Returns true if any of the arguments appear to represent callbacks.
304  bool hasNonZeroCallbackArg() const;
305 
306  /// Returns true if any of the arguments is void*.
307  bool hasVoidPointerToNonConstArg() const;
308 
309  /// Returns true if any of the arguments are known to escape to long-
310  /// term storage, even if this method will not modify them.
311  // NOTE: The exact semantics of this are still being defined!
312  // We don't really want a list of hardcoded exceptions in the long run,
313  // but we don't want duplicated lists of known APIs in the short term either.
314  virtual bool argumentsMayEscape() const {
315  return hasNonZeroCallbackArg();
316  }
317 
318  /// Returns true if the callee is an externally-visible function in the
319  /// top-level namespace, such as \c malloc.
320  ///
321  /// You can use this call to determine that a particular function really is
322  /// a library function and not, say, a C++ member function with the same name.
323  ///
324  /// If a name is provided, the function must additionally match the given
325  /// name.
326  ///
327  /// Note that this deliberately excludes C++ library functions in the \c std
328  /// namespace, but will include C library functions accessed through the
329  /// \c std namespace. This also does not check if the function is declared
330  /// as 'extern "C"', or if it uses C++ name mangling.
331  // FIXME: Add a helper for checking namespaces.
332  // FIXME: Move this down to AnyFunctionCall once checkers have more
333  // precise callbacks.
334  bool isGlobalCFunction(StringRef SpecificName = StringRef()) const;
335 
336  /// Returns the name of the callee, if its name is a simple identifier.
337  ///
338  /// Note that this will fail for Objective-C methods, blocks, and C++
339  /// overloaded operators. The former is named by a Selector rather than a
340  /// simple identifier, and the latter two do not have names.
341  // FIXME: Move this down to AnyFunctionCall once checkers have more
342  // precise callbacks.
344  const auto *ND = dyn_cast_or_null<NamedDecl>(getDecl());
345  if (!ND)
346  return nullptr;
347  return ND->getIdentifier();
348  }
349 
350  /// Returns an appropriate ProgramPoint for this call.
351  ProgramPoint getProgramPoint(bool IsPreVisit = false,
352  const ProgramPointTag *Tag = nullptr) const;
353 
354  /// Returns a new state with all argument regions invalidated.
355  ///
356  /// This accepts an alternate state in case some processing has already
357  /// occurred.
358  ProgramStateRef invalidateRegions(unsigned BlockCount,
359  ProgramStateRef Orig = nullptr) const;
360 
361  using FrameBindingTy = std::pair<SVal, SVal>;
363 
364  /// Populates the given SmallVector with the bindings in the callee's stack
365  /// frame at the start of this call.
366  virtual void getInitialStackFrameContents(const StackFrameContext *CalleeCtx,
367  BindingsTy &Bindings) const = 0;
368 
369  /// Returns a copy of this CallEvent, but using the given state.
370  template <typename T>
372 
373  /// Returns a copy of this CallEvent, but using the given state.
375  return cloneWithState<CallEvent>(NewState);
376  }
377 
378  /// Returns true if this is a statement is a function or method call
379  /// of some kind.
380  static bool isCallStmt(const Stmt *S);
381 
382  /// Returns the result type of a function or method declaration.
383  ///
384  /// This will return a null QualType if the result type cannot be determined.
385  static QualType getDeclaredResultType(const Decl *D);
386 
387  /// Returns true if the given decl is known to be variadic.
388  ///
389  /// \p D must not be null.
390  static bool isVariadic(const Decl *D);
391 
392  /// Returns AnalysisDeclContext for the callee stack frame.
393  /// Currently may fail; returns null on failure.
395 
396  /// Returns the callee stack frame. That stack frame will only be entered
397  /// during analysis if the call is inlined, but it may still be useful
398  /// in intermediate calculations even if the call isn't inlined.
399  /// May fail; returns null on failure.
400  const StackFrameContext *getCalleeStackFrame(unsigned BlockCount) const;
401 
402  /// Returns memory location for a parameter variable within the callee stack
403  /// frame. The behavior is undefined if the block count is different from the
404  /// one that is there when call happens. May fail; returns null on failure.
405  const ParamVarRegion *getParameterLocation(unsigned Index,
406  unsigned BlockCount) const;
407 
408  /// Returns true if on the current path, the argument was constructed by
409  /// calling a C++ constructor over it. This is an internal detail of the
410  /// analysis which doesn't necessarily represent the program semantics:
411  /// if we are supposed to construct an argument directly, we may still
412  /// not do that because we don't know how (i.e., construction context is
413  /// unavailable in the CFG or not supported by the analyzer).
414  bool isArgumentConstructedDirectly(unsigned Index) const {
415  // This assumes that the object was not yet removed from the state.
417  getState(), {getOriginExpr(), Index}, getLocationContext())
418  .has_value();
419  }
420 
421  /// Some calls have parameter numbering mismatched from argument numbering.
422  /// This function converts an argument index to the corresponding
423  /// parameter index. Returns None is the argument doesn't correspond
424  /// to any parameter variable.
425  virtual Optional<unsigned>
426  getAdjustedParameterIndex(unsigned ASTArgumentIndex) const {
427  return ASTArgumentIndex;
428  }
429 
430  /// Some call event sub-classes conveniently adjust mismatching AST indices
431  /// to match parameter indices. This function converts an argument index
432  /// as understood by CallEvent to the argument index as understood by the AST.
433  virtual unsigned getASTArgumentIndex(unsigned CallArgumentIndex) const {
434  return CallArgumentIndex;
435  }
436 
437  /// Returns the construction context of the call, if it is a C++ constructor
438  /// call or a call of a function returning a C++ class instance. Otherwise
439  /// return nullptr.
441 
442  /// If the call returns a C++ record type then the region of its return value
443  /// can be retrieved from its construction context.
445 
446  // Iterator access to formal parameters and their types.
447 private:
448  struct GetTypeFn {
449  QualType operator()(ParmVarDecl *PD) const { return PD->getType(); }
450  };
451 
452 public:
453  /// Return call's formal parameters.
454  ///
455  /// Remember that the number of formal parameters may not match the number
456  /// of arguments for all calls. However, the first parameter will always
457  /// correspond with the argument value returned by \c getArgSVal(0).
458  virtual ArrayRef<ParmVarDecl *> parameters() const = 0;
459 
460  using param_type_iterator =
461  llvm::mapped_iterator<ArrayRef<ParmVarDecl *>::iterator, GetTypeFn>;
462 
463  /// Returns an iterator over the types of the call's formal parameters.
464  ///
465  /// This uses the callee decl found by default name lookup rather than the
466  /// definition because it represents a public interface, and probably has
467  /// more annotations.
469  return llvm::map_iterator(parameters().begin(), GetTypeFn());
470  }
471  /// \sa param_type_begin()
473  return llvm::map_iterator(parameters().end(), GetTypeFn());
474  }
475 
476  // For debugging purposes only
477  void dump(raw_ostream &Out) const;
478  void dump() const;
479 };
480 
481 /// Represents a call to any sort of function that might have a
482 /// FunctionDecl.
483 class AnyFunctionCall : public CallEvent {
484 protected:
486  const LocationContext *LCtx)
487  : CallEvent(E, St, LCtx) {}
489  const LocationContext *LCtx)
490  : CallEvent(D, St, LCtx) {}
491  AnyFunctionCall(const AnyFunctionCall &Other) = default;
492 
493 public:
494  // This function is overridden by subclasses, but they must return
495  // a FunctionDecl.
496  const FunctionDecl *getDecl() const override {
497  return cast<FunctionDecl>(CallEvent::getDecl());
498  }
499 
500  RuntimeDefinition getRuntimeDefinition() const override;
501 
502  bool argumentsMayEscape() const override;
503 
504  void getInitialStackFrameContents(const StackFrameContext *CalleeCtx,
505  BindingsTy &Bindings) const override;
506 
507  ArrayRef<ParmVarDecl *> parameters() const override;
508 
509  static bool classof(const CallEvent *CA) {
510  return CA->getKind() >= CE_BEG_FUNCTION_CALLS &&
512  }
513 };
514 
515 /// Represents a C function or static C++ member function call.
516 ///
517 /// Example: \c fun()
519  friend class CallEventManager;
520 
521 protected:
523  const LocationContext *LCtx)
524  : AnyFunctionCall(CE, St, LCtx) {}
525  SimpleFunctionCall(const SimpleFunctionCall &Other) = default;
526 
527  void cloneTo(void *Dest) const override {
528  new (Dest) SimpleFunctionCall(*this);
529  }
530 
531 public:
532  const CallExpr *getOriginExpr() const override {
533  return cast<CallExpr>(AnyFunctionCall::getOriginExpr());
534  }
535 
536  const FunctionDecl *getDecl() const override;
537 
538  unsigned getNumArgs() const override { return getOriginExpr()->getNumArgs(); }
539 
540  const Expr *getArgExpr(unsigned Index) const override {
541  return getOriginExpr()->getArg(Index);
542  }
543 
544  Kind getKind() const override { return CE_Function; }
545  StringRef getKindAsString() const override { return "SimpleFunctionCall"; }
546 
547  static bool classof(const CallEvent *CA) {
548  return CA->getKind() == CE_Function;
549  }
550 };
551 
552 /// Represents a call to a block.
553 ///
554 /// Example: <tt>^{ statement-body }()</tt>
555 class BlockCall : public CallEvent {
556  friend class CallEventManager;
557 
558 protected:
560  const LocationContext *LCtx)
561  : CallEvent(CE, St, LCtx) {}
562  BlockCall(const BlockCall &Other) = default;
563 
564  void cloneTo(void *Dest) const override { new (Dest) BlockCall(*this); }
565 
567  RegionAndSymbolInvalidationTraits *ETraits) const override;
568 
569 public:
570  const CallExpr *getOriginExpr() const override {
571  return cast<CallExpr>(CallEvent::getOriginExpr());
572  }
573 
574  unsigned getNumArgs() const override { return getOriginExpr()->getNumArgs(); }
575 
576  const Expr *getArgExpr(unsigned Index) const override {
577  return getOriginExpr()->getArg(Index);
578  }
579 
580  /// Returns the region associated with this instance of the block.
581  ///
582  /// This may be NULL if the block's origin is unknown.
583  const BlockDataRegion *getBlockRegion() const;
584 
585  const BlockDecl *getDecl() const override {
586  const BlockDataRegion *BR = getBlockRegion();
587  if (!BR)
588  return nullptr;
589  return BR->getDecl();
590  }
591 
592  bool isConversionFromLambda() const {
593  const BlockDecl *BD = getDecl();
594  if (!BD)
595  return false;
596 
597  return BD->isConversionFromLambda();
598  }
599 
600  /// For a block converted from a C++ lambda, returns the block
601  /// VarRegion for the variable holding the captured C++ lambda record.
603  assert(isConversionFromLambda());
604  const BlockDataRegion *BR = getBlockRegion();
605  assert(BR && "Block converted from lambda must have a block region");
606 
607  auto I = BR->referenced_vars_begin();
608  assert(I != BR->referenced_vars_end());
609 
610  return I.getCapturedRegion();
611  }
612 
614  if (!isConversionFromLambda())
615  return RuntimeDefinition(getDecl());
616 
617  // Clang converts lambdas to blocks with an implicit user-defined
618  // conversion operator method on the lambda record that looks (roughly)
619  // like:
620  //
621  // typedef R(^block_type)(P1, P2, ...);
622  // operator block_type() const {
623  // auto Lambda = *this;
624  // return ^(P1 p1, P2 p2, ...){
625  // /* return Lambda(p1, p2, ...); */
626  // };
627  // }
628  //
629  // Here R is the return type of the lambda and P1, P2, ... are
630  // its parameter types. 'Lambda' is a fake VarDecl captured by the block
631  // that is initialized to a copy of the lambda.
632  //
633  // Sema leaves the body of a lambda-converted block empty (it is
634  // produced by CodeGen), so we can't analyze it directly. Instead, we skip
635  // the block body and analyze the operator() method on the captured lambda.
636  const VarDecl *LambdaVD = getRegionStoringCapturedLambda()->getDecl();
637  const CXXRecordDecl *LambdaDecl = LambdaVD->getType()->getAsCXXRecordDecl();
638  CXXMethodDecl* LambdaCallOperator = LambdaDecl->getLambdaCallOperator();
639 
640  return RuntimeDefinition(LambdaCallOperator);
641  }
642 
643  bool argumentsMayEscape() const override {
644  return true;
645  }
646 
647  void getInitialStackFrameContents(const StackFrameContext *CalleeCtx,
648  BindingsTy &Bindings) const override;
649 
650  ArrayRef<ParmVarDecl *> parameters() const override;
651 
652  Kind getKind() const override { return CE_Block; }
653  StringRef getKindAsString() const override { return "BlockCall"; }
654 
655  static bool classof(const CallEvent *CA) { return CA->getKind() == CE_Block; }
656 };
657 
658 /// Represents a non-static C++ member function call, no matter how
659 /// it is written.
661 protected:
663  const LocationContext *LCtx)
664  : AnyFunctionCall(CE, St, LCtx) {}
666  const LocationContext *LCtx)
667  : AnyFunctionCall(D, St, LCtx) {}
668  CXXInstanceCall(const CXXInstanceCall &Other) = default;
669 
671  RegionAndSymbolInvalidationTraits *ETraits) const override;
672 
673 public:
674  /// Returns the expression representing the implicit 'this' object.
675  virtual const Expr *getCXXThisExpr() const { return nullptr; }
676 
677  /// Returns the value of the implicit 'this' object.
678  virtual SVal getCXXThisVal() const;
679 
680  const FunctionDecl *getDecl() const override;
681 
682  RuntimeDefinition getRuntimeDefinition() const override;
683 
684  void getInitialStackFrameContents(const StackFrameContext *CalleeCtx,
685  BindingsTy &Bindings) const override;
686 
687  static bool classof(const CallEvent *CA) {
688  return CA->getKind() >= CE_BEG_CXX_INSTANCE_CALLS &&
690  }
691 };
692 
693 /// Represents a non-static C++ member function call.
694 ///
695 /// Example: \c obj.fun()
697  friend class CallEventManager;
698 
699 protected:
701  const LocationContext *LCtx)
702  : CXXInstanceCall(CE, St, LCtx) {}
703  CXXMemberCall(const CXXMemberCall &Other) = default;
704 
705  void cloneTo(void *Dest) const override { new (Dest) CXXMemberCall(*this); }
706 
707 public:
708  const CXXMemberCallExpr *getOriginExpr() const override {
709  return cast<CXXMemberCallExpr>(CXXInstanceCall::getOriginExpr());
710  }
711 
712  unsigned getNumArgs() const override {
713  if (const CallExpr *CE = getOriginExpr())
714  return CE->getNumArgs();
715  return 0;
716  }
717 
718  const Expr *getArgExpr(unsigned Index) const override {
719  return getOriginExpr()->getArg(Index);
720  }
721 
722  const Expr *getCXXThisExpr() const override;
723 
724  RuntimeDefinition getRuntimeDefinition() const override;
725 
726  Kind getKind() const override { return CE_CXXMember; }
727  StringRef getKindAsString() const override { return "CXXMemberCall"; }
728 
729  static bool classof(const CallEvent *CA) {
730  return CA->getKind() == CE_CXXMember;
731  }
732 };
733 
734 /// Represents a C++ overloaded operator call where the operator is
735 /// implemented as a non-static member function.
736 ///
737 /// Example: <tt>iter + 1</tt>
739  friend class CallEventManager;
740 
741 protected:
743  const LocationContext *LCtx)
744  : CXXInstanceCall(CE, St, LCtx) {}
745  CXXMemberOperatorCall(const CXXMemberOperatorCall &Other) = default;
746 
747  void cloneTo(void *Dest) const override {
748  new (Dest) CXXMemberOperatorCall(*this);
749  }
750 
751 public:
752  const CXXOperatorCallExpr *getOriginExpr() const override {
753  return cast<CXXOperatorCallExpr>(CXXInstanceCall::getOriginExpr());
754  }
755 
756  unsigned getNumArgs() const override {
757  return getOriginExpr()->getNumArgs() - 1;
758  }
759 
760  const Expr *getArgExpr(unsigned Index) const override {
761  return getOriginExpr()->getArg(Index + 1);
762  }
763 
764  const Expr *getCXXThisExpr() const override;
765 
766  Kind getKind() const override { return CE_CXXMemberOperator; }
767  StringRef getKindAsString() const override { return "CXXMemberOperatorCall"; }
768 
769  static bool classof(const CallEvent *CA) {
770  return CA->getKind() == CE_CXXMemberOperator;
771  }
772 
774  getAdjustedParameterIndex(unsigned ASTArgumentIndex) const override {
775  // For member operator calls argument 0 on the expression corresponds
776  // to implicit this-parameter on the declaration.
777  return (ASTArgumentIndex > 0) ? Optional<unsigned>(ASTArgumentIndex - 1)
778  : None;
779  }
780 
781  unsigned getASTArgumentIndex(unsigned CallArgumentIndex) const override {
782  // For member operator calls argument 0 on the expression corresponds
783  // to implicit this-parameter on the declaration.
784  return CallArgumentIndex + 1;
785  }
786 
788  return getOriginExpr()->getOperator();
789  }
790 };
791 
792 /// Represents an implicit call to a C++ destructor.
793 ///
794 /// This can occur at the end of a scope (for automatic objects), at the end
795 /// of a full-expression (for temporaries), or as part of a delete.
797  friend class CallEventManager;
798 
799 protected:
800  using DtorDataTy = llvm::PointerIntPair<const MemRegion *, 1, bool>;
801 
802  /// Creates an implicit destructor.
803  ///
804  /// \param DD The destructor that will be called.
805  /// \param Trigger The statement whose completion causes this destructor call.
806  /// \param Target The object region to be destructed.
807  /// \param St The path-sensitive state at this point in the program.
808  /// \param LCtx The location context at this point in the program.
809  CXXDestructorCall(const CXXDestructorDecl *DD, const Stmt *Trigger,
810  const MemRegion *Target, bool IsBaseDestructor,
811  ProgramStateRef St, const LocationContext *LCtx)
812  : CXXInstanceCall(DD, St, LCtx) {
813  Data = DtorDataTy(Target, IsBaseDestructor).getOpaqueValue();
814  Location = Trigger->getEndLoc();
815  }
816 
817  CXXDestructorCall(const CXXDestructorCall &Other) = default;
818 
819  void cloneTo(void *Dest) const override {new (Dest) CXXDestructorCall(*this);}
820 
821 public:
822  SourceRange getSourceRange() const override { return Location; }
823  unsigned getNumArgs() const override { return 0; }
824 
825  RuntimeDefinition getRuntimeDefinition() const override;
826 
827  /// Returns the value of the implicit 'this' object.
828  SVal getCXXThisVal() const override;
829 
830  /// Returns true if this is a call to a base class destructor.
831  bool isBaseDestructor() const {
832  return DtorDataTy::getFromOpaqueValue(Data).getInt();
833  }
834 
835  Kind getKind() const override { return CE_CXXDestructor; }
836  StringRef getKindAsString() const override { return "CXXDestructorCall"; }
837 
838  static bool classof(const CallEvent *CA) {
839  return CA->getKind() == CE_CXXDestructor;
840  }
841 };
842 
843 /// Represents any constructor invocation. This includes regular constructors
844 /// and inherited constructors.
846 protected:
847  AnyCXXConstructorCall(const Expr *E, const MemRegion *Target,
848  ProgramStateRef St, const LocationContext *LCtx)
849  : AnyFunctionCall(E, St, LCtx) {
850  assert(E && (isa<CXXConstructExpr>(E) || isa<CXXInheritedCtorInitExpr>(E)));
851  // Target may be null when the region is unknown.
852  Data = Target;
853  }
854 
856  RegionAndSymbolInvalidationTraits *ETraits) const override;
857 
858  void getInitialStackFrameContents(const StackFrameContext *CalleeCtx,
859  BindingsTy &Bindings) const override;
860 
861 public:
862  /// Returns the value of the implicit 'this' object.
863  SVal getCXXThisVal() const;
864 
865  static bool classof(const CallEvent *Call) {
866  return Call->getKind() >= CE_BEG_CXX_CONSTRUCTOR_CALLS &&
867  Call->getKind() <= CE_END_CXX_CONSTRUCTOR_CALLS;
868  }
869 };
870 
871 /// Represents a call to a C++ constructor.
872 ///
873 /// Example: \c T(1)
875  friend class CallEventManager;
876 
877 protected:
878  /// Creates a constructor call.
879  ///
880  /// \param CE The constructor expression as written in the source.
881  /// \param Target The region where the object should be constructed. If NULL,
882  /// a new symbolic region will be used.
883  /// \param St The path-sensitive state at this point in the program.
884  /// \param LCtx The location context at this point in the program.
886  ProgramStateRef St, const LocationContext *LCtx)
887  : AnyCXXConstructorCall(CE, Target, St, LCtx) {}
888 
889  CXXConstructorCall(const CXXConstructorCall &Other) = default;
890 
891  void cloneTo(void *Dest) const override { new (Dest) CXXConstructorCall(*this); }
892 
893 public:
894  const CXXConstructExpr *getOriginExpr() const override {
895  return cast<CXXConstructExpr>(AnyFunctionCall::getOriginExpr());
896  }
897 
898  const CXXConstructorDecl *getDecl() const override {
899  return getOriginExpr()->getConstructor();
900  }
901 
902  unsigned getNumArgs() const override { return getOriginExpr()->getNumArgs(); }
903 
904  const Expr *getArgExpr(unsigned Index) const override {
905  return getOriginExpr()->getArg(Index);
906  }
907 
908  Kind getKind() const override { return CE_CXXConstructor; }
909  StringRef getKindAsString() const override { return "CXXConstructorCall"; }
910 
911  static bool classof(const CallEvent *CA) {
912  return CA->getKind() == CE_CXXConstructor;
913  }
914 };
915 
916 /// Represents a call to a C++ inherited constructor.
917 ///
918 /// Example: \c class T : public S { using S::S; }; T(1);
919 ///
920 // Note, it is difficult to model the parameters. This is one of the reasons
921 // why we skip analysis of inheriting constructors as top-level functions.
922 // CXXInheritedCtorInitExpr doesn't take arguments and doesn't model parameter
923 // initialization because there is none: the arguments in the outer
924 // CXXConstructExpr directly initialize the parameters of the base class
925 // constructor, and no copies are made. (Making a copy of the parameter is
926 // incorrect, at least if it's done in an observable way.) The derived class
927 // constructor doesn't even exist in the formal model.
928 /// E.g., in:
929 ///
930 /// struct X { X *p = this; ~X() {} };
931 /// struct A { A(X x) : b(x.p == &x) {} bool b; };
932 /// struct B : A { using A::A; };
933 /// B b = X{};
934 ///
935 /// ... b.b is initialized to true.
937  friend class CallEventManager;
938 
939 protected:
941  const MemRegion *Target, ProgramStateRef St,
942  const LocationContext *LCtx)
943  : AnyCXXConstructorCall(CE, Target, St, LCtx) {}
944 
946  default;
947 
948  void cloneTo(void *Dest) const override {
949  new (Dest) CXXInheritedConstructorCall(*this);
950  }
951 
952 public:
953  const CXXInheritedCtorInitExpr *getOriginExpr() const override {
954  return cast<CXXInheritedCtorInitExpr>(AnyFunctionCall::getOriginExpr());
955  }
956 
957  const CXXConstructorDecl *getDecl() const override {
958  return getOriginExpr()->getConstructor();
959  }
960 
961  /// Obtain the stack frame of the inheriting constructor. Argument expressions
962  /// can be found on the call site of that stack frame.
964 
965  /// Obtain the CXXConstructExpr for the sub-class that inherited the current
966  /// constructor (possibly indirectly). It's the statement that contains
967  /// argument expressions.
969  return cast<CXXConstructExpr>(getInheritingStackFrame()->getCallSite());
970  }
971 
972  unsigned getNumArgs() const override {
974  }
975 
976  const Expr *getArgExpr(unsigned Index) const override {
977  return getInheritingConstructor()->getArg(Index);
978  }
979 
980  SVal getArgSVal(unsigned Index) const override {
981  return getState()->getSVal(
982  getArgExpr(Index),
983  getInheritingStackFrame()->getParent()->getStackFrame());
984  }
985 
986  Kind getKind() const override { return CE_CXXInheritedConstructor; }
987  StringRef getKindAsString() const override {
988  return "CXXInheritedConstructorCall";
989  }
990 
991  static bool classof(const CallEvent *CA) {
992  return CA->getKind() == CE_CXXInheritedConstructor;
993  }
994 };
995 
996 /// Represents the memory allocation call in a C++ new-expression.
997 ///
998 /// This is a call to "operator new".
1000  friend class CallEventManager;
1001 
1002 protected:
1004  const LocationContext *LCtx)
1005  : AnyFunctionCall(E, St, LCtx) {}
1006  CXXAllocatorCall(const CXXAllocatorCall &Other) = default;
1007 
1008  void cloneTo(void *Dest) const override { new (Dest) CXXAllocatorCall(*this); }
1009 
1010 public:
1011  const CXXNewExpr *getOriginExpr() const override {
1012  return cast<CXXNewExpr>(AnyFunctionCall::getOriginExpr());
1013  }
1014 
1015  const FunctionDecl *getDecl() const override {
1016  return getOriginExpr()->getOperatorNew();
1017  }
1018 
1022  .value();
1023  }
1024 
1025  /// Number of non-placement arguments to the call. It is equal to 2 for
1026  /// C++17 aligned operator new() calls that have alignment implicitly
1027  /// passed as the second argument, and to 1 for other operator new() calls.
1028  unsigned getNumImplicitArgs() const {
1029  return getOriginExpr()->passAlignment() ? 2 : 1;
1030  }
1031 
1032  unsigned getNumArgs() const override {
1034  }
1035 
1036  bool isArray() const { return getOriginExpr()->isArray(); }
1037 
1039  return getOriginExpr()->getArraySize();
1040  }
1041 
1043  assert(isArray() && "The allocator call doesn't allocate and array!");
1044 
1045  return getState()->getSVal(*getArraySizeExpr(), getLocationContext());
1046  }
1047 
1048  const Expr *getArgExpr(unsigned Index) const override {
1049  // The first argument of an allocator call is the size of the allocation.
1050  if (Index < getNumImplicitArgs())
1051  return nullptr;
1052  return getOriginExpr()->getPlacementArg(Index - getNumImplicitArgs());
1053  }
1054 
1055  /// Number of placement arguments to the operator new() call. For example,
1056  /// standard std::nothrow operator new and standard placement new both have
1057  /// 1 implicit argument (size) and 1 placement argument, while regular
1058  /// operator new() has 1 implicit argument and 0 placement arguments.
1059  const Expr *getPlacementArgExpr(unsigned Index) const {
1060  return getOriginExpr()->getPlacementArg(Index);
1061  }
1062 
1063  Kind getKind() const override { return CE_CXXAllocator; }
1064  StringRef getKindAsString() const override { return "CXXAllocatorCall"; }
1065 
1066  static bool classof(const CallEvent *CE) {
1067  return CE->getKind() == CE_CXXAllocator;
1068  }
1069 };
1070 
1071 /// Represents the memory deallocation call in a C++ delete-expression.
1072 ///
1073 /// This is a call to "operator delete".
1074 // FIXME: CXXDeleteExpr isn't present for custom delete operators, or even for
1075 // some those that are in the standard library, like the no-throw or align_val
1076 // versions.
1077 // Some pointers:
1078 // http://lists.llvm.org/pipermail/cfe-dev/2020-April/065080.html
1079 // clang/test/Analysis/cxx-dynamic-memory-analysis-order.cpp
1080 // clang/unittests/StaticAnalyzer/CallEventTest.cpp
1082  friend class CallEventManager;
1083 
1084 protected:
1086  const LocationContext *LCtx)
1087  : AnyFunctionCall(E, St, LCtx) {}
1088  CXXDeallocatorCall(const CXXDeallocatorCall &Other) = default;
1089 
1090  void cloneTo(void *Dest) const override {
1091  new (Dest) CXXDeallocatorCall(*this);
1092  }
1093 
1094 public:
1095  const CXXDeleteExpr *getOriginExpr() const override {
1096  return cast<CXXDeleteExpr>(AnyFunctionCall::getOriginExpr());
1097  }
1098 
1099  const FunctionDecl *getDecl() const override {
1100  return getOriginExpr()->getOperatorDelete();
1101  }
1102 
1103  unsigned getNumArgs() const override { return getDecl()->getNumParams(); }
1104 
1105  const Expr *getArgExpr(unsigned Index) const override {
1106  // CXXDeleteExpr's only have a single argument.
1107  return getOriginExpr()->getArgument();
1108  }
1109 
1110  Kind getKind() const override { return CE_CXXDeallocator; }
1111  StringRef getKindAsString() const override { return "CXXDeallocatorCall"; }
1112 
1113  static bool classof(const CallEvent *CE) {
1114  return CE->getKind() == CE_CXXDeallocator;
1115  }
1116 };
1117 
1118 /// Represents the ways an Objective-C message send can occur.
1119 //
1120 // Note to maintainers: OCM_Message should always be last, since it does not
1121 // need to fit in the Data field's low bits.
1126 };
1127 
1128 /// Represents any expression that calls an Objective-C method.
1129 ///
1130 /// This includes all of the kinds listed in ObjCMessageKind.
1131 class ObjCMethodCall : public CallEvent {
1132  friend class CallEventManager;
1133 
1134  const PseudoObjectExpr *getContainingPseudoObjectExpr() const;
1135 
1136 protected:
1138  const LocationContext *LCtx)
1139  : CallEvent(Msg, St, LCtx) {
1140  Data = nullptr;
1141  }
1142 
1143  ObjCMethodCall(const ObjCMethodCall &Other) = default;
1144 
1145  void cloneTo(void *Dest) const override { new (Dest) ObjCMethodCall(*this); }
1146 
1147  void getExtraInvalidatedValues(ValueList &Values,
1148  RegionAndSymbolInvalidationTraits *ETraits) const override;
1149 
1150  /// Check if the selector may have multiple definitions (may have overrides).
1151  virtual bool canBeOverridenInSubclass(ObjCInterfaceDecl *IDecl,
1152  Selector Sel) const;
1153 
1154 public:
1155  const ObjCMessageExpr *getOriginExpr() const override {
1156  return cast<ObjCMessageExpr>(CallEvent::getOriginExpr());
1157  }
1158 
1159  const ObjCMethodDecl *getDecl() const override {
1160  return getOriginExpr()->getMethodDecl();
1161  }
1162 
1163  unsigned getNumArgs() const override {
1164  return getOriginExpr()->getNumArgs();
1165  }
1166 
1167  const Expr *getArgExpr(unsigned Index) const override {
1168  return getOriginExpr()->getArg(Index);
1169  }
1170 
1171  bool isInstanceMessage() const {
1172  return getOriginExpr()->isInstanceMessage();
1173  }
1174 
1176  return getOriginExpr()->getMethodFamily();
1177  }
1178 
1180  return getOriginExpr()->getSelector();
1181  }
1182 
1183  SourceRange getSourceRange() const override;
1184 
1185  /// Returns the value of the receiver at the time of this call.
1186  SVal getReceiverSVal() const;
1187 
1188  /// Get the interface for the receiver.
1189  ///
1190  /// This works whether this is an instance message or a class message.
1191  /// However, it currently just uses the static type of the receiver.
1193  return getOriginExpr()->getReceiverInterface();
1194  }
1195 
1196  /// Checks if the receiver refers to 'self' or 'super'.
1197  bool isReceiverSelfOrSuper() const;
1198 
1199  /// Returns how the message was written in the source (property access,
1200  /// subscript, or explicit message send).
1202 
1203  /// Returns true if this property access or subscript is a setter (has the
1204  /// form of an assignment).
1205  bool isSetter() const {
1206  switch (getMessageKind()) {
1207  case OCM_Message:
1208  llvm_unreachable("This is not a pseudo-object access!");
1209  case OCM_PropertyAccess:
1210  return getNumArgs() > 0;
1211  case OCM_Subscript:
1212  return getNumArgs() > 1;
1213  }
1214  llvm_unreachable("Unknown message kind");
1215  }
1216 
1217  // Returns the property accessed by this method, either explicitly via
1218  // property syntax or implicitly via a getter or setter method. Returns
1219  // nullptr if the call is not a prooperty access.
1220  const ObjCPropertyDecl *getAccessedProperty() const;
1221 
1222  RuntimeDefinition getRuntimeDefinition() const override;
1223 
1224  bool argumentsMayEscape() const override;
1225 
1226  void getInitialStackFrameContents(const StackFrameContext *CalleeCtx,
1227  BindingsTy &Bindings) const override;
1228 
1229  ArrayRef<ParmVarDecl*> parameters() const override;
1230 
1231  Kind getKind() const override { return CE_ObjCMessage; }
1232  StringRef getKindAsString() const override { return "ObjCMethodCall"; }
1233 
1234  static bool classof(const CallEvent *CA) {
1235  return CA->getKind() == CE_ObjCMessage;
1236  }
1237 };
1238 
1239 /// Manages the lifetime of CallEvent objects.
1240 ///
1241 /// CallEventManager provides a way to create arbitrary CallEvents "on the
1242 /// stack" as if they were value objects by keeping a cache of CallEvent-sized
1243 /// memory blocks. The CallEvents created by CallEventManager are only valid
1244 /// for the lifetime of the OwnedCallEvent that holds them; right now these
1245 /// objects cannot be copied and ownership cannot be transferred.
1247  friend class CallEvent;
1248 
1249  llvm::BumpPtrAllocator &Alloc;
1251 
1253 
1254  void reclaim(const void *Memory) {
1255  Cache.push_back(const_cast<void *>(Memory));
1256  }
1257 
1258  /// Returns memory that can be initialized as a CallEvent.
1259  void *allocate() {
1260  if (Cache.empty())
1261  return Alloc.Allocate<CallEventTemplateTy>();
1262  else
1263  return Cache.pop_back_val();
1264  }
1265 
1266  template <typename T, typename Arg>
1267  T *create(Arg A, ProgramStateRef St, const LocationContext *LCtx) {
1268  static_assert(sizeof(T) == sizeof(CallEventTemplateTy),
1269  "CallEvent subclasses are not all the same size");
1270  return new (allocate()) T(A, St, LCtx);
1271  }
1272 
1273  template <typename T, typename Arg1, typename Arg2>
1274  T *create(Arg1 A1, Arg2 A2, ProgramStateRef St, const LocationContext *LCtx) {
1275  static_assert(sizeof(T) == sizeof(CallEventTemplateTy),
1276  "CallEvent subclasses are not all the same size");
1277  return new (allocate()) T(A1, A2, St, LCtx);
1278  }
1279 
1280  template <typename T, typename Arg1, typename Arg2, typename Arg3>
1281  T *create(Arg1 A1, Arg2 A2, Arg3 A3, ProgramStateRef St,
1282  const LocationContext *LCtx) {
1283  static_assert(sizeof(T) == sizeof(CallEventTemplateTy),
1284  "CallEvent subclasses are not all the same size");
1285  return new (allocate()) T(A1, A2, A3, St, LCtx);
1286  }
1287 
1288  template <typename T, typename Arg1, typename Arg2, typename Arg3,
1289  typename Arg4>
1290  T *create(Arg1 A1, Arg2 A2, Arg3 A3, Arg4 A4, ProgramStateRef St,
1291  const LocationContext *LCtx) {
1292  static_assert(sizeof(T) == sizeof(CallEventTemplateTy),
1293  "CallEvent subclasses are not all the same size");
1294  return new (allocate()) T(A1, A2, A3, A4, St, LCtx);
1295  }
1296 
1297 public:
1298  CallEventManager(llvm::BumpPtrAllocator &alloc) : Alloc(alloc) {}
1299 
1300  /// Gets an outside caller given a callee context.
1302  getCaller(const StackFrameContext *CalleeCtx, ProgramStateRef State);
1303 
1304  /// Gets a call event for a function call, Objective-C method call,
1305  /// a 'new', or a 'delete' call.
1307  getCall(const Stmt *S, ProgramStateRef State,
1308  const LocationContext *LC);
1309 
1312  const LocationContext *LCtx);
1313 
1316  const LocationContext *LCtx) {
1317  return create<ObjCMethodCall>(E, State, LCtx);
1318  }
1319 
1322  ProgramStateRef State, const LocationContext *LCtx) {
1323  return create<CXXConstructorCall>(E, Target, State, LCtx);
1324  }
1325 
1328  const MemRegion *Target, ProgramStateRef State,
1329  const LocationContext *LCtx) {
1330  return create<CXXInheritedConstructorCall>(E, Target, State, LCtx);
1331  }
1332 
1334  getCXXDestructorCall(const CXXDestructorDecl *DD, const Stmt *Trigger,
1335  const MemRegion *Target, bool IsBase,
1336  ProgramStateRef State, const LocationContext *LCtx) {
1337  return create<CXXDestructorCall>(DD, Trigger, Target, IsBase, State, LCtx);
1338  }
1339 
1342  const LocationContext *LCtx) {
1343  return create<CXXAllocatorCall>(E, State, LCtx);
1344  }
1345 
1348  const LocationContext *LCtx) {
1349  return create<CXXDeallocatorCall>(E, State, LCtx);
1350  }
1351 };
1352 
1353 template <typename T>
1355  assert(isa<T>(*this) && "Cloning to unrelated type");
1356  static_assert(sizeof(T) == sizeof(CallEvent),
1357  "Subclasses may not add fields");
1358 
1359  if (NewState == State)
1360  return cast<T>(this);
1361 
1362  CallEventManager &Mgr = State->getStateManager().getCallEventManager();
1363  T *Copy = static_cast<T *>(Mgr.allocate());
1364  cloneTo(Copy);
1365  assert(Copy->getKind() == this->getKind() && "Bad copy");
1366 
1367  Copy->State = NewState;
1368  return Copy;
1369 }
1370 
1371 inline void CallEvent::Release() const {
1372  assert(RefCount > 0 && "Reference count is already zero.");
1373  --RefCount;
1374 
1375  if (RefCount > 0)
1376  return;
1377 
1378  CallEventManager &Mgr = State->getStateManager().getCallEventManager();
1379  Mgr.reclaim(this);
1380 
1381  this->~CallEvent();
1382 }
1383 
1384 } // namespace ento
1385 
1386 } // namespace clang
1387 
1388 namespace llvm {
1389 
1390 // Support isa<>, cast<>, and dyn_cast<> for CallEventRef.
1391 template<class T> struct simplify_type< clang::ento::CallEventRef<T>> {
1392  using SimpleType = const T *;
1393 
1394  static SimpleType
1396  return Val.get();
1397  }
1398 };
1399 
1400 } // namespace llvm
1401 
1402 #endif // LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_CALLEVENT_H
clang::ento::CXXMemberOperatorCall::getArgExpr
const Expr * getArgExpr(unsigned Index) const override
Returns the expression associated with a given argument.
Definition: CallEvent.h:760
clang::ento::CE_Function
@ CE_Function
Definition: CallEvent.h:60
clang::ento::BlockCall::BlockCall
BlockCall(const CallExpr *CE, ProgramStateRef St, const LocationContext *LCtx)
Definition: CallEvent.h:559
clang::ento::AnyCXXConstructorCall::getExtraInvalidatedValues
void getExtraInvalidatedValues(ValueList &Values, RegionAndSymbolInvalidationTraits *ETraits) const override
Used to specify non-argument regions that will be invalidated as a result of this call.
Definition: CallEvent.cpp:900
clang::ento::CXXDeallocatorCall::getKind
Kind getKind() const override
Returns the kind of call this is.
Definition: CallEvent.h:1110
clang::ObjCInterfaceDecl
Represents an ObjC class declaration.
Definition: DeclObjC.h:1149
clang::CXXNewExpr::passAlignment
bool passAlignment() const
Indicates whether the required alignment should be implicitly passed to the allocation function.
Definition: ExprCXX.h:2356
clang::ento::ObjCMethodCall::getNumArgs
unsigned getNumArgs() const override
Returns the number of arguments (explicit and implicit).
Definition: CallEvent.h:1163
clang::ento::CXXDeallocatorCall::getOriginExpr
const CXXDeleteExpr * getOriginExpr() const override
Returns the expression whose value will be the result of this call.
Definition: CallEvent.h:1095
clang::ento::CXXConstructorCall::getKindAsString
StringRef getKindAsString() const override
Definition: CallEvent.h:909
clang::ObjCMessageExpr::isInstanceMessage
bool isInstanceMessage() const
Determine whether this is an instance message to either a computed object or to super.
Definition: ExprObjC.h:1238
clang::ento::RuntimeDefinition::RuntimeDefinition
RuntimeDefinition(const Decl *InD)
Definition: CallEvent.h:122
clang::ObjCMessageExpr::getReceiverInterface
ObjCInterfaceDecl * getReceiverInterface() const
Retrieve the Objective-C interface to which this message is being directed, if known.
Definition: ExprObjC.cpp:314
clang::ento::BlockCall::parameters
ArrayRef< ParmVarDecl * > parameters() const override
Return call's formal parameters.
Definition: CallEvent.cpp:857
clang::ento::CXXAllocatorCall::getKindAsString
StringRef getKindAsString() const override
Definition: CallEvent.h:1064
clang::ento::CXXInheritedConstructorCall::getNumArgs
unsigned getNumArgs() const override
Returns the number of arguments (explicit and implicit).
Definition: CallEvent.h:972
clang::ento::RuntimeDefinition::mayHaveOtherDefinitions
bool mayHaveOtherDefinitions()
Check if the definition we have is precise.
Definition: CallEvent.h:132
clang::ento::ObjCMethodCall::getMessageKind
ObjCMessageKind getMessageKind() const
Returns how the message was written in the source (property access, subscript, or explicit message se...
Definition: CallEvent.cpp:1039
clang::ento::AnyFunctionCall
Represents a call to any sort of function that might have a FunctionDecl.
Definition: CallEvent.h:483
llvm
YAML serialization mapping.
Definition: Dominators.h:30
clang::CXXConstructorDecl
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2436
clang::ento::CallEventManager::getCall
CallEventRef getCall(const Stmt *S, ProgramStateRef State, const LocationContext *LC)
Gets a call event for a function call, Objective-C method call, a 'new', or a 'delete' call.
Definition: CallEvent.cpp:1451
clang::ento::CXXMemberCall::getOriginExpr
const CXXMemberCallExpr * getOriginExpr() const override
Returns the expression whose value will be the result of this call.
Definition: CallEvent.h:708
clang::ento::CXXDestructorCall::CXXDestructorCall
CXXDestructorCall(const CXXDestructorDecl *DD, const Stmt *Trigger, const MemRegion *Target, bool IsBaseDestructor, ProgramStateRef St, const LocationContext *LCtx)
Creates an implicit destructor.
Definition: CallEvent.h:809
clang::FunctionDecl::getNumParams
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
Definition: Decl.cpp:3466
clang::ento::ObjCMethodCall::getOriginExpr
const ObjCMessageExpr * getOriginExpr() const override
Returns the expression whose value will be the result of this call.
Definition: CallEvent.h:1155
clang::ento::CallEvent::isArgumentConstructedDirectly
bool isArgumentConstructedDirectly(unsigned Index) const
Returns true if on the current path, the argument was constructed by calling a C++ constructor over i...
Definition: CallEvent.h:414
clang::ento::RuntimeDefinition::getDecl
const Decl * getDecl()
Definition: CallEvent.h:126
clang::ento::CallEventRef
Definition: CallEvent.h:81
clang::ento::AnyCXXConstructorCall::getInitialStackFrameContents
void getInitialStackFrameContents(const StackFrameContext *CalleeCtx, BindingsTy &Bindings) const override
Populates the given SmallVector with the bindings in the callee's stack frame at the start of this ca...
Definition: CallEvent.cpp:909
clang::LocationContext
It wraps the AnalysisDeclContext to represent both the call stack with the help of StackFrameContext ...
Definition: AnalysisDeclContext.h:215
clang::ento::OCM_Subscript
@ OCM_Subscript
Definition: CallEvent.h:1124
clang::ento::CallEventManager::getCXXDestructorCall
CallEventRef< CXXDestructorCall > getCXXDestructorCall(const CXXDestructorDecl *DD, const Stmt *Trigger, const MemRegion *Target, bool IsBase, ProgramStateRef State, const LocationContext *LCtx)
Definition: CallEvent.h:1334
SVals.h
clang::ento::CXXConstructorCall::getNumArgs
unsigned getNumArgs() const override
Returns the number of arguments (explicit and implicit).
Definition: CallEvent.h:902
clang::SourceRange
A trivial tuple used to represent a source range.
Definition: SourceLocation.h:210
clang::ObjCMethodFamily
ObjCMethodFamily
A family of Objective-C methods.
Definition: IdentifierTable.h:697
clang::ento::BlockCall::getExtraInvalidatedValues
void getExtraInvalidatedValues(ValueList &Values, RegionAndSymbolInvalidationTraits *ETraits) const override
Used to specify non-argument regions that will be invalidated as a result of this call.
Definition: CallEvent.cpp:864
clang::ento::CXXConstructorCall::getKind
Kind getKind() const override
Returns the kind of call this is.
Definition: CallEvent.h:908
clang::ento::RuntimeDefinition::RuntimeDefinition
RuntimeDefinition(const Decl *InD, bool Foreign)
Definition: CallEvent.h:123
clang::ento::CXXInheritedConstructorCall::getArgExpr
const Expr * getArgExpr(unsigned Index) const override
Returns the expression associated with a given argument.
Definition: CallEvent.h:976
clang::ento::CXXDestructorCall::cloneTo
void cloneTo(void *Dest) const override
Copies this CallEvent, with vtable intact, into a new block of memory.
Definition: CallEvent.h:819
clang::ento::CXXMemberCall::getKindAsString
StringRef getKindAsString() const override
Definition: CallEvent.h:727
clang::CXXConstructExpr::getNumArgs
unsigned getNumArgs() const
Return the number of arguments to the constructor call.
Definition: ExprCXX.h:1615
clang::ento::CallEvent::~CallEvent
virtual ~CallEvent()=default
clang::ento::CXXInheritedConstructorCall::classof
static bool classof(const CallEvent *CA)
Definition: CallEvent.h:991
clang::ObjCMessageExpr::getSelector
Selector getSelector() const
Definition: ExprObjC.cpp:293
clang::ProgramPointTag
ProgramPoints can be "tagged" as representing points specific to a given analysis entity.
Definition: ProgramPoint.h:38
clang::ento::BlockDataRegion::referenced_vars_begin
referenced_vars_iterator referenced_vars_begin() const
Definition: MemRegion.cpp:1687
clang::ento::CallEvent::getOriginExpr
virtual const Expr * getOriginExpr() const
Returns the expression whose value will be the result of this call.
Definition: CallEvent.h:240
llvm::SmallVector
Definition: LLVM.h:38
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:86
clang::ento::CallEventManager::getCXXDeallocatorCall
CallEventRef< CXXDeallocatorCall > getCXXDeallocatorCall(const CXXDeleteExpr *E, ProgramStateRef State, const LocationContext *LCtx)
Definition: CallEvent.h:1347
clang::ento::AnyFunctionCall::getRuntimeDefinition
RuntimeDefinition getRuntimeDefinition() const override
Returns the definition of the function or method that will be called.
Definition: CallEvent.cpp:539
clang::ento::CXXDeallocatorCall::getKindAsString
StringRef getKindAsString() const override
Definition: CallEvent.h:1111
clang::CXXNewExpr::getNumPlacementArgs
unsigned getNumPlacementArgs() const
Definition: ExprCXX.h:2299
clang::MultiVersionKind::Target
@ Target
clang::CXXNewExpr::getOperatorNew
FunctionDecl * getOperatorNew() const
Definition: ExprCXX.h:2264
clang::ento::CXXDestructorCall::classof
static bool classof(const CallEvent *CA)
Definition: CallEvent.h:838
clang::Stmt::getSourceRange
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
Definition: Stmt.cpp:324
clang::ento::ProgramStateRef
IntrusiveRefCntPtr< const ProgramState > ProgramStateRef
Definition: ProgramState_Fwd.h:37
clang::ento::CXXDeallocatorCall::getNumArgs
unsigned getNumArgs() const override
Returns the number of arguments (explicit and implicit).
Definition: CallEvent.h:1103
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:737
clang::ConstructionContext
ConstructionContext's subclasses describe different ways of constructing an object in C++.
Definition: ConstructionContext.h:243
clang::ento::BlockCall::getArgExpr
const Expr * getArgExpr(unsigned Index) const override
Returns the expression associated with a given argument.
Definition: CallEvent.h:576
clang::ento::CXXMemberCall::getNumArgs
unsigned getNumArgs() const override
Returns the number of arguments (explicit and implicit).
Definition: CallEvent.h:712
clang::ento::CallEventManager::getObjCMethodCall
CallEventRef< ObjCMethodCall > getObjCMethodCall(const ObjCMessageExpr *E, ProgramStateRef State, const LocationContext *LCtx)
Definition: CallEvent.h:1315
clang::CXXNewExpr::isArray
bool isArray() const
Definition: ExprCXX.h:2269
clang::ento::CXXInstanceCall::CXXInstanceCall
CXXInstanceCall(const CallExpr *CE, ProgramStateRef St, const LocationContext *LCtx)
Definition: CallEvent.h:662
clang::ento::CXXDestructorCall::DtorDataTy
llvm::PointerIntPair< const MemRegion *, 1, bool > DtorDataTy
Definition: CallEvent.h:800
clang::ento::CE_BEG_CXX_CONSTRUCTOR_CALLS
@ CE_BEG_CXX_CONSTRUCTOR_CALLS
Definition: CallEvent.h:68
clang::AnalysisDeclContext
AnalysisDeclContext contains the context data for the function, method or block under analysis.
Definition: AnalysisDeclContext.h:72
clang::ento::AnyFunctionCall::AnyFunctionCall
AnyFunctionCall(const Expr *E, ProgramStateRef St, const LocationContext *LCtx)
Definition: CallEvent.h:485
clang::ento::CE_CXXDeallocator
@ CE_CXXDeallocator
Definition: CallEvent.h:71
clang::CXXInheritedCtorInitExpr::getConstructor
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will call.
Definition: ExprCXX.h:1693
clang::ento::ObjCMethodCall::getReceiverSVal
SVal getReceiverSVal() const
Returns the value of the receiver at the time of this call.
Definition: CallEvent.cpp:978
clang::ParmVarDecl
Represents a parameter to a function.
Definition: Decl.h:1712
clang::ento::CallEvent::hasVoidPointerToNonConstArg
bool hasVoidPointerToNonConstArg() const
Returns true if any of the arguments is void*.
Definition: CallEvent.cpp:141
DeclCXX.h
ProgramState_Fwd.h
clang::ento::ObjCMethodCall::ObjCMethodCall
ObjCMethodCall(const ObjCMessageExpr *Msg, ProgramStateRef St, const LocationContext *LCtx)
Definition: CallEvent.h:1137
clang::CXXNewExpr
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
Definition: ExprCXX.h:2146
llvm::Optional< bool >
clang::ento::CallEventRef::CallEventRef
CallEventRef(const CallEventRef &Orig)
Definition: CallEvent.h:84
clang::ento::CXXAllocatorCall::getArraySizeExpr
Optional< const clang::Expr * > getArraySizeExpr() const
Definition: CallEvent.h:1038
clang::ento::CallEvent::param_type_end
param_type_iterator param_type_end() const
Definition: CallEvent.h:472
clang::ento::CallEvent::getConstructionContext
const ConstructionContext * getConstructionContext() const
Returns the construction context of the call, if it is a C++ constructor call or a call of a function...
Definition: CallEvent.cpp:501
clang::StackFrameContext
It represents a stack frame of the call stack (based on CallEvent).
Definition: AnalysisDeclContext.h:299
SourceManager.h
clang::ento::CXXAllocatorCall::isArray
bool isArray() const
Definition: CallEvent.h:1036
clang::ento::CallEvent::isGlobalCFunction
bool isGlobalCFunction(StringRef SpecificName=StringRef()) const
Returns true if the callee is an externally-visible function in the top-level namespace,...
Definition: CallEvent.cpp:145
clang::ento::BlockCall::cloneTo
void cloneTo(void *Dest) const override
Copies this CallEvent, with vtable intact, into a new block of memory.
Definition: CallEvent.h:564
clang::ento::CXXDestructorCall::getKind
Kind getKind() const override
Returns the kind of call this is.
Definition: CallEvent.h:835
clang::ento::ObjCMethodCall::getAccessedProperty
const ObjCPropertyDecl * getAccessedProperty() const
Definition: CallEvent.cpp:1083
clang::ento::CXXInheritedConstructorCall::getArgSVal
SVal getArgSVal(unsigned Index) const override
Returns the value of a given argument at the time of the call.
Definition: CallEvent.h:980
clang::ento::CXXAllocatorCall::getDecl
const FunctionDecl * getDecl() const override
Returns the declaration of the function or method that will be called.
Definition: CallEvent.h:1015
clang::ento::AnyCXXConstructorCall::AnyCXXConstructorCall
AnyCXXConstructorCall(const Expr *E, const MemRegion *Target, ProgramStateRef St, const LocationContext *LCtx)
Definition: CallEvent.h:847
clang::ento::CallEvent::getDeclaredResultType
static QualType getDeclaredResultType(const Decl *D)
Returns the result type of a function or method declaration.
Definition: CallEvent.cpp:349
clang::ento::CallEvent::getReturnValueUnderConstruction
Optional< SVal > getReturnValueUnderConstruction() const
If the call returns a C++ record type then the region of its return value can be retrieved from its c...
Definition: CallEvent.cpp:519
clang::ento::CallEvent::isCallStmt
static bool isCallStmt(const Stmt *S)
Returns true if this is a statement is a function or method call of some kind.
Definition: CallEvent.cpp:345
clang::ento::CallEvent::argumentsMayEscape
virtual bool argumentsMayEscape() const
Returns true if any of the arguments are known to escape to long- term storage, even if this method w...
Definition: CallEvent.h:314
llvm::simplify_type< clang::ento::CallEventRef< T > >::SimpleType
const T * SimpleType
Definition: CallEvent.h:1392
clang::ento::CE_CXXInheritedConstructor
@ CE_CXXInheritedConstructor
Definition: CallEvent.h:67
clang::ObjCMessageExpr::getArg
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
Definition: ExprObjC.h:1385
clang::ento::CXXConstructorCall::getArgExpr
const Expr * getArgExpr(unsigned Index) const override
Returns the expression associated with a given argument.
Definition: CallEvent.h:904
clang::ento::CallEvent::Location
SourceLocation Location
Definition: CallEvent.h:165
clang::ento::RuntimeDefinition::isForeign
bool isForeign() const
Definition: CallEvent.h:127
clang::ento::RuntimeDefinition
Definition: CallEvent.h:105
clang::SourceManager
This class handles loading and caching of source files into memory.
Definition: SourceManager.h:636
clang::ento::ObjCMethodCall::getRuntimeDefinition
RuntimeDefinition getRuntimeDefinition() const override
Returns the definition of the function or method that will be called.
Definition: CallEvent.cpp:1245
clang::CXXRecordDecl::getLambdaCallOperator
CXXMethodDecl * getLambdaCallOperator() const
Retrieve the lambda call operator of the closure type if this is a closure type.
Definition: DeclCXX.cpp:1540
clang::ento::CXXDestructorCall::getSourceRange
SourceRange getSourceRange() const override
Returns a source range for the entire call, suitable for outputting in diagnostics.
Definition: CallEvent.h:822
clang::ento::CallEvent::operator=
CallEvent & operator=(const CallEvent &)=delete
Decl.h
DeclObjC.h
clang::ento::CXXMemberCall::cloneTo
void cloneTo(void *Dest) const override
Copies this CallEvent, with vtable intact, into a new block of memory.
Definition: CallEvent.h:705
clang::ento::CXXInstanceCall::getExtraInvalidatedValues
void getExtraInvalidatedValues(ValueList &Values, RegionAndSymbolInvalidationTraits *ETraits) const override
Used to specify non-argument regions that will be invalidated as a result of this call.
Definition: CallEvent.cpp:683
clang::ento::MemRegion
MemRegion - The root abstract class for all memory regions.
Definition: MemRegion.h:95
clang::ento::CXXConstructorCall::getDecl
const CXXConstructorDecl * getDecl() const override
Returns the declaration of the function or method that will be called.
Definition: CallEvent.h:898
clang::ento::CXXMemberOperatorCall::getKind
Kind getKind() const override
Returns the kind of call this is.
Definition: CallEvent.h:766
clang::ento::CallEvent::getState
const ProgramStateRef & getState() const
The state in which the call is being evaluated.
Definition: CallEvent.h:225
clang::ento::CE_Block
@ CE_Block
Definition: CallEvent.h:74
clang::ento::CXXAllocatorCall::getArraySizeVal
SVal getArraySizeVal() const
Definition: CallEvent.h:1042
clang::ento::CallEvent::CallEvent
CallEvent(const Decl *D, ProgramStateRef state, const LocationContext *lctx)
Definition: CallEvent.h:181
clang::ento::ObjCMethodCall::getDecl
const ObjCMethodDecl * getDecl() const override
Returns the declaration of the function or method that will be called.
Definition: CallEvent.h:1159
clang::ento::CXXConstructorCall::classof
static bool classof(const CallEvent *CA)
Definition: CallEvent.h:911
clang::ento::BlockCall::getNumArgs
unsigned getNumArgs() const override
Returns the number of arguments (explicit and implicit).
Definition: CallEvent.h:574
clang::ento::CallEvent::getReturnValue
SVal getReturnValue() const
Returns the return value of the call.
Definition: CallEvent.cpp:320
clang::ento::CallEvent::getLocationContext
const LocationContext * getLocationContext() const
The context in which the call is being evaluated.
Definition: CallEvent.h:230
clang::ento::ObjCMethodCall::getSelector
Selector getSelector() const
Definition: CallEvent.h:1179
clang::ento::SimpleFunctionCall::getKind
Kind getKind() const override
Returns the kind of call this is.
Definition: CallEvent.h:544
clang::ento::OCM_PropertyAccess
@ OCM_PropertyAccess
Definition: CallEvent.h:1123
clang::ento::CallEvent::parameters
virtual ArrayRef< ParmVarDecl * > parameters() const =0
Return call's formal parameters.
clang::ento::CallEvent::getArgSourceRange
virtual SourceRange getArgSourceRange(unsigned Index) const
Returns the source range for errors associated with this argument.
Definition: CallEvent.cpp:313
clang::ento::BlockCall::getOriginExpr
const CallExpr * getOriginExpr() const override
Returns the expression whose value will be the result of this call.
Definition: CallEvent.h:570
clang::ento::CXXMemberOperatorCall::getCXXThisExpr
const Expr * getCXXThisExpr() const override
Returns the expression representing the implicit 'this' object.
Definition: CallEvent.cpp:846
clang::ento::CXXConstructorCall
Represents a call to a C++ constructor.
Definition: CallEvent.h:874
clang::BlockDecl
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:4283
clang::ento::CXXDestructorCall::getKindAsString
StringRef getKindAsString() const override
Definition: CallEvent.h:836
clang::ento::CXXInstanceCall::getCXXThisExpr
virtual const Expr * getCXXThisExpr() const
Returns the expression representing the implicit 'this' object.
Definition: CallEvent.h:675
clang::ento::CallEvent::getSourceRange
virtual SourceRange getSourceRange() const
Returns a source range for the entire call, suitable for outputting in diagnostics.
Definition: CallEvent.h:274
clang::ento::CallEventRef::CallEventRef
CallEventRef(const T *Call)
Definition: CallEvent.h:83
DeclBase.h
clang::ento::CXXDeallocatorCall::CXXDeallocatorCall
CXXDeallocatorCall(const CXXDeleteExpr *E, ProgramStateRef St, const LocationContext *LCtx)
Definition: CallEvent.h:1085
llvm::simplify_type< clang::ento::CallEventRef< T > >::getSimplifiedValue
static SimpleType getSimplifiedValue(clang::ento::CallEventRef< T > Val)
Definition: CallEvent.h:1395
clang::ento::SimpleFunctionCall::getNumArgs
unsigned getNumArgs() const override
Returns the number of arguments (explicit and implicit).
Definition: CallEvent.h:538
clang::ento::ObjCMethodCall::getArgExpr
const Expr * getArgExpr(unsigned Index) const override
Returns the expression associated with a given argument.
Definition: CallEvent.h:1167
clang::ento::ObjCMethodCall::isReceiverSelfOrSuper
bool isReceiverSelfOrSuper() const
Checks if the receiver refers to 'self' or 'super'.
Definition: CallEvent.cpp:994
clang::ento::CallEvent::getASTArgumentIndex
virtual unsigned getASTArgumentIndex(unsigned CallArgumentIndex) const
Some call event sub-classes conveniently adjust mismatching AST indices to match parameter indices.
Definition: CallEvent.h:433
clang::ento::CXXMemberCall::getRuntimeDefinition
RuntimeDefinition getRuntimeDefinition() const override
Returns the definition of the function or method that will be called.
Definition: CallEvent.cpp:834
clang::ento::CXXInheritedConstructorCall::cloneTo
void cloneTo(void *Dest) const override
Copies this CallEvent, with vtable intact, into a new block of memory.
Definition: CallEvent.h:948
clang::ento::BlockCall::getInitialStackFrameContents
void getInitialStackFrameContents(const StackFrameContext *CalleeCtx, BindingsTy &Bindings) const override
Populates the given SmallVector with the bindings in the callee's stack frame at the start of this ca...
Definition: CallEvent.cpp:871
clang::ento::CallEvent::BindingsTy
SmallVectorImpl< FrameBindingTy > BindingsTy
Definition: CallEvent.h:362
clang::ento::BlockCall::getBlockRegion
const BlockDataRegion * getBlockRegion() const
Returns the region associated with this instance of the block.
Definition: CallEvent.cpp:850
clang::ento::CallEventKind
CallEventKind
Definition: CallEvent.h:59
clang::CallExpr::getArg
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
Definition: Expr.h:3001
clang::ento::ObjCMethodCall::cloneTo
void cloneTo(void *Dest) const override
Copies this CallEvent, with vtable intact, into a new block of memory.
Definition: CallEvent.h:1145
clang::ento::CXXMemberOperatorCall::cloneTo
void cloneTo(void *Dest) const override
Copies this CallEvent, with vtable intact, into a new block of memory.
Definition: CallEvent.h:747
clang::ento::BlockCall::getKind
Kind getKind() const override
Returns the kind of call this is.
Definition: CallEvent.h:652
clang::ento::CXXAllocatorCall::getOriginExpr
const CXXNewExpr * getOriginExpr() const override
Returns the expression whose value will be the result of this call.
Definition: CallEvent.h:1011
clang::ento::CXXMemberOperatorCall::getOriginExpr
const CXXOperatorCallExpr * getOriginExpr() const override
Returns the expression whose value will be the result of this call.
Definition: CallEvent.h:752
clang::PseudoObjectExpr
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Definition: Expr.h:6105
clang::ento::ExprEngine::getObjectUnderConstruction
static Optional< SVal > getObjectUnderConstruction(ProgramStateRef State, const ConstructionContextItem &Item, const LocationContext *LC)
By looking at a certain item that may be potentially part of an object's ConstructionContext,...
Definition: ExprEngine.cpp:598
clang::Stmt::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.cpp:348
clang::CXXDestructorDecl
Represents a C++ destructor within a class.
Definition: DeclCXX.h:2703
clang::ento::BlockDataRegion
BlockDataRegion - A region that represents a block instance.
Definition: MemRegion.h:674
IdentifierTable.h
clang::ento::CallEventManager::getCXXInheritedConstructorCall
CallEventRef< CXXInheritedConstructorCall > getCXXInheritedConstructorCall(const CXXInheritedCtorInitExpr *E, const MemRegion *Target, ProgramStateRef State, const LocationContext *LCtx)
Definition: CallEvent.h:1327
clang::ento::VarRegion
Definition: MemRegion.h:940
clang::ento::CallEventManager::getCXXConstructorCall
CallEventRef< CXXConstructorCall > getCXXConstructorCall(const CXXConstructExpr *E, const MemRegion *Target, ProgramStateRef State, const LocationContext *LCtx)
Definition: CallEvent.h:1321
clang::ento::CXXInstanceCall::getInitialStackFrameContents
void getInitialStackFrameContents(const StackFrameContext *CalleeCtx, BindingsTy &Bindings) const override
Populates the given SmallVector with the bindings in the callee's stack frame at the start of this ca...
Definition: CallEvent.cpp:789
Type.h
clang::ento::CallEvent::invalidateRegions
ProgramStateRef invalidateRegions(unsigned BlockCount, ProgramStateRef Orig=nullptr) const
Returns a new state with all argument regions invalidated.
Definition: CallEvent.cpp:234
Expr.h
clang::ento::AnyCXXConstructorCall::getCXXThisVal
SVal getCXXThisVal() const
Returns the value of the implicit 'this' object.
Definition: CallEvent.cpp:894
clang::ento::CallEvent::getInitialStackFrameContents
virtual void getInitialStackFrameContents(const StackFrameContext *CalleeCtx, BindingsTy &Bindings) const =0
Populates the given SmallVector with the bindings in the callee's stack frame at the start of this ca...
clang::ento::CXXAllocatorCall
Represents the memory allocation call in a C++ new-expression.
Definition: CallEvent.h:999
ValueList
ArrayRef< SVal > ValueList
Definition: ProgramState.cpp:147
clang::VarDecl
Represents a variable declaration or definition.
Definition: Decl.h:906
clang::CXXDeleteExpr::getOperatorDelete
FunctionDecl * getOperatorDelete() const
Definition: ExprCXX.h:2461
clang::CXXConstructExpr::getConstructor
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will (ultimately) call.
Definition: ExprCXX.h:1539
clang::ento::SimpleFunctionCall::classof
static bool classof(const CallEvent *CA)
Definition: CallEvent.h:547
clang::Type::getAsCXXRecordDecl
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
Definition: Type.cpp:1760
clang::ento::CallEvent::cloneWithState
CallEventRef cloneWithState(ProgramStateRef NewState) const
Returns a copy of this CallEvent, but using the given state.
Definition: CallEvent.h:374
clang::ento::CallEventManager::getCXXAllocatorCall
CallEventRef< CXXAllocatorCall > getCXXAllocatorCall(const CXXNewExpr *E, ProgramStateRef State, const LocationContext *LCtx)
Definition: CallEvent.h:1341
clang::ento::CXXAllocatorCall::getObjectUnderConstruction
SVal getObjectUnderConstruction() const
Definition: CallEvent.h:1019
ExprObjC.h
clang::ento::ObjCMethodCall::getKindAsString
StringRef getKindAsString() const override
Definition: CallEvent.h:1232
ExprCXX.h
clang::CXXInheritedCtorInitExpr
Represents a call to an inherited base class constructor from an inheriting constructor.
Definition: ExprCXX.h:1658
clang::ento::CXXAllocatorCall::CXXAllocatorCall
CXXAllocatorCall(const CXXNewExpr *E, ProgramStateRef St, const LocationContext *LCtx)
Definition: CallEvent.h:1003
clang::ento::CallEvent::getDecl
virtual const Decl * getDecl() const
Returns the declaration of the function or method that will be called.
Definition: CallEvent.h:214
clang::ento::CallEventManager::getCaller
CallEventRef getCaller(const StackFrameContext *CalleeCtx, ProgramStateRef State)
Gets an outside caller given a callee context.
Definition: CallEvent.cpp:1398
clang::ento::CE_ObjCMessage
@ CE_ObjCMessage
Definition: CallEvent.h:75
clang::ento::CXXDestructorCall::getRuntimeDefinition
RuntimeDefinition getRuntimeDefinition() const override
Returns the definition of the function or method that will be called.
Definition: CallEvent.cpp:937
clang::ObjCMessageExpr
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:940
clang::ento::CallEvent::cloneWithState
CallEventRef< T > cloneWithState(ProgramStateRef NewState) const
Returns a copy of this CallEvent, but using the given state.
Definition: CallEvent.h:1354
clang::ento::CallEvent::CallEvent
CallEvent(const Expr *E, ProgramStateRef state, const LocationContext *lctx)
Definition: CallEvent.h:178
clang::OverloadedOperatorKind
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
Definition: OperatorKinds.h:21
clang::ento::CXXInstanceCall::getCXXThisVal
virtual SVal getCXXThisVal() const
Returns the value of the implicit 'this' object.
Definition: CallEvent.cpp:714
clang::ento::ObjCMethodCall::getMethodFamily
ObjCMethodFamily getMethodFamily() const
Definition: CallEvent.h:1175
clang::ento::RuntimeDefinition::RuntimeDefinition
RuntimeDefinition()=default
clang::ento::CallEventManager::getSimpleCall
CallEventRef getSimpleCall(const CallExpr *E, ProgramStateRef State, const LocationContext *LCtx)
Definition: CallEvent.cpp:1377
state
and static some checkers Checker The latter are built on top of the former via the Checker and CheckerVisitor and attempts to isolate them from much of the gore of the internal analysis the analyzer is basically a source code simulator that traces out possible paths of execution The state of the and the combination of state and program point is a node in an exploded which has the entry program point and initial state
Definition: README.txt:30
clang::ento::AnyFunctionCall::getInitialStackFrameContents
void getInitialStackFrameContents(const StackFrameContext *CalleeCtx, BindingsTy &Bindings) const override
Populates the given SmallVector with the bindings in the callee's stack frame at the start of this ca...
Definition: CallEvent.cpp:593
clang::ento::ObjCMethodCall::getExtraInvalidatedValues
void getExtraInvalidatedValues(ValueList &Values, RegionAndSymbolInvalidationTraits *ETraits) const override
Used to specify non-argument regions that will be invalidated as a result of this call.
Definition: CallEvent.cpp:953
clang::ento::Loc
Definition: SVals.h:282
clang::ento::CallEvent::hasNonZeroCallbackArg
bool hasNonZeroCallbackArg() const
Returns true if any of the arguments appear to represent callbacks.
Definition: CallEvent.cpp:137
clang::ento::ObjCMethodCall::getReceiverInterface
const ObjCInterfaceDecl * getReceiverInterface() const
Get the interface for the receiver.
Definition: CallEvent.h:1192
clang::ento::CXXMemberOperatorCall::getASTArgumentIndex
unsigned getASTArgumentIndex(unsigned CallArgumentIndex) const override
Some call event sub-classes conveniently adjust mismatching AST indices to match parameter indices.
Definition: CallEvent.h:781
clang::ento::CXXAllocatorCall::getKind
Kind getKind() const override
Returns the kind of call this is.
Definition: CallEvent.h:1063
clang::ento::BlockCall::getKindAsString
StringRef getKindAsString() const override
Definition: CallEvent.h:653
clang::ento::CXXMemberOperatorCall::getKindAsString
StringRef getKindAsString() const override
Definition: CallEvent.h:767
clang::ento::CXXInheritedConstructorCall::getOriginExpr
const CXXInheritedCtorInitExpr * getOriginExpr() const override
Returns the expression whose value will be the result of this call.
Definition: CallEvent.h:953
clang::ento::CXXInheritedConstructorCall::CXXInheritedConstructorCall
CXXInheritedConstructorCall(const CXXInheritedCtorInitExpr *CE, const MemRegion *Target, ProgramStateRef St, const LocationContext *LCtx)
Definition: CallEvent.h:940
clang::ento::AnyFunctionCall::classof
static bool classof(const CallEvent *CA)
Definition: CallEvent.h:509
clang::ento::CXXConstructorCall::CXXConstructorCall
CXXConstructorCall(const CXXConstructExpr *CE, const MemRegion *Target, ProgramStateRef St, const LocationContext *LCtx)
Creates a constructor call.
Definition: CallEvent.h:885
clang::ento::BlockCall::isConversionFromLambda
bool isConversionFromLambda() const
Definition: CallEvent.h:592
clang::ento::CallEvent::getArgExpr
virtual const Expr * getArgExpr(unsigned Index) const
Returns the expression associated with a given argument.
Definition: CallEvent.h:283
clang::CXXRecordDecl
Represents a C++ struct/union/class.
Definition: DeclCXX.h:254
SourceLocation.h
clang::ento::CXXInheritedConstructorCall
Represents a call to a C++ inherited constructor.
Definition: CallEvent.h:936
clang::ento::CXXInstanceCall
Represents a non-static C++ member function call, no matter how it is written.
Definition: CallEvent.h:660
clang::serialized_diags::create
std::unique_ptr< DiagnosticConsumer > create(StringRef OutputFile, DiagnosticOptions *Diags, bool MergeChildRecords=false)
Returns a DiagnosticConsumer that serializes diagnostics to a bitcode file.
Definition: SerializedDiagnosticPrinter.cpp:301
clang::ento::CE_CXXMember
@ CE_CXXMember
Definition: CallEvent.h:61
clang::CXXOperatorCallExpr::getOperator
OverloadedOperatorKind getOperator() const
Returns the kind of overloaded operator that this expression refers to.
Definition: ExprCXX.h:112
clang::ento::CallEventManager
Manages the lifetime of CallEvent objects.
Definition: CallEvent.h:1246
clang::ento::ObjCMessageKind
ObjCMessageKind
Represents the ways an Objective-C message send can occur.
Definition: CallEvent.h:1122
clang::ento::ObjCMethodCall::classof
static bool classof(const CallEvent *CA)
Definition: CallEvent.h:1234
clang::ento::CE_CXXMemberOperator
@ CE_CXXMemberOperator
Definition: CallEvent.h:62
Cache
TypePropertyCache< Private > Cache
Definition: Type.cpp:3936
clang::ento::DefinedSVal::isValid
bool isValid() const =delete
clang::ento::CXXDestructorCall::getCXXThisVal
SVal getCXXThisVal() const override
Returns the value of the implicit 'this' object.
Definition: CallEvent.cpp:931
clang::ento::CallEvent::param_type_iterator
llvm::mapped_iterator< ArrayRef< ParmVarDecl * >::iterator, GetTypeFn > param_type_iterator
Definition: CallEvent.h:461
clang::ento::CallEvent::cloneTo
virtual void cloneTo(void *Dest) const =0
Copies this CallEvent, with vtable intact, into a new block of memory.
clang::ento::AnyFunctionCall::AnyFunctionCall
AnyFunctionCall(const Decl *D, ProgramStateRef St, const LocationContext *LCtx)
Definition: CallEvent.h:488
clang::ento::CXXAllocatorCall::getPlacementArgExpr
const Expr * getPlacementArgExpr(unsigned Index) const
Number of placement arguments to the operator new() call.
Definition: CallEvent.h:1059
clang::CallExpr::getNumArgs
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
Definition: Expr.h:2988
clang::CXXDeleteExpr
Represents a delete expression for memory deallocation and destructor calls, e.g.
Definition: ExprCXX.h:2422
llvm::ArrayRef
Definition: LLVM.h:34
clang::ento::CallEvent::param_type_begin
param_type_iterator param_type_begin() const
Returns an iterator over the types of the call's formal parameters.
Definition: CallEvent.h:468
clang::Decl
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:83
clang::ObjCPropertyDecl
Represents one property declaration in an Objective-C interface.
Definition: DeclObjC.h:732
clang::ento::CXXAllocatorCall::cloneTo
void cloneTo(void *Dest) const override
Copies this CallEvent, with vtable intact, into a new block of memory.
Definition: CallEvent.h:1008
clang::ento::CallEvent::hasNonNullArgumentsWithType
bool hasNonNullArgumentsWithType(bool(*Condition)(QualType)) const
Returns true if the type of any of the non-null arguments satisfies the condition.
Definition: CallEvent.cpp:114
clang::ento::CallEvent::getExtraInvalidatedValues
virtual void getExtraInvalidatedValues(ValueList &Values, RegionAndSymbolInvalidationTraits *ETraits) const
Used to specify non-argument regions that will be invalidated as a result of this call.
Definition: CallEvent.h:201
clang::ento::ObjCMethodCall::canBeOverridenInSubclass
virtual bool canBeOverridenInSubclass(ObjCInterfaceDecl *IDecl, Selector Sel) const
Check if the selector may have multiple definitions (may have overrides).
Definition: CallEvent.cpp:1105
clang::ento::SimpleFunctionCall::getOriginExpr
const CallExpr * getOriginExpr() const override
Returns the expression whose value will be the result of this call.
Definition: CallEvent.h:532
clang::ento::CXXDeallocatorCall::classof
static bool classof(const CallEvent *CE)
Definition: CallEvent.h:1113
clang::ento::CXXMemberCall::getArgExpr
const Expr * getArgExpr(unsigned Index) const override
Returns the expression associated with a given argument.
Definition: CallEvent.h:718
clang::ento::CE_BEG_CXX_INSTANCE_CALLS
@ CE_BEG_CXX_INSTANCE_CALLS
Definition: CallEvent.h:64
clang::ento::CallEvent::FrameBindingTy
std::pair< SVal, SVal > FrameBindingTy
Definition: CallEvent.h:361
clang::ento::ObjCMethodCall::getSourceRange
SourceRange getSourceRange() const override
Returns a source range for the entire call, suitable for outputting in diagnostics.
Definition: CallEvent.cpp:1008
LLVM.h
clang::ento::CallEvent::getAdjustedParameterIndex
virtual Optional< unsigned > getAdjustedParameterIndex(unsigned ASTArgumentIndex) const
Some calls have parameter numbering mismatched from argument numbering.
Definition: CallEvent.h:426
clang::ento::CallEvent::getKindAsString
virtual StringRef getKindAsString() const =0
clang::ento::CallEventManager::CallEventManager
CallEventManager(llvm::BumpPtrAllocator &alloc)
Definition: CallEvent.h:1298
llvm::IntrusiveRefCntPtrInfo
Definition: LLVM.h:48
clang::ento::CXXDeallocatorCall::cloneTo
void cloneTo(void *Dest) const override
Copies this CallEvent, with vtable intact, into a new block of memory.
Definition: CallEvent.h:1090
State
LineState State
Definition: UnwrappedLineFormatter.cpp:1147
clang::ento::CXXInstanceCall::classof
static bool classof(const CallEvent *CA)
Definition: CallEvent.h:687
clang::ento::SimpleFunctionCall::getDecl
const FunctionDecl * getDecl() const override
Returns the declaration of the function or method that will be called.
Definition: CallEvent.cpp:663
clang::ento::CXXMemberOperatorCall::CXXMemberOperatorCall
CXXMemberOperatorCall(const CXXOperatorCallExpr *CE, ProgramStateRef St, const LocationContext *LCtx)
Definition: CallEvent.h:742
clang::ento::CE_END_FUNCTION_CALLS
@ CE_END_FUNCTION_CALLS
Definition: CallEvent.h:73
clang::ento::CallEvent::getProgramPoint
ProgramPoint getProgramPoint(bool IsPreVisit=false, const ProgramPointTag *Tag=nullptr) const
Returns an appropriate ProgramPoint for this call.
Definition: CallEvent.cpp:289
clang::ento::CallEvent::getRuntimeDefinition
virtual RuntimeDefinition getRuntimeDefinition() const =0
Returns the definition of the function or method that will be called.
clang::ento::SimpleFunctionCall::getKindAsString
StringRef getKindAsString() const override
Definition: CallEvent.h:545
clang::ento::ObjCMethodCall
Represents any expression that calls an Objective-C method.
Definition: CallEvent.h:1131
clang::ento::CallEvent::getNumArgs
virtual unsigned getNumArgs() const =0
Returns the number of arguments (explicit and implicit).
clang::ento::CallEvent::Data
const void * Data
Definition: CallEvent.h:160
clang::ento::BlockDataRegion::getDecl
const LLVM_ATTRIBUTE_RETURNS_NONNULL BlockDecl * getDecl() const
Definition: MemRegion.h:704
clang::ento::CXXMemberOperatorCall::getOverloadedOperator
OverloadedOperatorKind getOverloadedOperator() const
Definition: CallEvent.h:787
clang::IdentifierInfo
One of these records is kept for each identifier that is lexed.
Definition: IdentifierTable.h:85
clang::ento::BlockDataRegion::referenced_vars_end
referenced_vars_iterator referenced_vars_end() const
Definition: MemRegion.cpp:1703
clang::ento::BlockCall::argumentsMayEscape
bool argumentsMayEscape() const override
Returns true if any of the arguments are known to escape to long- term storage, even if this method w...
Definition: CallEvent.h:643
clang::ento::CXXAllocatorCall::getArgExpr
const Expr * getArgExpr(unsigned Index) const override
Returns the expression associated with a given argument.
Definition: CallEvent.h:1048
clang::ento::BlockCall::getRuntimeDefinition
RuntimeDefinition getRuntimeDefinition() const override
Returns the definition of the function or method that will be called.
Definition: CallEvent.h:613
clang::ento::CXXMemberCall::getCXXThisExpr
const Expr * getCXXThisExpr() const override
Returns the expression representing the implicit 'this' object.
Definition: CallEvent.cpp:830
clang::ento::ObjCMethodCall::isInstanceMessage
bool isInstanceMessage() const
Definition: CallEvent.h:1171
clang::ento::CallEvent::setForeign
void setForeign(bool B) const
Definition: CallEvent.h:222
clang::ento::AnyFunctionCall::parameters
ArrayRef< ParmVarDecl * > parameters() const override
Return call's formal parameters.
Definition: CallEvent.cpp:532
clang::ento::RuntimeDefinition::getDispatchRegion
const MemRegion * getDispatchRegion()
When other definitions are possible, returns the region whose runtime type determines the method defi...
Definition: CallEvent.h:136
clang::ObjCMessageExpr::getMethodFamily
ObjCMethodFamily getMethodFamily() const
Definition: ExprObjC.h:1365
clang::ento::ObjCMethodCall::isSetter
bool isSetter() const
Returns true if this property access or subscript is a setter (has the form of an assignment).
Definition: CallEvent.h:1205
clang::ento::CallEvent::getResultType
QualType getResultType() const
Returns the result type, adjusted for references.
Definition: CallEvent.cpp:72
clang::ento::CE_CXXAllocator
@ CE_CXXAllocator
Definition: CallEvent.h:70
ProgramState.h
clang::ento::CallEvent::getSVal
SVal getSVal(const Stmt *S) const
Get the value of arbitrary expressions at this point in the path.
Definition: CallEvent.h:193
clang::ento::BlockCall
Represents a call to a block.
Definition: CallEvent.h:555
std
Definition: Format.h:4477
clang::ento::BlockCall::getDecl
const BlockDecl * getDecl() const override
Returns the declaration of the function or method that will be called.
Definition: CallEvent.h:585
clang::ento::CallEvent::CallEvent
CallEvent(const CallEvent &Original)
Definition: CallEvent.h:185
clang::ento::CallEvent::getKind
virtual Kind getKind() const =0
Returns the kind of call this is.
clang::ObjCMethodDecl
ObjCMethodDecl - Represents an instance or class method declaration.
Definition: DeclObjC.h:139
ExprEngine.h
clang::ento::ObjCMethodCall::parameters
ArrayRef< ParmVarDecl * > parameters() const override
Return call's formal parameters.
Definition: CallEvent.cpp:946
clang::ento::ObjCMethodCall::getKind
Kind getKind() const override
Returns the kind of call this is.
Definition: CallEvent.h:1231
clang::ento::OCM_Message
@ OCM_Message
Definition: CallEvent.h:1125
clang
Definition: CalledOnceCheck.h:17
clang::ento::CallEvent::isVariadic
static bool isVariadic(const Decl *D)
Returns true if the given decl is known to be variadic.
Definition: CallEvent.cpp:378
clang::ento::CallEvent::isInSystemHeader
bool isInSystemHeader() const
Returns true if the callee is known to be from a system header.
Definition: CallEvent.h:252
clang::Selector
Smart pointer class that efficiently represents Objective-C method names.
Definition: IdentifierTable.h:759
clang::Stmt
Stmt - This represents one statement.
Definition: Stmt.h:71
clang::ento::CE_CXXDestructor
@ CE_CXXDestructor
Definition: CallEvent.h:63
clang::ento::SimpleFunctionCall::cloneTo
void cloneTo(void *Dest) const override
Copies this CallEvent, with vtable intact, into a new block of memory.
Definition: CallEvent.h:527
clang::ento::AnyFunctionCall::argumentsMayEscape
bool argumentsMayEscape() const override
Returns true if any of the arguments are known to escape to long- term storage, even if this method w...
Definition: CallEvent.cpp:602
clang::ento::CallEventRef::cloneWithState
CallEventRef< T > cloneWithState(ProgramStateRef State) const
Definition: CallEvent.h:86
clang::ento::SimpleFunctionCall::getArgExpr
const Expr * getArgExpr(unsigned Index) const override
Returns the expression associated with a given argument.
Definition: CallEvent.h:540
clang::ento::CallEvent
Represents an abstract call to a function or method along a particular path.
Definition: CallEvent.h:148
clang::ento::CallEvent::isForeign
bool isForeign() const
Definition: CallEvent.h:218
clang::ObjCMessageExpr::getMethodDecl
const ObjCMethodDecl * getMethodDecl() const
Definition: ExprObjC.h:1346
clang::ento::SimpleFunctionCall::SimpleFunctionCall
SimpleFunctionCall(const CallExpr *CE, ProgramStateRef St, const LocationContext *LCtx)
Definition: CallEvent.h:522
clang::ento::CXXMemberOperatorCall
Represents a C++ overloaded operator call where the operator is implemented as a non-static member fu...
Definition: CallEvent.h:738
clang::CXXDeleteExpr::getArgument
Expr * getArgument()
Definition: ExprCXX.h:2463
clang::ento::CXXMemberOperatorCall::getAdjustedParameterIndex
Optional< unsigned > getAdjustedParameterIndex(unsigned ASTArgumentIndex) const override
Some calls have parameter numbering mismatched from argument numbering.
Definition: CallEvent.h:774
clang::ento::CallEvent::getArgSVal
virtual SVal getArgSVal(unsigned Index) const
Returns the value of a given argument at the time of the call.
Definition: CallEvent.cpp:306
clang::ento::BlockCall::getRegionStoringCapturedLambda
const VarRegion * getRegionStoringCapturedLambda() const
For a block converted from a C++ lambda, returns the block VarRegion for the variable holding the cap...
Definition: CallEvent.h:602
clang::ento::CXXAllocatorCall::classof
static bool classof(const CallEvent *CE)
Definition: CallEvent.h:1066
clang::ento::CXXInheritedConstructorCall::getKindAsString
StringRef getKindAsString() const override
Definition: CallEvent.h:987
clang::ento::CXXInheritedConstructorCall::getInheritingConstructor
const CXXConstructExpr * getInheritingConstructor() const
Obtain the CXXConstructExpr for the sub-class that inherited the current constructor (possibly indire...
Definition: CallEvent.h:968
clang::ento::CXXInstanceCall::getRuntimeDefinition
RuntimeDefinition getRuntimeDefinition() const override
Returns the definition of the function or method that will be called.
Definition: CallEvent.cpp:725
clang::ento::CXXMemberCall
Represents a non-static C++ member function call.
Definition: CallEvent.h:696
clang::ento::CXXAllocatorCall::getNumArgs
unsigned getNumArgs() const override
Returns the number of arguments (explicit and implicit).
Definition: CallEvent.h:1032
clang::ento::CE_CXXConstructor
@ CE_CXXConstructor
Definition: CallEvent.h:66
clang::ento::CallEvent::getCalleeAnalysisDeclContext
AnalysisDeclContext * getCalleeAnalysisDeclContext() const
Returns AnalysisDeclContext for the callee stack frame.
Definition: CallEvent.cpp:153
clang::ento::SVal
SVal - This represents a symbolic expression, which can be either an L-value or an R-value.
Definition: SVals.h:73
clang::ento::CXXAllocatorCall::getNumImplicitArgs
unsigned getNumImplicitArgs() const
Number of non-placement arguments to the call.
Definition: CallEvent.h:1028
clang::ento::CXXDeallocatorCall::getDecl
const FunctionDecl * getDecl() const override
Returns the declaration of the function or method that will be called.
Definition: CallEvent.h:1099
clang::ento::ObjCMethodCall::getInitialStackFrameContents
void getInitialStackFrameContents(const StackFrameContext *CalleeCtx, BindingsTy &Bindings) const override
Populates the given SmallVector with the bindings in the callee's stack frame at the start of this ca...
Definition: CallEvent.cpp:1359
Stmt.h
clang::CXXConstructExpr::getArg
Expr * getArg(unsigned Arg)
Return the specified argument.
Definition: ExprCXX.h:1618
clang::ento::CE_BEG_FUNCTION_CALLS
@ CE_BEG_FUNCTION_CALLS
Definition: CallEvent.h:72
clang::ento::CE_END_CXX_CONSTRUCTOR_CALLS
@ CE_END_CXX_CONSTRUCTOR_CALLS
Definition: CallEvent.h:69
clang::CXXNewExpr::getArraySize
Optional< Expr * > getArraySize()
This might return None even if isArray() returns true, since there might not be an array size express...
Definition: ExprCXX.h:2274
llvm::SmallVectorImpl
Definition: Randstruct.h:18
clang::ObjCMessageExpr::getNumArgs
unsigned getNumArgs() const
Return the number of actual arguments in this message, not counting the receiver.
Definition: ExprObjC.h:1372
clang::ento::AnyFunctionCall::getDecl
const FunctionDecl * getDecl() const override
Returns the declaration of the function or method that will be called.
Definition: CallEvent.h:496
clang::ValueDecl::getType
QualType getType() const
Definition: Decl.h:712
clang::ento::SimpleFunctionCall
Represents a C function or static C++ member function call.
Definition: CallEvent.h:518
clang::ento::CXXInstanceCall::CXXInstanceCall
CXXInstanceCall(const FunctionDecl *D, ProgramStateRef St, const LocationContext *LCtx)
Definition: CallEvent.h:665
clang::ento::RegionAndSymbolInvalidationTraits
Information about invalidation for a particular region/symbol.
Definition: MemRegion.h:1570
clang::ento::CXXMemberOperatorCall::getNumArgs
unsigned getNumArgs() const override
Returns the number of arguments (explicit and implicit).
Definition: CallEvent.h:756
clang::ento::CXXInstanceCall::getDecl
const FunctionDecl * getDecl() const override
Returns the declaration of the function or method that will be called.
Definition: CallEvent.cpp:671
clang::Expr
This represents one expression.
Definition: Expr.h:109
clang::ento::CE_END_CXX_INSTANCE_CALLS
@ CE_END_CXX_INSTANCE_CALLS
Definition: CallEvent.h:65
clang::CXXNewExpr::getPlacementArg
Expr * getPlacementArg(unsigned I)
Definition: ExprCXX.h:2308
SM
#define SM(sm)
Definition: Cuda.cpp:79
clang::ento::CXXDeallocatorCall::getArgExpr
const Expr * getArgExpr(unsigned Index) const override
Returns the expression associated with a given argument.
Definition: CallEvent.h:1105
clang::ento::CallEvent::getParameterLocation
const ParamVarRegion * getParameterLocation(unsigned Index, unsigned BlockCount) const
Returns memory location for a parameter variable within the callee stack frame.
Definition: CallEvent.cpp:195
clang::ento::CXXMemberCall::CXXMemberCall
CXXMemberCall(const CXXMemberCallExpr *CE, ProgramStateRef St, const LocationContext *LCtx)
Definition: CallEvent.h:700
clang::ento::CXXInheritedConstructorCall::getDecl
const CXXConstructorDecl * getDecl() const override
Returns the declaration of the function or method that will be called.
Definition: CallEvent.h:957
clang::ento::CXXMemberCall::getKind
Kind getKind() const override
Returns the kind of call this is.
Definition: CallEvent.h:726
clang::ento::ObjCMethodCall::argumentsMayEscape
bool argumentsMayEscape() const override
Returns true if any of the arguments are known to escape to long- term storage, even if this method w...
Definition: CallEvent.cpp:1348
clang::ento::CallEvent::getCalleeIdentifier
const IdentifierInfo * getCalleeIdentifier() const
Returns the name of the callee, if its name is a simple identifier.
Definition: CallEvent.h:343
clang::ento::CXXInheritedConstructorCall::getKind
Kind getKind() const override
Returns the kind of call this is.
Definition: CallEvent.h:986
clang::ento::CXXConstructorCall::cloneTo
void cloneTo(void *Dest) const override
Copies this CallEvent, with vtable intact, into a new block of memory.
Definition: CallEvent.h:891
clang::ento::CXXDeallocatorCall
Represents the memory deallocation call in a C++ delete-expression.
Definition: CallEvent.h:1081
clang::ento::CXXMemberOperatorCall::classof
static bool classof(const CallEvent *CA)
Definition: CallEvent.h:769
clang::ento::CXXConstructorCall::getOriginExpr
const CXXConstructExpr * getOriginExpr() const override
Returns the expression whose value will be the result of this call.
Definition: CallEvent.h:894
clang::Decl::getLocation
SourceLocation getLocation() const
Definition: DeclBase.h:432
clang::ento::CallEvent::dump
void dump() const
Definition: CallEvent.cpp:327
GCCTypeClass::None
@ None
clang::FunctionDecl
Represents a function declaration or definition.
Definition: Decl.h:1904
clang::ento::AnyCXXConstructorCall::classof
static bool classof(const CallEvent *Call)
Definition: CallEvent.h:865
clang::ProgramPoint
Definition: ProgramPoint.h:58
clang::ento::AnyCXXConstructorCall
Represents any constructor invocation.
Definition: CallEvent.h:845
clang::CallExpr
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2810
clang::ento::CallEvent::getCalleeStackFrame
const StackFrameContext * getCalleeStackFrame(unsigned BlockCount) const
Returns the callee stack frame.
Definition: CallEvent.cpp:165
clang::CXXOperatorCallExpr
A call to an overloaded operator written using operator syntax.
Definition: ExprCXX.h:82
clang::ento::VarRegion::getDecl
const VarDecl * getDecl() const override=0
clang::ento::CXXDestructorCall::getNumArgs
unsigned getNumArgs() const override
Returns the number of arguments (explicit and implicit).
Definition: CallEvent.h:823
clang::CXXConstructExpr
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1467
clang::ento::CXXDestructorCall::isBaseDestructor
bool isBaseDestructor() const
Returns true if this is a call to a base class destructor.
Definition: CallEvent.h:831
clang::ento::RuntimeDefinition::RuntimeDefinition
RuntimeDefinition(const Decl *InD, const MemRegion *InR)
Definition: CallEvent.h:124
clang::CXXMemberCallExpr
Represents a call to a member function that may be written either with member call syntax (e....
Definition: ExprCXX.h:177
llvm::IntrusiveRefCntPtr
Definition: LLVM.h:47
clang::ento::CXXInheritedConstructorCall::getInheritingStackFrame
const StackFrameContext * getInheritingStackFrame() const
Obtain the stack frame of the inheriting constructor.
Definition: CallEvent.cpp:924
clang::ento::CallEvent::Kind
CallEventKind Kind
Definition: CallEvent.h:150
clang::ento::CXXDestructorCall
Represents an implicit call to a C++ destructor.
Definition: CallEvent.h:796
clang::BlockDecl::isConversionFromLambda
bool isConversionFromLambda() const
Definition: Decl.h:4426
clang::ento::BlockCall::classof
static bool classof(const CallEvent *CA)
Definition: CallEvent.h:655
clang::ento::ParamVarRegion
ParamVarRegion - Represents a region for paremters.
Definition: MemRegion.h:1024
clang::ento::CXXMemberCall::classof
static bool classof(const CallEvent *CA)
Definition: CallEvent.h:729
clang::CXXMethodDecl
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:1983