Go to the documentation of this file.
15 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_CALLEVENT_H
16 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_CALLEVENT_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"
52 class LocationContext;
54 class ProgramPointTag;
55 class StackFrameContext;
80 template<
typename T = CallEvent>
87 return this->get()->template cloneWithState<T>(
State);
92 template <
typename SuperT>
108 const Decl *D =
nullptr;
118 const bool Foreign =
false;
155 llvm::PointerUnion<const Expr *, const Decl *> Origin;
170 mutable unsigned RefCount = 0;
172 void Retain()
const { ++RefCount; }
173 void Release()
const;
186 :
State(Original.
State), LCtx(Original.LCtx), Origin(Original.Origin),
190 virtual void cloneTo(
void *Dest)
const = 0;
215 return Origin.dyn_cast<
const Decl *>();
219 assert(Foreign.hasValue() &&
"Foreign must be set before querying");
241 return Origin.dyn_cast<
const Expr *>();
260 getState()->getStateManager().getContext().getSourceManager();
266 if (
const auto *FD = dyn_cast<FunctionDecl>(D))
267 return FD->isOverloadedOperator() && FD->isImplicit() && FD->isGlobal();
344 const auto *ND = dyn_cast_or_null<NamedDecl>(
getDecl());
347 return ND->getIdentifier();
370 template <
typename T>
375 return cloneWithState<CallEvent>(NewState);
406 unsigned BlockCount)
const;
426 return ASTArgumentIndex;
433 return CallArgumentIndex;
457 virtual ArrayRef<ParmVarDecl *>
parameters()
const = 0;
460 llvm::mapped_iterator<ArrayRef<ParmVarDecl *>::iterator, GetTypeFn>;
468 return llvm::map_iterator(
parameters().begin(), GetTypeFn());
472 return llvm::map_iterator(
parameters().end(), GetTypeFn());
476 void dump(raw_ostream &Out)
const;
604 assert(BR &&
"Block converted from lambda must have a block region");
609 return I.getCapturedRegion();
713 return CE->getNumArgs();
783 return CallArgumentIndex + 1;
799 using DtorDataTy = llvm::PointerIntPair<const MemRegion *, 1, bool>;
809 const MemRegion *Target,
bool IsBaseDestructor,
831 return DtorDataTy::getFromOpaqueValue(
Data).getInt();
849 assert(E && (isa<CXXConstructExpr>(E) || isa<CXXInheritedCtorInitExpr>(E)));
987 return "CXXInheritedConstructorCall";
1195 llvm_unreachable(
"This is not a pseudo-object access!");
1201 llvm_unreachable(
"Unknown message kind");
1236 llvm::BumpPtrAllocator &Alloc;
1241 void reclaim(
const void *Memory) {
1242 Cache.push_back(
const_cast<void *
>(Memory));
1248 return Alloc.Allocate<CallEventTemplateTy>();
1250 return Cache.pop_back_val();
1253 template <
typename T,
typename Arg>
1255 static_assert(
sizeof(T) ==
sizeof(CallEventTemplateTy),
1256 "CallEvent subclasses are not all the same size");
1257 return new (allocate()) T(A, St, LCtx);
1260 template <
typename T,
typename Arg1,
typename Arg2>
1262 static_assert(
sizeof(T) ==
sizeof(CallEventTemplateTy),
1263 "CallEvent subclasses are not all the same size");
1264 return new (allocate()) T(A1, A2, St, LCtx);
1267 template <
typename T,
typename Arg1,
typename Arg2,
typename Arg3>
1269 const LocationContext *LCtx) {
1270 static_assert(
sizeof(T) ==
sizeof(CallEventTemplateTy),
1271 "CallEvent subclasses are not all the same size");
1272 return new (allocate()) T(A1, A2, A3, St, LCtx);
1275 template <
typename T,
typename Arg1,
typename Arg2,
typename Arg3,
1278 const LocationContext *LCtx) {
1279 static_assert(
sizeof(T) ==
sizeof(CallEventTemplateTy),
1280 "CallEvent subclasses are not all the same size");
1281 return new (allocate()) T(A1, A2, A3, A4, St, LCtx);
1304 return create<ObjCMethodCall>(E,
State, LCtx);
1310 return create<CXXConstructorCall>(E,
Target,
State, LCtx);
1317 return create<CXXInheritedConstructorCall>(E,
Target,
State, LCtx);
1324 return create<CXXDestructorCall>(DD, Trigger,
Target, IsBase,
State, LCtx);
1330 return create<CXXAllocatorCall>(E,
State, LCtx);
1336 return create<CXXDeallocatorCall>(E,
State, LCtx);
1340 template <
typename T>
1342 assert(isa<T>(*
this) &&
"Cloning to unrelated type");
1343 static_assert(
sizeof(T) ==
sizeof(
CallEvent),
1344 "Subclasses may not add fields");
1346 if (NewState ==
State)
1347 return cast<T>(
this);
1350 T *Copy =
static_cast<T *
>(Mgr.allocate());
1352 assert(Copy->getKind() == this->getKind() &&
"Bad copy");
1354 Copy->State = NewState;
1358 inline void CallEvent::Release()
const {
1359 assert(RefCount > 0 &&
"Reference count is already zero.");
1378 template<
class T>
struct simplify_type<
clang::ento::CallEventRef<T>> {
1389 #endif // LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_CALLEVENT_H
const Expr * getArgExpr(unsigned Index) const override
Returns the expression associated with a given argument.
BlockCall(const CallExpr *CE, ProgramStateRef St, const LocationContext *LCtx)
void getExtraInvalidatedValues(ValueList &Values, RegionAndSymbolInvalidationTraits *ETraits) const override
Used to specify non-argument regions that will be invalidated as a result of this call.
Kind getKind() const override
Returns the kind of call this is.
Represents an ObjC class declaration.
bool passAlignment() const
Indicates whether the required alignment should be implicitly passed to the allocation function.
unsigned getNumArgs() const override
Returns the number of arguments (explicit and implicit).
const CXXDeleteExpr * getOriginExpr() const override
Returns the expression whose value will be the result of this call.
StringRef getKindAsString() const override
bool isInstanceMessage() const
Determine whether this is an instance message to either a computed object or to super.
RuntimeDefinition(const Decl *InD)
ObjCInterfaceDecl * getReceiverInterface() const
Retrieve the Objective-C interface to which this message is being directed, if known.
ArrayRef< ParmVarDecl * > parameters() const override
Return call's formal parameters.
StringRef getKindAsString() const override
unsigned getNumArgs() const override
Returns the number of arguments (explicit and implicit).
bool mayHaveOtherDefinitions()
Check if the definition we have is precise.
ObjCMessageKind getMessageKind() const
Returns how the message was written in the source (property access, subscript, or explicit message se...
Represents a call to any sort of function that might have a FunctionDecl.
YAML serialization mapping.
Represents a C++ constructor within a class.
CallEventRef getCall(const Stmt *S, ProgramStateRef State, const LocationContext *LC)
Gets a call event for a function call, Objective-C method call, a 'new', or a 'delete' call.
const CXXMemberCallExpr * getOriginExpr() const override
Returns the expression whose value will be the result of this call.
CXXDestructorCall(const CXXDestructorDecl *DD, const Stmt *Trigger, const MemRegion *Target, bool IsBaseDestructor, ProgramStateRef St, const LocationContext *LCtx)
Creates an implicit destructor.
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
const ObjCMessageExpr * getOriginExpr() const override
Returns the expression whose value will be the result of this call.
bool isArgumentConstructedDirectly(unsigned Index) const
Returns true if on the current path, the argument was constructed by calling a C++ constructor over i...
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...
It wraps the AnalysisDeclContext to represent both the call stack with the help of StackFrameContext ...
CallEventRef< CXXDestructorCall > getCXXDestructorCall(const CXXDestructorDecl *DD, const Stmt *Trigger, const MemRegion *Target, bool IsBase, ProgramStateRef State, const LocationContext *LCtx)
unsigned getNumArgs() const override
Returns the number of arguments (explicit and implicit).
A trivial tuple used to represent a source range.
ObjCMethodFamily
A family of Objective-C methods.
const BlockDecl * getDecl() const
void getExtraInvalidatedValues(ValueList &Values, RegionAndSymbolInvalidationTraits *ETraits) const override
Used to specify non-argument regions that will be invalidated as a result of this call.
Kind getKind() const override
Returns the kind of call this is.
RuntimeDefinition(const Decl *InD, bool Foreign)
const Expr * getArgExpr(unsigned Index) const override
Returns the expression associated with a given argument.
void cloneTo(void *Dest) const override
Copies this CallEvent, with vtable intact, into a new block of memory.
StringRef getKindAsString() const override
unsigned getNumArgs() const
Return the number of arguments to the constructor call.
virtual ~CallEvent()=default
static bool classof(const CallEvent *CA)
Selector getSelector() const
ProgramPoints can be "tagged" as representing points specific to a given analysis entity.
referenced_vars_iterator referenced_vars_begin() const
virtual const Expr * getOriginExpr() const
Returns the expression whose value will be the result of this call.
Encodes a location in the source.
CallEventRef< CXXDeallocatorCall > getCXXDeallocatorCall(const CXXDeleteExpr *E, ProgramStateRef State, const LocationContext *LCtx)
RuntimeDefinition getRuntimeDefinition() const override
Returns the definition of the function or method that will be called.
StringRef getKindAsString() const override
unsigned getNumPlacementArgs() const
FunctionDecl * getOperatorNew() const
static bool classof(const CallEvent *CA)
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
IntrusiveRefCntPtr< const ProgramState > ProgramStateRef
unsigned getNumArgs() const override
Returns the number of arguments (explicit and implicit).
A (possibly-)qualified type.
ConstructionContext's subclasses describe different ways of constructing an object in C++.
const Expr * getArgExpr(unsigned Index) const override
Returns the expression associated with a given argument.
unsigned getNumArgs() const override
Returns the number of arguments (explicit and implicit).
CallEventRef< ObjCMethodCall > getObjCMethodCall(const ObjCMessageExpr *E, ProgramStateRef State, const LocationContext *LCtx)
CXXInstanceCall(const CallExpr *CE, ProgramStateRef St, const LocationContext *LCtx)
llvm::PointerIntPair< const MemRegion *, 1, bool > DtorDataTy
@ CE_BEG_CXX_CONSTRUCTOR_CALLS
AnalysisDeclContext contains the context data for the function, method or block under analysis.
AnyFunctionCall(const Expr *E, ProgramStateRef St, const LocationContext *LCtx)
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will call.
SVal getReceiverSVal() const
Returns the value of the receiver at the time of this call.
Represents a parameter to a function.
bool hasVoidPointerToNonConstArg() const
Returns true if any of the arguments is void*.
ObjCMethodCall(const ObjCMessageExpr *Msg, ProgramStateRef St, const LocationContext *LCtx)
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
CallEventRef(const CallEventRef &Orig)
param_type_iterator param_type_end() const
const ConstructionContext * getConstructionContext() const
Returns the construction context of the call, if it is a C++ constructor call or a call of a function...
It represents a stack frame of the call stack (based on CallEvent).
bool isGlobalCFunction(StringRef SpecificName=StringRef()) const
Returns true if the callee is an externally-visible function in the top-level namespace,...
void cloneTo(void *Dest) const override
Copies this CallEvent, with vtable intact, into a new block of memory.
Kind getKind() const override
Returns the kind of call this is.
const ObjCPropertyDecl * getAccessedProperty() const
SVal getArgSVal(unsigned Index) const override
Returns the value of a given argument at the time of the call.
const FunctionDecl * getDecl() const override
Returns the declaration of the function or method that will be called.
AnyCXXConstructorCall(const Expr *E, const MemRegion *Target, ProgramStateRef St, const LocationContext *LCtx)
static QualType getDeclaredResultType(const Decl *D)
Returns the result type of a function or method declaration.
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...
static bool isCallStmt(const Stmt *S)
Returns true if this is a statement is a function or method call of some kind.
virtual bool argumentsMayEscape() const
Returns true if any of the arguments are known to escape to long- term storage, even if this method w...
@ CE_CXXInheritedConstructor
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
const Expr * getArgExpr(unsigned Index) const override
Returns the expression associated with a given argument.
This class handles loading and caching of source files into memory.
RuntimeDefinition getRuntimeDefinition() const override
Returns the definition of the function or method that will be called.
CXXMethodDecl * getLambdaCallOperator() const
Retrieve the lambda call operator of the closure type if this is a closure type.
SourceRange getSourceRange() const override
Returns a source range for the entire call, suitable for outputting in diagnostics.
CallEvent & operator=(const CallEvent &)=delete
void cloneTo(void *Dest) const override
Copies this CallEvent, with vtable intact, into a new block of memory.
void getExtraInvalidatedValues(ValueList &Values, RegionAndSymbolInvalidationTraits *ETraits) const override
Used to specify non-argument regions that will be invalidated as a result of this call.
MemRegion - The root abstract class for all memory regions.
const CXXConstructorDecl * getDecl() const override
Returns the declaration of the function or method that will be called.
Kind getKind() const override
Returns the kind of call this is.
const ProgramStateRef & getState() const
The state in which the call is being evaluated.
CallEvent(const Decl *D, ProgramStateRef state, const LocationContext *lctx)
const ObjCMethodDecl * getDecl() const override
Returns the declaration of the function or method that will be called.
static bool classof(const CallEvent *CA)
unsigned getNumArgs() const override
Returns the number of arguments (explicit and implicit).
SVal getReturnValue() const
Returns the return value of the call.
const LocationContext * getLocationContext() const
The context in which the call is being evaluated.
Selector getSelector() const
Kind getKind() const override
Returns the kind of call this is.
virtual ArrayRef< ParmVarDecl * > parameters() const =0
Return call's formal parameters.
virtual SourceRange getArgSourceRange(unsigned Index) const
Returns the source range for errors associated with this argument.
const CallExpr * getOriginExpr() const override
Returns the expression whose value will be the result of this call.
const Expr * getCXXThisExpr() const override
Returns the expression representing the implicit 'this' object.
Represents a call to a C++ constructor.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
StringRef getKindAsString() const override
virtual const Expr * getCXXThisExpr() const
Returns the expression representing the implicit 'this' object.
virtual SourceRange getSourceRange() const
Returns a source range for the entire call, suitable for outputting in diagnostics.
CallEventRef(const T *Call)
CXXDeallocatorCall(const CXXDeleteExpr *E, ProgramStateRef St, const LocationContext *LCtx)
static SimpleType getSimplifiedValue(clang::ento::CallEventRef< T > Val)
unsigned getNumArgs() const override
Returns the number of arguments (explicit and implicit).
const Expr * getArgExpr(unsigned Index) const override
Returns the expression associated with a given argument.
bool isReceiverSelfOrSuper() const
Checks if the receiver refers to 'self' or 'super'.
virtual unsigned getASTArgumentIndex(unsigned CallArgumentIndex) const
Some call event sub-classes conveniently adjust mismatching AST indices to match parameter indices.
RuntimeDefinition getRuntimeDefinition() const override
Returns the definition of the function or method that will be called.
void cloneTo(void *Dest) const override
Copies this CallEvent, with vtable intact, into a new block of memory.
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...
SmallVectorImpl< FrameBindingTy > BindingsTy
const BlockDataRegion * getBlockRegion() const
Returns the region associated with this instance of the block.
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
void cloneTo(void *Dest) const override
Copies this CallEvent, with vtable intact, into a new block of memory.
void cloneTo(void *Dest) const override
Copies this CallEvent, with vtable intact, into a new block of memory.
Kind getKind() const override
Returns the kind of call this is.
const CXXNewExpr * getOriginExpr() const override
Returns the expression whose value will be the result of this call.
const CXXOperatorCallExpr * getOriginExpr() const override
Returns the expression whose value will be the result of this call.
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
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,...
SourceLocation getEndLoc() const LLVM_READONLY
Represents a C++ destructor within a class.
BlockDataRegion - A region that represents a block instance.
CallEventRef< CXXInheritedConstructorCall > getCXXInheritedConstructorCall(const CXXInheritedCtorInitExpr *E, const MemRegion *Target, ProgramStateRef State, const LocationContext *LCtx)
CallEventRef< CXXConstructorCall > getCXXConstructorCall(const CXXConstructExpr *E, const MemRegion *Target, ProgramStateRef State, const LocationContext *LCtx)
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...
ProgramStateRef invalidateRegions(unsigned BlockCount, ProgramStateRef Orig=nullptr) const
Returns a new state with all argument regions invalidated.
SVal getCXXThisVal() const
Returns the value of the implicit 'this' object.
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...
Represents the memory allocation call in a C++ new-expression.
ArrayRef< SVal > ValueList
Represents a variable declaration or definition.
FunctionDecl * getOperatorDelete() const
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will (ultimately) call.
static bool classof(const CallEvent *CA)
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
CallEventRef cloneWithState(ProgramStateRef NewState) const
Returns a copy of this CallEvent, but using the given state.
CallEventRef< CXXAllocatorCall > getCXXAllocatorCall(const CXXNewExpr *E, ProgramStateRef State, const LocationContext *LCtx)
SVal getObjectUnderConstruction() const
StringRef getKindAsString() const override
Represents a call to an inherited base class constructor from an inheriting constructor.
CXXAllocatorCall(const CXXNewExpr *E, ProgramStateRef St, const LocationContext *LCtx)
virtual const Decl * getDecl() const
Returns the declaration of the function or method that will be called.
CallEventRef getCaller(const StackFrameContext *CalleeCtx, ProgramStateRef State)
Gets an outside caller given a callee context.
RuntimeDefinition getRuntimeDefinition() const override
Returns the definition of the function or method that will be called.
An expression that sends a message to the given Objective-C object or class.
CallEventRef< T > cloneWithState(ProgramStateRef NewState) const
Returns a copy of this CallEvent, but using the given state.
CallEvent(const Expr *E, ProgramStateRef state, const LocationContext *lctx)
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
virtual SVal getCXXThisVal() const
Returns the value of the implicit 'this' object.
ObjCMethodFamily getMethodFamily() const
RuntimeDefinition()=default
CallEventRef getSimpleCall(const CallExpr *E, ProgramStateRef State, const LocationContext *LCtx)
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
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...
void getExtraInvalidatedValues(ValueList &Values, RegionAndSymbolInvalidationTraits *ETraits) const override
Used to specify non-argument regions that will be invalidated as a result of this call.
bool hasNonZeroCallbackArg() const
Returns true if any of the arguments appear to represent callbacks.
const ObjCInterfaceDecl * getReceiverInterface() const
Get the interface for the receiver.
unsigned getASTArgumentIndex(unsigned CallArgumentIndex) const override
Some call event sub-classes conveniently adjust mismatching AST indices to match parameter indices.
Kind getKind() const override
Returns the kind of call this is.
StringRef getKindAsString() const override
StringRef getKindAsString() const override
const CXXInheritedCtorInitExpr * getOriginExpr() const override
Returns the expression whose value will be the result of this call.
CXXInheritedConstructorCall(const CXXInheritedCtorInitExpr *CE, const MemRegion *Target, ProgramStateRef St, const LocationContext *LCtx)
static bool classof(const CallEvent *CA)
CXXConstructorCall(const CXXConstructExpr *CE, const MemRegion *Target, ProgramStateRef St, const LocationContext *LCtx)
Creates a constructor call.
bool isConversionFromLambda() const
virtual const Expr * getArgExpr(unsigned Index) const
Returns the expression associated with a given argument.
Represents a C++ struct/union/class.
Represents a call to a C++ inherited constructor.
Represents a non-static C++ member function call, no matter how it is written.
std::unique_ptr< DiagnosticConsumer > create(StringRef OutputFile, DiagnosticOptions *Diags, bool MergeChildRecords=false)
Returns a DiagnosticConsumer that serializes diagnostics to a bitcode file.
OverloadedOperatorKind getOperator() const
Returns the kind of overloaded operator that this expression refers to.
Manages the lifetime of CallEvent objects.
ObjCMessageKind
Represents the ways an Objective-C message send can occur.
static bool classof(const CallEvent *CA)
TypePropertyCache< Private > Cache
bool isValid() const =delete
SVal getCXXThisVal() const override
Returns the value of the implicit 'this' object.
llvm::mapped_iterator< ArrayRef< ParmVarDecl * >::iterator, GetTypeFn > param_type_iterator
virtual void cloneTo(void *Dest) const =0
Copies this CallEvent, with vtable intact, into a new block of memory.
AnyFunctionCall(const Decl *D, ProgramStateRef St, const LocationContext *LCtx)
const Expr * getPlacementArgExpr(unsigned Index) const
Number of placement arguments to the operator new() call.
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
Represents a delete expression for memory deallocation and destructor calls, e.g.
param_type_iterator param_type_begin() const
Returns an iterator over the types of the call's formal parameters.
Decl - This represents one declaration (or definition), e.g.
Represents one property declaration in an Objective-C interface.
void cloneTo(void *Dest) const override
Copies this CallEvent, with vtable intact, into a new block of memory.
bool hasNonNullArgumentsWithType(bool(*Condition)(QualType)) const
Returns true if the type of any of the non-null arguments satisfies the condition.
virtual void getExtraInvalidatedValues(ValueList &Values, RegionAndSymbolInvalidationTraits *ETraits) const
Used to specify non-argument regions that will be invalidated as a result of this call.
virtual bool canBeOverridenInSubclass(ObjCInterfaceDecl *IDecl, Selector Sel) const
Check if the selector may have multiple definitions (may have overrides).
const CallExpr * getOriginExpr() const override
Returns the expression whose value will be the result of this call.
static bool classof(const CallEvent *CE)
const Expr * getArgExpr(unsigned Index) const override
Returns the expression associated with a given argument.
@ CE_BEG_CXX_INSTANCE_CALLS
std::pair< SVal, SVal > FrameBindingTy
SourceRange getSourceRange() const override
Returns a source range for the entire call, suitable for outputting in diagnostics.
virtual Optional< unsigned > getAdjustedParameterIndex(unsigned ASTArgumentIndex) const
Some calls have parameter numbering mismatched from argument numbering.
virtual StringRef getKindAsString() const =0
CallEventManager(llvm::BumpPtrAllocator &alloc)
void cloneTo(void *Dest) const override
Copies this CallEvent, with vtable intact, into a new block of memory.
static bool classof(const CallEvent *CA)
const FunctionDecl * getDecl() const override
Returns the declaration of the function or method that will be called.
CXXMemberOperatorCall(const CXXOperatorCallExpr *CE, ProgramStateRef St, const LocationContext *LCtx)
ProgramPoint getProgramPoint(bool IsPreVisit=false, const ProgramPointTag *Tag=nullptr) const
Returns an appropriate ProgramPoint for this call.
virtual RuntimeDefinition getRuntimeDefinition() const =0
Returns the definition of the function or method that will be called.
StringRef getKindAsString() const override
Represents any expression that calls an Objective-C method.
virtual unsigned getNumArgs() const =0
Returns the number of arguments (explicit and implicit).
OverloadedOperatorKind getOverloadedOperator() const
One of these records is kept for each identifier that is lexed.
referenced_vars_iterator referenced_vars_end() const
bool argumentsMayEscape() const override
Returns true if any of the arguments are known to escape to long- term storage, even if this method w...
const Expr * getArgExpr(unsigned Index) const override
Returns the expression associated with a given argument.
RuntimeDefinition getRuntimeDefinition() const override
Returns the definition of the function or method that will be called.
const Expr * getCXXThisExpr() const override
Returns the expression representing the implicit 'this' object.
bool isInstanceMessage() const
void setForeign(bool B) const
ArrayRef< ParmVarDecl * > parameters() const override
Return call's formal parameters.
const MemRegion * getDispatchRegion()
When other definitions are possible, returns the region whose runtime type determines the method defi...
ObjCMethodFamily getMethodFamily() const
bool isSetter() const
Returns true if this property access or subscript is a setter (has the form of an assignment).
QualType getResultType() const
Returns the result type, adjusted for references.
SVal getSVal(const Stmt *S) const
Get the value of arbitrary expressions at this point in the path.
Represents a call to a block.
const BlockDecl * getDecl() const override
Returns the declaration of the function or method that will be called.
CallEvent(const CallEvent &Original)
virtual Kind getKind() const =0
Returns the kind of call this is.
ObjCMethodDecl - Represents an instance or class method declaration.
ArrayRef< ParmVarDecl * > parameters() const override
Return call's formal parameters.
Kind getKind() const override
Returns the kind of call this is.
static bool isVariadic(const Decl *D)
Returns true if the given decl is known to be variadic.
bool isInSystemHeader() const
Returns true if the callee is known to be from a system header.
Smart pointer class that efficiently represents Objective-C method names.
Stmt - This represents one statement.
void cloneTo(void *Dest) const override
Copies this CallEvent, with vtable intact, into a new block of memory.
bool argumentsMayEscape() const override
Returns true if any of the arguments are known to escape to long- term storage, even if this method w...
CallEventRef< T > cloneWithState(ProgramStateRef State) const
const Expr * getArgExpr(unsigned Index) const override
Returns the expression associated with a given argument.
Represents an abstract call to a function or method along a particular path.
const ObjCMethodDecl * getMethodDecl() const
SimpleFunctionCall(const CallExpr *CE, ProgramStateRef St, const LocationContext *LCtx)
Represents a C++ overloaded operator call where the operator is implemented as a non-static member fu...
Optional< unsigned > getAdjustedParameterIndex(unsigned ASTArgumentIndex) const override
Some calls have parameter numbering mismatched from argument numbering.
virtual SVal getArgSVal(unsigned Index) const
Returns the value of a given argument at the time of the call.
const VarRegion * getRegionStoringCapturedLambda() const
For a block converted from a C++ lambda, returns the block VarRegion for the variable holding the cap...
static bool classof(const CallEvent *CE)
StringRef getKindAsString() const override
const CXXConstructExpr * getInheritingConstructor() const
Obtain the CXXConstructExpr for the sub-class that inherited the current constructor (possibly indire...
RuntimeDefinition getRuntimeDefinition() const override
Returns the definition of the function or method that will be called.
Represents a non-static C++ member function call.
unsigned getNumArgs() const override
Returns the number of arguments (explicit and implicit).
AnalysisDeclContext * getCalleeAnalysisDeclContext() const
Returns AnalysisDeclContext for the callee stack frame.
SVal - This represents a symbolic expression, which can be either an L-value or an R-value.
unsigned getNumImplicitArgs() const
Number of non-placement arguments to the call.
const FunctionDecl * getDecl() const override
Returns the declaration of the function or method that will be called.
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...
Expr * getArg(unsigned Arg)
Return the specified argument.
@ CE_END_CXX_CONSTRUCTOR_CALLS
unsigned getNumArgs() const
Return the number of actual arguments in this message, not counting the receiver.
const FunctionDecl * getDecl() const override
Returns the declaration of the function or method that will be called.
Represents a C function or static C++ member function call.
CXXInstanceCall(const FunctionDecl *D, ProgramStateRef St, const LocationContext *LCtx)
Information about invalidation for a particular region/symbol.
unsigned getNumArgs() const override
Returns the number of arguments (explicit and implicit).
const FunctionDecl * getDecl() const override
Returns the declaration of the function or method that will be called.
This represents one expression.
@ CE_END_CXX_INSTANCE_CALLS
Expr * getPlacementArg(unsigned I)
const Expr * getArgExpr(unsigned Index) const override
Returns the expression associated with a given argument.
const ParamVarRegion * getParameterLocation(unsigned Index, unsigned BlockCount) const
Returns memory location for a parameter variable within the callee stack frame.
CXXMemberCall(const CXXMemberCallExpr *CE, ProgramStateRef St, const LocationContext *LCtx)
const CXXConstructorDecl * getDecl() const override
Returns the declaration of the function or method that will be called.
Kind getKind() const override
Returns the kind of call this is.
bool argumentsMayEscape() const override
Returns true if any of the arguments are known to escape to long- term storage, even if this method w...
const IdentifierInfo * getCalleeIdentifier() const
Returns the name of the callee, if its name is a simple identifier.
Kind getKind() const override
Returns the kind of call this is.
void cloneTo(void *Dest) const override
Copies this CallEvent, with vtable intact, into a new block of memory.
Represents the memory deallocation call in a C++ delete-expression.
static bool classof(const CallEvent *CA)
const CXXConstructExpr * getOriginExpr() const override
Returns the expression whose value will be the result of this call.
SourceLocation getLocation() const
Represents a function declaration or definition.
static bool classof(const CallEvent *Call)
Represents any constructor invocation.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
const StackFrameContext * getCalleeStackFrame(unsigned BlockCount) const
Returns the callee stack frame.
A call to an overloaded operator written using operator syntax.
const VarDecl * getDecl() const override=0
unsigned getNumArgs() const override
Returns the number of arguments (explicit and implicit).
Represents a call to a C++ constructor.
bool isBaseDestructor() const
Returns true if this is a call to a base class destructor.
RuntimeDefinition(const Decl *InD, const MemRegion *InR)
Represents a call to a member function that may be written either with member call syntax (e....
const StackFrameContext * getInheritingStackFrame() const
Obtain the stack frame of the inheriting constructor.
Represents an implicit call to a C++ destructor.
bool isConversionFromLambda() const
static bool classof(const CallEvent *CA)
ParamVarRegion - Represents a region for paremters.
static bool classof(const CallEvent *CA)
Represents a static or instance method of a struct/union/class.