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