clang  15.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.hasValue() && "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()).hasValue();
418  }
419 
420  /// Some calls have parameter numbering mismatched from argument numbering.
421  /// This function converts an argument index to the corresponding
422  /// parameter index. Returns None is the argument doesn't correspond
423  /// to any parameter variable.
424  virtual Optional<unsigned>
425  getAdjustedParameterIndex(unsigned ASTArgumentIndex) const {
426  return ASTArgumentIndex;
427  }
428 
429  /// Some call event sub-classes conveniently adjust mismatching AST indices
430  /// to match parameter indices. This function converts an argument index
431  /// as understood by CallEvent to the argument index as understood by the AST.
432  virtual unsigned getASTArgumentIndex(unsigned CallArgumentIndex) const {
433  return CallArgumentIndex;
434  }
435 
436  /// Returns the construction context of the call, if it is a C++ constructor
437  /// call or a call of a function returning a C++ class instance. Otherwise
438  /// return nullptr.
440 
441  /// If the call returns a C++ record type then the region of its return value
442  /// can be retrieved from its construction context.
444 
445  // Iterator access to formal parameters and their types.
446 private:
447  struct GetTypeFn {
448  QualType operator()(ParmVarDecl *PD) const { return PD->getType(); }
449  };
450 
451 public:
452  /// Return call's formal parameters.
453  ///
454  /// Remember that the number of formal parameters may not match the number
455  /// of arguments for all calls. However, the first parameter will always
456  /// correspond with the argument value returned by \c getArgSVal(0).
457  virtual ArrayRef<ParmVarDecl *> parameters() const = 0;
458 
459  using param_type_iterator =
460  llvm::mapped_iterator<ArrayRef<ParmVarDecl *>::iterator, GetTypeFn>;
461 
462  /// Returns an iterator over the types of the call's formal parameters.
463  ///
464  /// This uses the callee decl found by default name lookup rather than the
465  /// definition because it represents a public interface, and probably has
466  /// more annotations.
468  return llvm::map_iterator(parameters().begin(), GetTypeFn());
469  }
470  /// \sa param_type_begin()
472  return llvm::map_iterator(parameters().end(), GetTypeFn());
473  }
474 
475  // For debugging purposes only
476  void dump(raw_ostream &Out) const;
477  void dump() const;
478 };
479 
480 /// Represents a call to any sort of function that might have a
481 /// FunctionDecl.
482 class AnyFunctionCall : public CallEvent {
483 protected:
485  const LocationContext *LCtx)
486  : CallEvent(E, St, LCtx) {}
488  const LocationContext *LCtx)
489  : CallEvent(D, St, LCtx) {}
490  AnyFunctionCall(const AnyFunctionCall &Other) = default;
491 
492 public:
493  // This function is overridden by subclasses, but they must return
494  // a FunctionDecl.
495  const FunctionDecl *getDecl() const override {
496  return cast<FunctionDecl>(CallEvent::getDecl());
497  }
498 
499  RuntimeDefinition getRuntimeDefinition() const override;
500 
501  bool argumentsMayEscape() const override;
502 
503  void getInitialStackFrameContents(const StackFrameContext *CalleeCtx,
504  BindingsTy &Bindings) const override;
505 
506  ArrayRef<ParmVarDecl *> parameters() const override;
507 
508  static bool classof(const CallEvent *CA) {
509  return CA->getKind() >= CE_BEG_FUNCTION_CALLS &&
511  }
512 };
513 
514 /// Represents a C function or static C++ member function call.
515 ///
516 /// Example: \c fun()
518  friend class CallEventManager;
519 
520 protected:
522  const LocationContext *LCtx)
523  : AnyFunctionCall(CE, St, LCtx) {}
524  SimpleFunctionCall(const SimpleFunctionCall &Other) = default;
525 
526  void cloneTo(void *Dest) const override {
527  new (Dest) SimpleFunctionCall(*this);
528  }
529 
530 public:
531  const CallExpr *getOriginExpr() const override {
532  return cast<CallExpr>(AnyFunctionCall::getOriginExpr());
533  }
534 
535  const FunctionDecl *getDecl() const override;
536 
537  unsigned getNumArgs() const override { return getOriginExpr()->getNumArgs(); }
538 
539  const Expr *getArgExpr(unsigned Index) const override {
540  return getOriginExpr()->getArg(Index);
541  }
542 
543  Kind getKind() const override { return CE_Function; }
544  StringRef getKindAsString() const override { return "SimpleFunctionCall"; }
545 
546  static bool classof(const CallEvent *CA) {
547  return CA->getKind() == CE_Function;
548  }
549 };
550 
551 /// Represents a call to a block.
552 ///
553 /// Example: <tt>^{ statement-body }()</tt>
554 class BlockCall : public CallEvent {
555  friend class CallEventManager;
556 
557 protected:
559  const LocationContext *LCtx)
560  : CallEvent(CE, St, LCtx) {}
561  BlockCall(const BlockCall &Other) = default;
562 
563  void cloneTo(void *Dest) const override { new (Dest) BlockCall(*this); }
564 
566  RegionAndSymbolInvalidationTraits *ETraits) const override;
567 
568 public:
569  const CallExpr *getOriginExpr() const override {
570  return cast<CallExpr>(CallEvent::getOriginExpr());
571  }
572 
573  unsigned getNumArgs() const override { return getOriginExpr()->getNumArgs(); }
574 
575  const Expr *getArgExpr(unsigned Index) const override {
576  return getOriginExpr()->getArg(Index);
577  }
578 
579  /// Returns the region associated with this instance of the block.
580  ///
581  /// This may be NULL if the block's origin is unknown.
582  const BlockDataRegion *getBlockRegion() const;
583 
584  const BlockDecl *getDecl() const override {
585  const BlockDataRegion *BR = getBlockRegion();
586  if (!BR)
587  return nullptr;
588  return BR->getDecl();
589  }
590 
591  bool isConversionFromLambda() const {
592  const BlockDecl *BD = getDecl();
593  if (!BD)
594  return false;
595 
596  return BD->isConversionFromLambda();
597  }
598 
599  /// For a block converted from a C++ lambda, returns the block
600  /// VarRegion for the variable holding the captured C++ lambda record.
602  assert(isConversionFromLambda());
603  const BlockDataRegion *BR = getBlockRegion();
604  assert(BR && "Block converted from lambda must have a block region");
605 
606  auto I = BR->referenced_vars_begin();
607  assert(I != BR->referenced_vars_end());
608 
609  return I.getCapturedRegion();
610  }
611 
613  if (!isConversionFromLambda())
614  return RuntimeDefinition(getDecl());
615 
616  // Clang converts lambdas to blocks with an implicit user-defined
617  // conversion operator method on the lambda record that looks (roughly)
618  // like:
619  //
620  // typedef R(^block_type)(P1, P2, ...);
621  // operator block_type() const {
622  // auto Lambda = *this;
623  // return ^(P1 p1, P2 p2, ...){
624  // /* return Lambda(p1, p2, ...); */
625  // };
626  // }
627  //
628  // Here R is the return type of the lambda and P1, P2, ... are
629  // its parameter types. 'Lambda' is a fake VarDecl captured by the block
630  // that is initialized to a copy of the lambda.
631  //
632  // Sema leaves the body of a lambda-converted block empty (it is
633  // produced by CodeGen), so we can't analyze it directly. Instead, we skip
634  // the block body and analyze the operator() method on the captured lambda.
635  const VarDecl *LambdaVD = getRegionStoringCapturedLambda()->getDecl();
636  const CXXRecordDecl *LambdaDecl = LambdaVD->getType()->getAsCXXRecordDecl();
637  CXXMethodDecl* LambdaCallOperator = LambdaDecl->getLambdaCallOperator();
638 
639  return RuntimeDefinition(LambdaCallOperator);
640  }
641 
642  bool argumentsMayEscape() const override {
643  return true;
644  }
645 
646  void getInitialStackFrameContents(const StackFrameContext *CalleeCtx,
647  BindingsTy &Bindings) const override;
648 
649  ArrayRef<ParmVarDecl *> parameters() const override;
650 
651  Kind getKind() const override { return CE_Block; }
652  StringRef getKindAsString() const override { return "BlockCall"; }
653 
654  static bool classof(const CallEvent *CA) { return CA->getKind() == CE_Block; }
655 };
656 
657 /// Represents a non-static C++ member function call, no matter how
658 /// it is written.
660 protected:
662  const LocationContext *LCtx)
663  : AnyFunctionCall(CE, St, LCtx) {}
665  const LocationContext *LCtx)
666  : AnyFunctionCall(D, St, LCtx) {}
667  CXXInstanceCall(const CXXInstanceCall &Other) = default;
668 
670  RegionAndSymbolInvalidationTraits *ETraits) const override;
671 
672 public:
673  /// Returns the expression representing the implicit 'this' object.
674  virtual const Expr *getCXXThisExpr() const { return nullptr; }
675 
676  /// Returns the value of the implicit 'this' object.
677  virtual SVal getCXXThisVal() const;
678 
679  const FunctionDecl *getDecl() const override;
680 
681  RuntimeDefinition getRuntimeDefinition() const override;
682 
683  void getInitialStackFrameContents(const StackFrameContext *CalleeCtx,
684  BindingsTy &Bindings) const override;
685 
686  static bool classof(const CallEvent *CA) {
687  return CA->getKind() >= CE_BEG_CXX_INSTANCE_CALLS &&
689  }
690 };
691 
692 /// Represents a non-static C++ member function call.
693 ///
694 /// Example: \c obj.fun()
696  friend class CallEventManager;
697 
698 protected:
700  const LocationContext *LCtx)
701  : CXXInstanceCall(CE, St, LCtx) {}
702  CXXMemberCall(const CXXMemberCall &Other) = default;
703 
704  void cloneTo(void *Dest) const override { new (Dest) CXXMemberCall(*this); }
705 
706 public:
707  const CXXMemberCallExpr *getOriginExpr() const override {
708  return cast<CXXMemberCallExpr>(CXXInstanceCall::getOriginExpr());
709  }
710 
711  unsigned getNumArgs() const override {
712  if (const CallExpr *CE = getOriginExpr())
713  return CE->getNumArgs();
714  return 0;
715  }
716 
717  const Expr *getArgExpr(unsigned Index) const override {
718  return getOriginExpr()->getArg(Index);
719  }
720 
721  const Expr *getCXXThisExpr() const override;
722 
723  RuntimeDefinition getRuntimeDefinition() const override;
724 
725  Kind getKind() const override { return CE_CXXMember; }
726  StringRef getKindAsString() const override { return "CXXMemberCall"; }
727 
728  static bool classof(const CallEvent *CA) {
729  return CA->getKind() == CE_CXXMember;
730  }
731 };
732 
733 /// Represents a C++ overloaded operator call where the operator is
734 /// implemented as a non-static member function.
735 ///
736 /// Example: <tt>iter + 1</tt>
738  friend class CallEventManager;
739 
740 protected:
742  const LocationContext *LCtx)
743  : CXXInstanceCall(CE, St, LCtx) {}
744  CXXMemberOperatorCall(const CXXMemberOperatorCall &Other) = default;
745 
746  void cloneTo(void *Dest) const override {
747  new (Dest) CXXMemberOperatorCall(*this);
748  }
749 
750 public:
751  const CXXOperatorCallExpr *getOriginExpr() const override {
752  return cast<CXXOperatorCallExpr>(CXXInstanceCall::getOriginExpr());
753  }
754 
755  unsigned getNumArgs() const override {
756  return getOriginExpr()->getNumArgs() - 1;
757  }
758 
759  const Expr *getArgExpr(unsigned Index) const override {
760  return getOriginExpr()->getArg(Index + 1);
761  }
762 
763  const Expr *getCXXThisExpr() const override;
764 
765  Kind getKind() const override { return CE_CXXMemberOperator; }
766  StringRef getKindAsString() const override { return "CXXMemberOperatorCall"; }
767 
768  static bool classof(const CallEvent *CA) {
769  return CA->getKind() == CE_CXXMemberOperator;
770  }
771 
773  getAdjustedParameterIndex(unsigned ASTArgumentIndex) const override {
774  // For member operator calls argument 0 on the expression corresponds
775  // to implicit this-parameter on the declaration.
776  return (ASTArgumentIndex > 0) ? Optional<unsigned>(ASTArgumentIndex - 1)
777  : None;
778  }
779 
780  unsigned getASTArgumentIndex(unsigned CallArgumentIndex) const override {
781  // For member operator calls argument 0 on the expression corresponds
782  // to implicit this-parameter on the declaration.
783  return CallArgumentIndex + 1;
784  }
785 
787  return getOriginExpr()->getOperator();
788  }
789 };
790 
791 /// Represents an implicit call to a C++ destructor.
792 ///
793 /// This can occur at the end of a scope (for automatic objects), at the end
794 /// of a full-expression (for temporaries), or as part of a delete.
796  friend class CallEventManager;
797 
798 protected:
799  using DtorDataTy = llvm::PointerIntPair<const MemRegion *, 1, bool>;
800 
801  /// Creates an implicit destructor.
802  ///
803  /// \param DD The destructor that will be called.
804  /// \param Trigger The statement whose completion causes this destructor call.
805  /// \param Target The object region to be destructed.
806  /// \param St The path-sensitive state at this point in the program.
807  /// \param LCtx The location context at this point in the program.
808  CXXDestructorCall(const CXXDestructorDecl *DD, const Stmt *Trigger,
809  const MemRegion *Target, bool IsBaseDestructor,
810  ProgramStateRef St, const LocationContext *LCtx)
811  : CXXInstanceCall(DD, St, LCtx) {
812  Data = DtorDataTy(Target, IsBaseDestructor).getOpaqueValue();
813  Location = Trigger->getEndLoc();
814  }
815 
816  CXXDestructorCall(const CXXDestructorCall &Other) = default;
817 
818  void cloneTo(void *Dest) const override {new (Dest) CXXDestructorCall(*this);}
819 
820 public:
821  SourceRange getSourceRange() const override { return Location; }
822  unsigned getNumArgs() const override { return 0; }
823 
824  RuntimeDefinition getRuntimeDefinition() const override;
825 
826  /// Returns the value of the implicit 'this' object.
827  SVal getCXXThisVal() const override;
828 
829  /// Returns true if this is a call to a base class destructor.
830  bool isBaseDestructor() const {
831  return DtorDataTy::getFromOpaqueValue(Data).getInt();
832  }
833 
834  Kind getKind() const override { return CE_CXXDestructor; }
835  StringRef getKindAsString() const override { return "CXXDestructorCall"; }
836 
837  static bool classof(const CallEvent *CA) {
838  return CA->getKind() == CE_CXXDestructor;
839  }
840 };
841 
842 /// Represents any constructor invocation. This includes regular constructors
843 /// and inherited constructors.
845 protected:
846  AnyCXXConstructorCall(const Expr *E, const MemRegion *Target,
847  ProgramStateRef St, const LocationContext *LCtx)
848  : AnyFunctionCall(E, St, LCtx) {
849  assert(E && (isa<CXXConstructExpr>(E) || isa<CXXInheritedCtorInitExpr>(E)));
850  // Target may be null when the region is unknown.
851  Data = Target;
852  }
853 
855  RegionAndSymbolInvalidationTraits *ETraits) const override;
856 
857  void getInitialStackFrameContents(const StackFrameContext *CalleeCtx,
858  BindingsTy &Bindings) const override;
859 
860 public:
861  /// Returns the value of the implicit 'this' object.
862  SVal getCXXThisVal() const;
863 
864  static bool classof(const CallEvent *Call) {
865  return Call->getKind() >= CE_BEG_CXX_CONSTRUCTOR_CALLS &&
866  Call->getKind() <= CE_END_CXX_CONSTRUCTOR_CALLS;
867  }
868 };
869 
870 /// Represents a call to a C++ constructor.
871 ///
872 /// Example: \c T(1)
874  friend class CallEventManager;
875 
876 protected:
877  /// Creates a constructor call.
878  ///
879  /// \param CE The constructor expression as written in the source.
880  /// \param Target The region where the object should be constructed. If NULL,
881  /// a new symbolic region will be used.
882  /// \param St The path-sensitive state at this point in the program.
883  /// \param LCtx The location context at this point in the program.
885  ProgramStateRef St, const LocationContext *LCtx)
886  : AnyCXXConstructorCall(CE, Target, St, LCtx) {}
887 
888  CXXConstructorCall(const CXXConstructorCall &Other) = default;
889 
890  void cloneTo(void *Dest) const override { new (Dest) CXXConstructorCall(*this); }
891 
892 public:
893  const CXXConstructExpr *getOriginExpr() const override {
894  return cast<CXXConstructExpr>(AnyFunctionCall::getOriginExpr());
895  }
896 
897  const CXXConstructorDecl *getDecl() const override {
898  return getOriginExpr()->getConstructor();
899  }
900 
901  unsigned getNumArgs() const override { return getOriginExpr()->getNumArgs(); }
902 
903  const Expr *getArgExpr(unsigned Index) const override {
904  return getOriginExpr()->getArg(Index);
905  }
906 
907  Kind getKind() const override { return CE_CXXConstructor; }
908  StringRef getKindAsString() const override { return "CXXConstructorCall"; }
909 
910  static bool classof(const CallEvent *CA) {
911  return CA->getKind() == CE_CXXConstructor;
912  }
913 };
914 
915 /// Represents a call to a C++ inherited constructor.
916 ///
917 /// Example: \c class T : public S { using S::S; }; T(1);
918 ///
919 // Note, it is difficult to model the parameters. This is one of the reasons
920 // why we skip analysis of inheriting constructors as top-level functions.
921 // CXXInheritedCtorInitExpr doesn't take arguments and doesn't model parameter
922 // initialization because there is none: the arguments in the outer
923 // CXXConstructExpr directly initialize the parameters of the base class
924 // constructor, and no copies are made. (Making a copy of the parameter is
925 // incorrect, at least if it's done in an observable way.) The derived class
926 // constructor doesn't even exist in the formal model.
927 /// E.g., in:
928 ///
929 /// struct X { X *p = this; ~X() {} };
930 /// struct A { A(X x) : b(x.p == &x) {} bool b; };
931 /// struct B : A { using A::A; };
932 /// B b = X{};
933 ///
934 /// ... b.b is initialized to true.
936  friend class CallEventManager;
937 
938 protected:
940  const MemRegion *Target, ProgramStateRef St,
941  const LocationContext *LCtx)
942  : AnyCXXConstructorCall(CE, Target, St, LCtx) {}
943 
945  default;
946 
947  void cloneTo(void *Dest) const override {
948  new (Dest) CXXInheritedConstructorCall(*this);
949  }
950 
951 public:
952  const CXXInheritedCtorInitExpr *getOriginExpr() const override {
953  return cast<CXXInheritedCtorInitExpr>(AnyFunctionCall::getOriginExpr());
954  }
955 
956  const CXXConstructorDecl *getDecl() const override {
957  return getOriginExpr()->getConstructor();
958  }
959 
960  /// Obtain the stack frame of the inheriting constructor. Argument expressions
961  /// can be found on the call site of that stack frame.
963 
964  /// Obtain the CXXConstructExpr for the sub-class that inherited the current
965  /// constructor (possibly indirectly). It's the statement that contains
966  /// argument expressions.
968  return cast<CXXConstructExpr>(getInheritingStackFrame()->getCallSite());
969  }
970 
971  unsigned getNumArgs() const override {
973  }
974 
975  const Expr *getArgExpr(unsigned Index) const override {
976  return getInheritingConstructor()->getArg(Index);
977  }
978 
979  SVal getArgSVal(unsigned Index) const override {
980  return getState()->getSVal(
981  getArgExpr(Index),
982  getInheritingStackFrame()->getParent()->getStackFrame());
983  }
984 
985  Kind getKind() const override { return CE_CXXInheritedConstructor; }
986  StringRef getKindAsString() const override {
987  return "CXXInheritedConstructorCall";
988  }
989 
990  static bool classof(const CallEvent *CA) {
991  return CA->getKind() == CE_CXXInheritedConstructor;
992  }
993 };
994 
995 /// Represents the memory allocation call in a C++ new-expression.
996 ///
997 /// This is a call to "operator new".
999  friend class CallEventManager;
1000 
1001 protected:
1003  const LocationContext *LCtx)
1004  : AnyFunctionCall(E, St, LCtx) {}
1005  CXXAllocatorCall(const CXXAllocatorCall &Other) = default;
1006 
1007  void cloneTo(void *Dest) const override { new (Dest) CXXAllocatorCall(*this); }
1008 
1009 public:
1010  const CXXNewExpr *getOriginExpr() const override {
1011  return cast<CXXNewExpr>(AnyFunctionCall::getOriginExpr());
1012  }
1013 
1014  const FunctionDecl *getDecl() const override {
1015  return getOriginExpr()->getOperatorNew();
1016  }
1017 
1021  .getValue();
1022  }
1023 
1024  /// Number of non-placement arguments to the call. It is equal to 2 for
1025  /// C++17 aligned operator new() calls that have alignment implicitly
1026  /// passed as the second argument, and to 1 for other operator new() calls.
1027  unsigned getNumImplicitArgs() const {
1028  return getOriginExpr()->passAlignment() ? 2 : 1;
1029  }
1030 
1031  unsigned getNumArgs() const override {
1033  }
1034 
1035  const Expr *getArgExpr(unsigned Index) const override {
1036  // The first argument of an allocator call is the size of the allocation.
1037  if (Index < getNumImplicitArgs())
1038  return nullptr;
1039  return getOriginExpr()->getPlacementArg(Index - getNumImplicitArgs());
1040  }
1041 
1042  /// Number of placement arguments to the operator new() call. For example,
1043  /// standard std::nothrow operator new and standard placement new both have
1044  /// 1 implicit argument (size) and 1 placement argument, while regular
1045  /// operator new() has 1 implicit argument and 0 placement arguments.
1046  const Expr *getPlacementArgExpr(unsigned Index) const {
1047  return getOriginExpr()->getPlacementArg(Index);
1048  }
1049 
1050  Kind getKind() const override { return CE_CXXAllocator; }
1051  StringRef getKindAsString() const override { return "CXXAllocatorCall"; }
1052 
1053  static bool classof(const CallEvent *CE) {
1054  return CE->getKind() == CE_CXXAllocator;
1055  }
1056 };
1057 
1058 /// Represents the memory deallocation call in a C++ delete-expression.
1059 ///
1060 /// This is a call to "operator delete".
1061 // FIXME: CXXDeleteExpr isn't present for custom delete operators, or even for
1062 // some those that are in the standard library, like the no-throw or align_val
1063 // versions.
1064 // Some pointers:
1065 // http://lists.llvm.org/pipermail/cfe-dev/2020-April/065080.html
1066 // clang/test/Analysis/cxx-dynamic-memory-analysis-order.cpp
1067 // clang/unittests/StaticAnalyzer/CallEventTest.cpp
1069  friend class CallEventManager;
1070 
1071 protected:
1073  const LocationContext *LCtx)
1074  : AnyFunctionCall(E, St, LCtx) {}
1075  CXXDeallocatorCall(const CXXDeallocatorCall &Other) = default;
1076 
1077  void cloneTo(void *Dest) const override {
1078  new (Dest) CXXDeallocatorCall(*this);
1079  }
1080 
1081 public:
1082  const CXXDeleteExpr *getOriginExpr() const override {
1083  return cast<CXXDeleteExpr>(AnyFunctionCall::getOriginExpr());
1084  }
1085 
1086  const FunctionDecl *getDecl() const override {
1087  return getOriginExpr()->getOperatorDelete();
1088  }
1089 
1090  unsigned getNumArgs() const override { return getDecl()->getNumParams(); }
1091 
1092  const Expr *getArgExpr(unsigned Index) const override {
1093  // CXXDeleteExpr's only have a single argument.
1094  return getOriginExpr()->getArgument();
1095  }
1096 
1097  Kind getKind() const override { return CE_CXXDeallocator; }
1098  StringRef getKindAsString() const override { return "CXXDeallocatorCall"; }
1099 
1100  static bool classof(const CallEvent *CE) {
1101  return CE->getKind() == CE_CXXDeallocator;
1102  }
1103 };
1104 
1105 /// Represents the ways an Objective-C message send can occur.
1106 //
1107 // Note to maintainers: OCM_Message should always be last, since it does not
1108 // need to fit in the Data field's low bits.
1113 };
1114 
1115 /// Represents any expression that calls an Objective-C method.
1116 ///
1117 /// This includes all of the kinds listed in ObjCMessageKind.
1118 class ObjCMethodCall : public CallEvent {
1119  friend class CallEventManager;
1120 
1121  const PseudoObjectExpr *getContainingPseudoObjectExpr() const;
1122 
1123 protected:
1125  const LocationContext *LCtx)
1126  : CallEvent(Msg, St, LCtx) {
1127  Data = nullptr;
1128  }
1129 
1130  ObjCMethodCall(const ObjCMethodCall &Other) = default;
1131 
1132  void cloneTo(void *Dest) const override { new (Dest) ObjCMethodCall(*this); }
1133 
1134  void getExtraInvalidatedValues(ValueList &Values,
1135  RegionAndSymbolInvalidationTraits *ETraits) const override;
1136 
1137  /// Check if the selector may have multiple definitions (may have overrides).
1138  virtual bool canBeOverridenInSubclass(ObjCInterfaceDecl *IDecl,
1139  Selector Sel) const;
1140 
1141 public:
1142  const ObjCMessageExpr *getOriginExpr() const override {
1143  return cast<ObjCMessageExpr>(CallEvent::getOriginExpr());
1144  }
1145 
1146  const ObjCMethodDecl *getDecl() const override {
1147  return getOriginExpr()->getMethodDecl();
1148  }
1149 
1150  unsigned getNumArgs() const override {
1151  return getOriginExpr()->getNumArgs();
1152  }
1153 
1154  const Expr *getArgExpr(unsigned Index) const override {
1155  return getOriginExpr()->getArg(Index);
1156  }
1157 
1158  bool isInstanceMessage() const {
1159  return getOriginExpr()->isInstanceMessage();
1160  }
1161 
1163  return getOriginExpr()->getMethodFamily();
1164  }
1165 
1167  return getOriginExpr()->getSelector();
1168  }
1169 
1170  SourceRange getSourceRange() const override;
1171 
1172  /// Returns the value of the receiver at the time of this call.
1173  SVal getReceiverSVal() const;
1174 
1175  /// Get the interface for the receiver.
1176  ///
1177  /// This works whether this is an instance message or a class message.
1178  /// However, it currently just uses the static type of the receiver.
1180  return getOriginExpr()->getReceiverInterface();
1181  }
1182 
1183  /// Checks if the receiver refers to 'self' or 'super'.
1184  bool isReceiverSelfOrSuper() const;
1185 
1186  /// Returns how the message was written in the source (property access,
1187  /// subscript, or explicit message send).
1189 
1190  /// Returns true if this property access or subscript is a setter (has the
1191  /// form of an assignment).
1192  bool isSetter() const {
1193  switch (getMessageKind()) {
1194  case OCM_Message:
1195  llvm_unreachable("This is not a pseudo-object access!");
1196  case OCM_PropertyAccess:
1197  return getNumArgs() > 0;
1198  case OCM_Subscript:
1199  return getNumArgs() > 1;
1200  }
1201  llvm_unreachable("Unknown message kind");
1202  }
1203 
1204  // Returns the property accessed by this method, either explicitly via
1205  // property syntax or implicitly via a getter or setter method. Returns
1206  // nullptr if the call is not a prooperty access.
1207  const ObjCPropertyDecl *getAccessedProperty() const;
1208 
1209  RuntimeDefinition getRuntimeDefinition() const override;
1210 
1211  bool argumentsMayEscape() const override;
1212 
1213  void getInitialStackFrameContents(const StackFrameContext *CalleeCtx,
1214  BindingsTy &Bindings) const override;
1215 
1216  ArrayRef<ParmVarDecl*> parameters() const override;
1217 
1218  Kind getKind() const override { return CE_ObjCMessage; }
1219  StringRef getKindAsString() const override { return "ObjCMethodCall"; }
1220 
1221  static bool classof(const CallEvent *CA) {
1222  return CA->getKind() == CE_ObjCMessage;
1223  }
1224 };
1225 
1226 /// Manages the lifetime of CallEvent objects.
1227 ///
1228 /// CallEventManager provides a way to create arbitrary CallEvents "on the
1229 /// stack" as if they were value objects by keeping a cache of CallEvent-sized
1230 /// memory blocks. The CallEvents created by CallEventManager are only valid
1231 /// for the lifetime of the OwnedCallEvent that holds them; right now these
1232 /// objects cannot be copied and ownership cannot be transferred.
1234  friend class CallEvent;
1235 
1236  llvm::BumpPtrAllocator &Alloc;
1238 
1240 
1241  void reclaim(const void *Memory) {
1242  Cache.push_back(const_cast<void *>(Memory));
1243  }
1244 
1245  /// Returns memory that can be initialized as a CallEvent.
1246  void *allocate() {
1247  if (Cache.empty())
1248  return Alloc.Allocate<CallEventTemplateTy>();
1249  else
1250  return Cache.pop_back_val();
1251  }
1252 
1253  template <typename T, typename Arg>
1254  T *create(Arg A, ProgramStateRef St, const LocationContext *LCtx) {
1255  static_assert(sizeof(T) == sizeof(CallEventTemplateTy),
1256  "CallEvent subclasses are not all the same size");
1257  return new (allocate()) T(A, St, LCtx);
1258  }
1259 
1260  template <typename T, typename Arg1, typename Arg2>
1261  T *create(Arg1 A1, Arg2 A2, ProgramStateRef St, const LocationContext *LCtx) {
1262  static_assert(sizeof(T) == sizeof(CallEventTemplateTy),
1263  "CallEvent subclasses are not all the same size");
1264  return new (allocate()) T(A1, A2, St, LCtx);
1265  }
1266 
1267  template <typename T, typename Arg1, typename Arg2, typename Arg3>
1268  T *create(Arg1 A1, Arg2 A2, Arg3 A3, ProgramStateRef St,
1269  const LocationContext *LCtx) {
1270  static_assert(sizeof(T) == sizeof(CallEventTemplateTy),
1271  "CallEvent subclasses are not all the same size");
1272  return new (allocate()) T(A1, A2, A3, St, LCtx);
1273  }
1274 
1275  template <typename T, typename Arg1, typename Arg2, typename Arg3,
1276  typename Arg4>
1277  T *create(Arg1 A1, Arg2 A2, Arg3 A3, Arg4 A4, ProgramStateRef St,
1278  const LocationContext *LCtx) {
1279  static_assert(sizeof(T) == sizeof(CallEventTemplateTy),
1280  "CallEvent subclasses are not all the same size");
1281  return new (allocate()) T(A1, A2, A3, A4, St, LCtx);
1282  }
1283 
1284 public:
1285  CallEventManager(llvm::BumpPtrAllocator &alloc) : Alloc(alloc) {}
1286 
1287  /// Gets an outside caller given a callee context.
1289  getCaller(const StackFrameContext *CalleeCtx, ProgramStateRef State);
1290 
1291  /// Gets a call event for a function call, Objective-C method call,
1292  /// a 'new', or a 'delete' call.
1294  getCall(const Stmt *S, ProgramStateRef State,
1295  const LocationContext *LC);
1296 
1299  const LocationContext *LCtx);
1300 
1303  const LocationContext *LCtx) {
1304  return create<ObjCMethodCall>(E, State, LCtx);
1305  }
1306 
1309  ProgramStateRef State, const LocationContext *LCtx) {
1310  return create<CXXConstructorCall>(E, Target, State, LCtx);
1311  }
1312 
1315  const MemRegion *Target, ProgramStateRef State,
1316  const LocationContext *LCtx) {
1317  return create<CXXInheritedConstructorCall>(E, Target, State, LCtx);
1318  }
1319 
1321  getCXXDestructorCall(const CXXDestructorDecl *DD, const Stmt *Trigger,
1322  const MemRegion *Target, bool IsBase,
1323  ProgramStateRef State, const LocationContext *LCtx) {
1324  return create<CXXDestructorCall>(DD, Trigger, Target, IsBase, State, LCtx);
1325  }
1326 
1329  const LocationContext *LCtx) {
1330  return create<CXXAllocatorCall>(E, State, LCtx);
1331  }
1332 
1335  const LocationContext *LCtx) {
1336  return create<CXXDeallocatorCall>(E, State, LCtx);
1337  }
1338 };
1339 
1340 template <typename T>
1342  assert(isa<T>(*this) && "Cloning to unrelated type");
1343  static_assert(sizeof(T) == sizeof(CallEvent),
1344  "Subclasses may not add fields");
1345 
1346  if (NewState == State)
1347  return cast<T>(this);
1348 
1349  CallEventManager &Mgr = State->getStateManager().getCallEventManager();
1350  T *Copy = static_cast<T *>(Mgr.allocate());
1351  cloneTo(Copy);
1352  assert(Copy->getKind() == this->getKind() && "Bad copy");
1353 
1354  Copy->State = NewState;
1355  return Copy;
1356 }
1357 
1358 inline void CallEvent::Release() const {
1359  assert(RefCount > 0 && "Reference count is already zero.");
1360  --RefCount;
1361 
1362  if (RefCount > 0)
1363  return;
1364 
1365  CallEventManager &Mgr = State->getStateManager().getCallEventManager();
1366  Mgr.reclaim(this);
1367 
1368  this->~CallEvent();
1369 }
1370 
1371 } // namespace ento
1372 
1373 } // namespace clang
1374 
1375 namespace llvm {
1376 
1377 // Support isa<>, cast<>, and dyn_cast<> for CallEventRef.
1378 template<class T> struct simplify_type< clang::ento::CallEventRef<T>> {
1379  using SimpleType = const T *;
1380 
1381  static SimpleType
1383  return Val.get();
1384  }
1385 };
1386 
1387 } // namespace llvm
1388 
1389 #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:759
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:558
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:862
clang::ento::CXXDeallocatorCall::getKind
Kind getKind() const override
Returns the kind of call this is.
Definition: CallEvent.h:1097
clang::ObjCInterfaceDecl
Represents an ObjC class declaration.
Definition: DeclObjC.h:1150
clang::CXXNewExpr::passAlignment
bool passAlignment() const
Indicates whether the required alignment should be implicitly passed to the allocation function.
Definition: ExprCXX.h:2349
clang::ento::ObjCMethodCall::getNumArgs
unsigned getNumArgs() const override
Returns the number of arguments (explicit and implicit).
Definition: CallEvent.h:1150
clang::ento::CXXDeallocatorCall::getOriginExpr
const CXXDeleteExpr * getOriginExpr() const override
Returns the expression whose value will be the result of this call.
Definition: CallEvent.h:1082
clang::ento::CXXConstructorCall::getKindAsString
StringRef getKindAsString() const override
Definition: CallEvent.h:908
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:819
clang::ento::CXXAllocatorCall::getKindAsString
StringRef getKindAsString() const override
Definition: CallEvent.h:1051
clang::ento::CXXInheritedConstructorCall::getNumArgs
unsigned getNumArgs() const override
Returns the number of arguments (explicit and implicit).
Definition: CallEvent.h:971
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:1001
clang::ento::AnyFunctionCall
Represents a call to any sort of function that might have a FunctionDecl.
Definition: CallEvent.h:482
llvm
YAML serialization mapping.
Definition: Dominators.h:30
clang::CXXConstructorDecl
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2421
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:1413
clang::ento::CXXMemberCall::getOriginExpr
const CXXMemberCallExpr * getOriginExpr() const override
Returns the expression whose value will be the result of this call.
Definition: CallEvent.h:707
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:808
clang::FunctionDecl::getNumParams
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
Definition: Decl.cpp:3442
clang::ento::ObjCMethodCall::getOriginExpr
const ObjCMessageExpr * getOriginExpr() const override
Returns the expression whose value will be the result of this call.
Definition: CallEvent.h:1142
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:871
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:1111
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:1321
SVals.h
clang::ento::CXXConstructorCall::getNumArgs
unsigned getNumArgs() const override
Returns the number of arguments (explicit and implicit).
Definition: CallEvent.h:901
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:690
clang::ento::BlockDataRegion::getDecl
const BlockDecl * getDecl() const
Definition: MemRegion.h:690
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:826
clang::ento::CXXConstructorCall::getKind
Kind getKind() const override
Returns the kind of call this is.
Definition: CallEvent.h:907
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:975
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:818
clang::ento::CXXMemberCall::getKindAsString
StringRef getKindAsString() const override
Definition: CallEvent.h:726
clang::CXXConstructExpr::getNumArgs
unsigned getNumArgs() const
Return the number of arguments to the constructor call.
Definition: ExprCXX.h:1608
clang::ento::CallEvent::~CallEvent
virtual ~CallEvent()=default
clang::ento::CXXInheritedConstructorCall::classof
static bool classof(const CallEvent *CA)
Definition: CallEvent.h:990
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:1678
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:1334
clang::ento::AnyFunctionCall::getRuntimeDefinition
RuntimeDefinition getRuntimeDefinition() const override
Returns the definition of the function or method that will be called.
Definition: CallEvent.cpp:501
clang::ento::CXXDeallocatorCall::getKindAsString
StringRef getKindAsString() const override
Definition: CallEvent.h:1098
clang::CXXNewExpr::getNumPlacementArgs
unsigned getNumPlacementArgs() const
Definition: ExprCXX.h:2292
clang::MultiVersionKind::Target
@ Target
clang::CXXNewExpr::getOperatorNew
FunctionDecl * getOperatorNew() const
Definition: ExprCXX.h:2257
clang::ento::CXXDestructorCall::classof
static bool classof(const CallEvent *CA)
Definition: CallEvent.h:837
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:1090
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:675
clang::ConstructionContext
ConstructionContext's subclasses describe different ways of constructing an object in C++.
Definition: ConstructionContext.h:237
clang::ento::BlockCall::getArgExpr
const Expr * getArgExpr(unsigned Index) const override
Returns the expression associated with a given argument.
Definition: CallEvent.h:575
clang::ento::CXXMemberCall::getNumArgs
unsigned getNumArgs() const override
Returns the number of arguments (explicit and implicit).
Definition: CallEvent.h:711
clang::ento::CallEventManager::getObjCMethodCall
CallEventRef< ObjCMethodCall > getObjCMethodCall(const ObjCMessageExpr *E, ProgramStateRef State, const LocationContext *LCtx)
Definition: CallEvent.h:1302
clang::ento::CXXInstanceCall::CXXInstanceCall
CXXInstanceCall(const CallExpr *CE, ProgramStateRef St, const LocationContext *LCtx)
Definition: CallEvent.h:661
clang::ento::CXXDestructorCall::DtorDataTy
llvm::PointerIntPair< const MemRegion *, 1, bool > DtorDataTy
Definition: CallEvent.h:799
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:484
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:1686
clang::ento::ObjCMethodCall::getReceiverSVal
SVal getReceiverSVal() const
Returns the value of the receiver at the time of this call.
Definition: CallEvent.cpp:940
clang::ParmVarDecl
Represents a parameter to a function.
Definition: Decl.h:1680
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:1124
clang::CXXNewExpr
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
Definition: ExprCXX.h:2139
llvm::Optional< bool >
clang::ento::CallEventRef::CallEventRef
CallEventRef(const CallEventRef &Orig)
Definition: CallEvent.h:84
clang::ento::CallEvent::param_type_end
param_type_iterator param_type_end() const
Definition: CallEvent.h:471
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:463
clang::StackFrameContext
It represents a stack frame of the call stack (based on CallEvent).
Definition: AnalysisDeclContext.h:295
SourceManager.h
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:563
clang::ento::CXXDestructorCall::getKind
Kind getKind() const override
Returns the kind of call this is.
Definition: CallEvent.h:834
clang::ento::ObjCMethodCall::getAccessedProperty
const ObjCPropertyDecl * getAccessedProperty() const
Definition: CallEvent.cpp:1045
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:979
clang::ento::CXXAllocatorCall::getDecl
const FunctionDecl * getDecl() const override
Returns the declaration of the function or method that will be called.
Definition: CallEvent.h:1014
clang::ento::AnyCXXConstructorCall::AnyCXXConstructorCall
AnyCXXConstructorCall(const Expr *E, const MemRegion *Target, ProgramStateRef St, const LocationContext *LCtx)
Definition: CallEvent.h:846
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:481
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:1379
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:903
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:627
clang::ento::ObjCMethodCall::getRuntimeDefinition
RuntimeDefinition getRuntimeDefinition() const override
Returns the definition of the function or method that will be called.
Definition: CallEvent.cpp:1207
clang::CXXRecordDecl::getLambdaCallOperator
CXXMethodDecl * getLambdaCallOperator() const
Retrieve the lambda call operator of the closure type if this is a closure type.
Definition: DeclCXX.cpp:1511
clang::ento::CXXDestructorCall::getSourceRange
SourceRange getSourceRange() const override
Returns a source range for the entire call, suitable for outputting in diagnostics.
Definition: CallEvent.h:821
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:704
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:645
clang::ento::MemRegion
MemRegion - The root abstract class for all memory regions.
Definition: MemRegion.h:94
clang::ento::CXXConstructorCall::getDecl
const CXXConstructorDecl * getDecl() const override
Returns the declaration of the function or method that will be called.
Definition: CallEvent.h:897
clang::ento::CXXMemberOperatorCall::getKind
Kind getKind() const override
Returns the kind of call this is.
Definition: CallEvent.h:765
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::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:1146
clang::ento::CXXConstructorCall::classof
static bool classof(const CallEvent *CA)
Definition: CallEvent.h:910
clang::ento::BlockCall::getNumArgs
unsigned getNumArgs() const override
Returns the number of arguments (explicit and implicit).
Definition: CallEvent.h:573
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:1166
clang::ento::SimpleFunctionCall::getKind
Kind getKind() const override
Returns the kind of call this is.
Definition: CallEvent.h:543
clang::ento::OCM_PropertyAccess
@ OCM_PropertyAccess
Definition: CallEvent.h:1110
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:569
clang::ento::CXXMemberOperatorCall::getCXXThisExpr
const Expr * getCXXThisExpr() const override
Returns the expression representing the implicit 'this' object.
Definition: CallEvent.cpp:808
clang::ento::CXXConstructorCall
Represents a call to a C++ constructor.
Definition: CallEvent.h:873
clang::BlockDecl
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:4201
clang::ento::CXXDestructorCall::getKindAsString
StringRef getKindAsString() const override
Definition: CallEvent.h:835
clang::ento::CXXInstanceCall::getCXXThisExpr
virtual const Expr * getCXXThisExpr() const
Returns the expression representing the implicit 'this' object.
Definition: CallEvent.h:674
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:1072
llvm::simplify_type< clang::ento::CallEventRef< T > >::getSimplifiedValue
static SimpleType getSimplifiedValue(clang::ento::CallEventRef< T > Val)
Definition: CallEvent.h:1382
clang::ento::SimpleFunctionCall::getNumArgs
unsigned getNumArgs() const override
Returns the number of arguments (explicit and implicit).
Definition: CallEvent.h:537
clang::ento::ObjCMethodCall::getArgExpr
const Expr * getArgExpr(unsigned Index) const override
Returns the expression associated with a given argument.
Definition: CallEvent.h:1154
clang::ento::ObjCMethodCall::isReceiverSelfOrSuper
bool isReceiverSelfOrSuper() const
Checks if the receiver refers to 'self' or 'super'.
Definition: CallEvent.cpp:956
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:432
clang::ento::CXXMemberCall::getRuntimeDefinition
RuntimeDefinition getRuntimeDefinition() const override
Returns the definition of the function or method that will be called.
Definition: CallEvent.cpp:796
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:947
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:833
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:812
clang::ento::CallEventKind
CallEventKind
Definition: CallEvent.h:59
clang::CallExpr::getArg
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
Definition: Expr.h:2992
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:1132
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:746
clang::ento::BlockCall::getKind
Kind getKind() const override
Returns the kind of call this is.
Definition: CallEvent.h:651
clang::ento::CXXAllocatorCall::getOriginExpr
const CXXNewExpr * getOriginExpr() const override
Returns the expression whose value will be the result of this call.
Definition: CallEvent.h:1010
clang::ento::CXXMemberOperatorCall::getOriginExpr
const CXXOperatorCallExpr * getOriginExpr() const override
Returns the expression whose value will be the result of this call.
Definition: CallEvent.h:751
clang::PseudoObjectExpr
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Definition: Expr.h:6100
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:466
clang::Stmt::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.cpp:348
clang::CXXDestructorDecl
Represents a C++ destructor within a class.
Definition: DeclCXX.h:2688
clang::ento::BlockDataRegion
BlockDataRegion - A region that represents a block instance.
Definition: MemRegion.h:663
IdentifierTable.h
clang::ento::CallEventManager::getCXXInheritedConstructorCall
CallEventRef< CXXInheritedConstructorCall > getCXXInheritedConstructorCall(const CXXInheritedCtorInitExpr *E, const MemRegion *Target, ProgramStateRef State, const LocationContext *LCtx)
Definition: CallEvent.h:1314
clang::ento::VarRegion
Definition: MemRegion.h:907
clang::ento::CallEventManager::getCXXConstructorCall
CallEventRef< CXXConstructorCall > getCXXConstructorCall(const CXXConstructExpr *E, const MemRegion *Target, ProgramStateRef State, const LocationContext *LCtx)
Definition: CallEvent.h:1308
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:751
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:856
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:998
ValueList
ArrayRef< SVal > ValueList
Definition: ProgramState.cpp:147
clang::VarDecl
Represents a variable declaration or definition.
Definition: Decl.h:874
clang::CXXDeleteExpr::getOperatorDelete
FunctionDecl * getOperatorDelete() const
Definition: ExprCXX.h:2454
clang::CXXConstructExpr::getConstructor
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will (ultimately) call.
Definition: ExprCXX.h:1532
clang::ento::SimpleFunctionCall::classof
static bool classof(const CallEvent *CA)
Definition: CallEvent.h:546
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:1759
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:1328
clang::ento::CXXAllocatorCall::getObjectUnderConstruction
SVal getObjectUnderConstruction() const
Definition: CallEvent.h:1018
ExprObjC.h
clang::ento::ObjCMethodCall::getKindAsString
StringRef getKindAsString() const override
Definition: CallEvent.h:1219
ExprCXX.h
clang::CXXInheritedCtorInitExpr
Represents a call to an inherited base class constructor from an inheriting constructor.
Definition: ExprCXX.h:1651
clang::ento::CXXAllocatorCall::CXXAllocatorCall
CXXAllocatorCall(const CXXNewExpr *E, ProgramStateRef St, const LocationContext *LCtx)
Definition: CallEvent.h:1002
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:1360
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:899
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:1341
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:676
clang::ento::ObjCMethodCall::getMethodFamily
ObjCMethodFamily getMethodFamily() const
Definition: CallEvent.h:1162
clang::ento::RuntimeDefinition::RuntimeDefinition
RuntimeDefinition()=default
clang::ento::CallEventManager::getSimpleCall
CallEventRef getSimpleCall(const CallExpr *E, ProgramStateRef State, const LocationContext *LCtx)
Definition: CallEvent.cpp:1339
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:555
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:915
clang::ento::Loc
Definition: SVals.h:326
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:1179
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:780
clang::ento::CXXAllocatorCall::getKind
Kind getKind() const override
Returns the kind of call this is.
Definition: CallEvent.h:1050
clang::ento::BlockCall::getKindAsString
StringRef getKindAsString() const override
Definition: CallEvent.h:652
clang::ento::CXXMemberOperatorCall::getKindAsString
StringRef getKindAsString() const override
Definition: CallEvent.h:766
clang::ento::CXXInheritedConstructorCall::getOriginExpr
const CXXInheritedCtorInitExpr * getOriginExpr() const override
Returns the expression whose value will be the result of this call.
Definition: CallEvent.h:952
clang::ento::CXXInheritedConstructorCall::CXXInheritedConstructorCall
CXXInheritedConstructorCall(const CXXInheritedCtorInitExpr *CE, const MemRegion *Target, ProgramStateRef St, const LocationContext *LCtx)
Definition: CallEvent.h:939
clang::ento::AnyFunctionCall::classof
static bool classof(const CallEvent *CA)
Definition: CallEvent.h:508
clang::ento::CXXConstructorCall::CXXConstructorCall
CXXConstructorCall(const CXXConstructExpr *CE, const MemRegion *Target, ProgramStateRef St, const LocationContext *LCtx)
Creates a constructor call.
Definition: CallEvent.h:884
clang::ento::BlockCall::isConversionFromLambda
bool isConversionFromLambda() const
Definition: CallEvent.h:591
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:935
clang::ento::CXXInstanceCall
Represents a non-static C++ member function call, no matter how it is written.
Definition: CallEvent.h:659
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:1233
clang::ento::ObjCMessageKind
ObjCMessageKind
Represents the ways an Objective-C message send can occur.
Definition: CallEvent.h:1109
clang::ento::ObjCMethodCall::classof
static bool classof(const CallEvent *CA)
Definition: CallEvent.h:1221
clang::ento::CE_CXXMemberOperator
@ CE_CXXMemberOperator
Definition: CallEvent.h:62
Cache
TypePropertyCache< Private > Cache
Definition: Type.cpp:3879
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:893
clang::ento::CallEvent::param_type_iterator
llvm::mapped_iterator< ArrayRef< ParmVarDecl * >::iterator, GetTypeFn > param_type_iterator
Definition: CallEvent.h:460
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:487
clang::ento::CXXAllocatorCall::getPlacementArgExpr
const Expr * getPlacementArgExpr(unsigned Index) const
Number of placement arguments to the operator new() call.
Definition: CallEvent.h:1046
clang::CallExpr::getNumArgs
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
Definition: Expr.h:2979
clang::CXXDeleteExpr
Represents a delete expression for memory deallocation and destructor calls, e.g.
Definition: ExprCXX.h:2415
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:467
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:1007
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:1067
clang::ento::SimpleFunctionCall::getOriginExpr
const CallExpr * getOriginExpr() const override
Returns the expression whose value will be the result of this call.
Definition: CallEvent.h:531
clang::ento::CXXDeallocatorCall::classof
static bool classof(const CallEvent *CE)
Definition: CallEvent.h:1100
clang::ento::CXXMemberCall::getArgExpr
const Expr * getArgExpr(unsigned Index) const override
Returns the expression associated with a given argument.
Definition: CallEvent.h:717
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:970
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:425
clang::ento::CallEvent::getKindAsString
virtual StringRef getKindAsString() const =0
clang::ento::CallEventManager::CallEventManager
CallEventManager(llvm::BumpPtrAllocator &alloc)
Definition: CallEvent.h:1285
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:1077
State
LineState State
Definition: UnwrappedLineFormatter.cpp:1090
clang::ento::CXXInstanceCall::classof
static bool classof(const CallEvent *CA)
Definition: CallEvent.h:686
clang::ento::SimpleFunctionCall::getDecl
const FunctionDecl * getDecl() const override
Returns the declaration of the function or method that will be called.
Definition: CallEvent.cpp:625
clang::ento::CXXMemberOperatorCall::CXXMemberOperatorCall
CXXMemberOperatorCall(const CXXOperatorCallExpr *CE, ProgramStateRef St, const LocationContext *LCtx)
Definition: CallEvent.h:741
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:544
clang::ento::ObjCMethodCall
Represents any expression that calls an Objective-C method.
Definition: CallEvent.h:1118
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::CXXMemberOperatorCall::getOverloadedOperator
OverloadedOperatorKind getOverloadedOperator() const
Definition: CallEvent.h:786
clang::IdentifierInfo
One of these records is kept for each identifier that is lexed.
Definition: IdentifierTable.h:84
clang::ento::BlockDataRegion::referenced_vars_end
referenced_vars_iterator referenced_vars_end() const
Definition: MemRegion.cpp:1694
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:642
clang::ento::CXXAllocatorCall::getArgExpr
const Expr * getArgExpr(unsigned Index) const override
Returns the expression associated with a given argument.
Definition: CallEvent.h:1035
clang::ento::BlockCall::getRuntimeDefinition
RuntimeDefinition getRuntimeDefinition() const override
Returns the definition of the function or method that will be called.
Definition: CallEvent.h:612
clang::ento::CXXMemberCall::getCXXThisExpr
const Expr * getCXXThisExpr() const override
Returns the expression representing the implicit 'this' object.
Definition: CallEvent.cpp:792
clang::ento::ObjCMethodCall::isInstanceMessage
bool isInstanceMessage() const
Definition: CallEvent.h:1158
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:494
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:1192
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:554
std
Definition: Format.h:4296
clang::ento::BlockCall::getDecl
const BlockDecl * getDecl() const override
Returns the declaration of the function or method that will be called.
Definition: CallEvent.h:584
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:908
clang::ento::ObjCMethodCall::getKind
Kind getKind() const override
Returns the kind of call this is.
Definition: CallEvent.h:1218
clang::ento::OCM_Message
@ OCM_Message
Definition: CallEvent.h:1112
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:752
clang::Stmt
Stmt - This represents one statement.
Definition: Stmt.h:69
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:526
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:564
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:539
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:521
clang::ento::CXXMemberOperatorCall
Represents a C++ overloaded operator call where the operator is implemented as a non-static member fu...
Definition: CallEvent.h:737
clang::CXXDeleteExpr::getArgument
Expr * getArgument()
Definition: ExprCXX.h:2456
clang::ento::CXXMemberOperatorCall::getAdjustedParameterIndex
Optional< unsigned > getAdjustedParameterIndex(unsigned ASTArgumentIndex) const override
Some calls have parameter numbering mismatched from argument numbering.
Definition: CallEvent.h:773
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:601
clang::ento::CXXAllocatorCall::classof
static bool classof(const CallEvent *CE)
Definition: CallEvent.h:1053
clang::ento::CXXInheritedConstructorCall::getKindAsString
StringRef getKindAsString() const override
Definition: CallEvent.h:986
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:967
clang::ento::CXXInstanceCall::getRuntimeDefinition
RuntimeDefinition getRuntimeDefinition() const override
Returns the definition of the function or method that will be called.
Definition: CallEvent.cpp:687
clang::ento::CXXMemberCall
Represents a non-static C++ member function call.
Definition: CallEvent.h:695
clang::ento::CXXAllocatorCall::getNumArgs
unsigned getNumArgs() const override
Returns the number of arguments (explicit and implicit).
Definition: CallEvent.h:1031
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:74
clang::ento::CXXAllocatorCall::getNumImplicitArgs
unsigned getNumImplicitArgs() const
Number of non-placement arguments to the call.
Definition: CallEvent.h:1027
clang::ento::CXXDeallocatorCall::getDecl
const FunctionDecl * getDecl() const override
Returns the declaration of the function or method that will be called.
Definition: CallEvent.h:1086
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:1321
Stmt.h
clang::CXXConstructExpr::getArg
Expr * getArg(unsigned Arg)
Return the specified argument.
Definition: ExprCXX.h:1611
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
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:495
clang::ValueDecl::getType
QualType getType() const
Definition: Decl.h:685
clang::ento::SimpleFunctionCall
Represents a C function or static C++ member function call.
Definition: CallEvent.h:517
clang::ento::CXXInstanceCall::CXXInstanceCall
CXXInstanceCall(const FunctionDecl *D, ProgramStateRef St, const LocationContext *LCtx)
Definition: CallEvent.h:664
clang::ento::RegionAndSymbolInvalidationTraits
Information about invalidation for a particular region/symbol.
Definition: MemRegion.h:1519
clang::ento::CXXMemberOperatorCall::getNumArgs
unsigned getNumArgs() const override
Returns the number of arguments (explicit and implicit).
Definition: CallEvent.h:755
clang::ento::CXXInstanceCall::getDecl
const FunctionDecl * getDecl() const override
Returns the declaration of the function or method that will be called.
Definition: CallEvent.cpp:633
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:2301
SM
#define SM(sm)
Definition: Cuda.cpp:81
clang::ento::CXXDeallocatorCall::getArgExpr
const Expr * getArgExpr(unsigned Index) const override
Returns the expression associated with a given argument.
Definition: CallEvent.h:1092
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:699
clang::ento::CXXInheritedConstructorCall::getDecl
const CXXConstructorDecl * getDecl() const override
Returns the declaration of the function or method that will be called.
Definition: CallEvent.h:956
clang::ento::CXXMemberCall::getKind
Kind getKind() const override
Returns the kind of call this is.
Definition: CallEvent.h:725
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:1310
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:985
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:890
clang::ento::CXXDeallocatorCall
Represents the memory deallocation call in a C++ delete-expression.
Definition: CallEvent.h:1068
clang::ento::CXXMemberOperatorCall::classof
static bool classof(const CallEvent *CA)
Definition: CallEvent.h:768
clang::ento::CXXConstructorCall::getOriginExpr
const CXXConstructExpr * getOriginExpr() const override
Returns the expression whose value will be the result of this call.
Definition: CallEvent.h:893
clang::Decl::getLocation
SourceLocation getLocation() const
Definition: DeclBase.h:425
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:1872
clang::ento::AnyCXXConstructorCall::classof
static bool classof(const CallEvent *Call)
Definition: CallEvent.h:864
clang::ProgramPoint
Definition: ProgramPoint.h:58
clang::ento::AnyCXXConstructorCall
Represents any constructor invocation.
Definition: CallEvent.h:844
clang::CallExpr
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2801
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:822
clang::CXXConstructExpr
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1460
clang::ento::CXXDestructorCall::isBaseDestructor
bool isBaseDestructor() const
Returns true if this is a call to a base class destructor.
Definition: CallEvent.h:830
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:886
clang::ento::CallEvent::Kind
CallEventKind Kind
Definition: CallEvent.h:150
clang::ento::CXXDestructorCall
Represents an implicit call to a C++ destructor.
Definition: CallEvent.h:795
clang::BlockDecl::isConversionFromLambda
bool isConversionFromLambda() const
Definition: Decl.h:4344
clang::ento::BlockCall::classof
static bool classof(const CallEvent *CA)
Definition: CallEvent.h:654
clang::ento::ParamVarRegion
ParamVarRegion - Represents a region for paremters.
Definition: MemRegion.h:987
clang::ento::CXXMemberCall::classof
static bool classof(const CallEvent *CA)
Definition: CallEvent.h:728
clang::CXXMethodDecl
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:1968