clang 20.0.0git
|
Represents an abstract call to a function or method along a particular path. More...
#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
Public Types | |
using | Kind = CallEventKind |
using | FrameBindingTy = std::pair< SVal, SVal > |
using | BindingsTy = SmallVectorImpl< FrameBindingTy > |
using | param_type_iterator = llvm::mapped_iterator< ArrayRef< ParmVarDecl * >::iterator, GetTypeFn > |
Public Member Functions | |
CallEvent & | operator= (const CallEvent &)=delete |
virtual | ~CallEvent ()=default |
virtual Kind | getKind () const =0 |
Returns the kind of call this is. | |
virtual StringRef | getKindAsString () const =0 |
virtual const Decl * | getDecl () const |
Returns the declaration of the function or method that will be called. | |
bool | isForeign () const |
void | setForeign (bool B) const |
const ProgramStateRef & | getState () const |
The state in which the call is being evaluated. | |
const LocationContext * | getLocationContext () const |
The context in which the call is being evaluated. | |
const CFGBlock::ConstCFGElementRef & | getCFGElementRef () const |
virtual RuntimeDefinition | getRuntimeDefinition () const =0 |
Returns the definition of the function or method that will be called. | |
virtual const Expr * | getOriginExpr () const |
Returns the expression whose value will be the result of this call. | |
virtual unsigned | getNumArgs () const =0 |
Returns the number of arguments (explicit and implicit). | |
bool | isInSystemHeader () const |
Returns true if the callee is known to be from a system header. | |
virtual SourceRange | getSourceRange () const |
Returns a source range for the entire call, suitable for outputting in diagnostics. | |
virtual SVal | getArgSVal (unsigned Index) const |
Returns the value of a given argument at the time of the call. | |
virtual const Expr * | getArgExpr (unsigned Index) const |
Returns the expression associated with a given argument. | |
virtual SourceRange | getArgSourceRange (unsigned Index) const |
Returns the source range for errors associated with this argument. | |
QualType | getResultType () const |
Returns the result type, adjusted for references. | |
SVal | getReturnValue () const |
Returns the return value of the call. | |
bool | hasNonNullArgumentsWithType (bool(*Condition)(QualType)) const |
Returns true if the type of any of the non-null arguments satisfies the condition. | |
bool | hasNonZeroCallbackArg () const |
Returns true if any of the arguments appear to represent callbacks. | |
bool | hasVoidPointerToNonConstArg () const |
Returns true if any of the arguments is void*. | |
virtual bool | argumentsMayEscape () const |
Returns true if any of the arguments are known to escape to long- term storage, even if this method will not modify them. | |
bool | isGlobalCFunction (StringRef SpecificName=StringRef()) const |
Returns true if the callee is an externally-visible function in the top-level namespace, such as malloc . | |
const IdentifierInfo * | getCalleeIdentifier () const |
Returns the name of the callee, if its name is a simple identifier. | |
ProgramPoint | getProgramPoint (bool IsPreVisit=false, const ProgramPointTag *Tag=nullptr) const |
Returns an appropriate ProgramPoint for this call. | |
ProgramStateRef | invalidateRegions (unsigned BlockCount, ProgramStateRef Orig=nullptr) const |
Returns a new state with all argument regions invalidated. | |
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 call. | |
template<typename T > | |
CallEventRef< T > | cloneWithState (ProgramStateRef NewState) const |
Returns a copy of this CallEvent, but using the given state. | |
CallEventRef | cloneWithState (ProgramStateRef NewState) const |
Returns a copy of this CallEvent, but using the given state. | |
AnalysisDeclContext * | getCalleeAnalysisDeclContext () const |
Returns AnalysisDeclContext for the callee stack frame. | |
const StackFrameContext * | getCalleeStackFrame (unsigned BlockCount) const |
Returns the callee stack frame. | |
const ParamVarRegion * | getParameterLocation (unsigned Index, unsigned BlockCount) const |
Returns memory location for a parameter variable within the callee stack frame. | |
bool | isArgumentConstructedDirectly (unsigned Index) const |
Returns true if on the current path, the argument was constructed by calling a C++ constructor over it. | |
virtual std::optional< unsigned > | getAdjustedParameterIndex (unsigned ASTArgumentIndex) const |
Some calls have parameter numbering mismatched from argument numbering. | |
virtual unsigned | getASTArgumentIndex (unsigned CallArgumentIndex) const |
Some call event sub-classes conveniently adjust mismatching AST indices to match parameter indices. | |
const ConstructionContext * | getConstructionContext () const |
Returns the construction context of the call, if it is a C++ constructor call or a call of a function returning a C++ class instance. | |
std::optional< SVal > | getReturnValueUnderConstruction () const |
If the call returns a C++ record type then the region of its return value can be retrieved from its construction context. | |
const CallEventRef | getCaller () const |
bool | isCalledFromSystemHeader () const |
virtual ArrayRef< ParmVarDecl * > | parameters () const =0 |
Return call's formal parameters. | |
param_type_iterator | param_type_begin () const |
Returns an iterator over the types of the call's formal parameters. | |
param_type_iterator | param_type_end () const |
void | dump (raw_ostream &Out) const |
void | dump () const |
Static Public Member Functions | |
static bool | isCallStmt (const Stmt *S) |
Returns true if this is a statement is a function or method call of some kind. | |
static QualType | getDeclaredResultType (const Decl *D) |
Returns the result type of a function or method declaration. | |
static bool | isVariadic (const Decl *D) |
Returns true if the given decl is known to be variadic. | |
Protected Types | |
using | ValueList = SmallVectorImpl< SVal > |
Protected Member Functions | |
CallEvent (const Expr *E, ProgramStateRef state, const LocationContext *lctx, CFGBlock::ConstCFGElementRef ElemRef) | |
CallEvent (const Decl *D, ProgramStateRef state, const LocationContext *lctx, CFGBlock::ConstCFGElementRef ElemRef) | |
CallEvent (const CallEvent &Original) | |
virtual void | cloneTo (void *Dest) const =0 |
Copies this CallEvent, with vtable intact, into a new block of memory. | |
SVal | getSVal (const Stmt *S) const |
Get the value of arbitrary expressions at this point in the path. | |
virtual void | getExtraInvalidatedValues (ValueList &Values, RegionAndSymbolInvalidationTraits *ETraits) const |
Used to specify non-argument regions that will be invalidated as a result of this call. | |
Protected Attributes | |
const void * | Data |
SourceLocation | Location |
Friends | |
template<typename T > | |
struct | llvm::IntrusiveRefCntPtrInfo |
class | CallEventManager |
Represents an abstract call to a function or method along a particular path.
CallEvents are created through the factory methods of CallEventManager.
CallEvents should always be cheap to create and destroy. In order for CallEventManager to be able to re-use CallEvent-sized memory blocks, subclasses of CallEvent may not add any data members to the base class. Use the "Data" and "Location" fields instead.
Definition at line 153 of file CallEvent.h.
Definition at line 370 of file CallEvent.h.
using clang::ento::CallEvent::FrameBindingTy = std::pair<SVal, SVal> |
Definition at line 369 of file CallEvent.h.
Definition at line 155 of file CallEvent.h.
using clang::ento::CallEvent::param_type_iterator = llvm::mapped_iterator<ArrayRef<ParmVarDecl *>::iterator, GetTypeFn> |
Definition at line 476 of file CallEvent.h.
|
protected |
Definition at line 206 of file CallEvent.h.
|
inlineprotected |
Definition at line 184 of file CallEvent.h.
|
inlineprotected |
Definition at line 188 of file CallEvent.h.
|
inlineprotected |
Definition at line 193 of file CallEvent.h.
|
virtualdefault |
|
inlinevirtual |
Returns true if any of the arguments are known to escape to long- term storage, even if this method will not modify them.
Reimplemented in clang::ento::AnyFunctionCall, clang::ento::BlockCall, and clang::ento::ObjCMethodCall.
Definition at line 324 of file CallEvent.h.
References hasNonZeroCallbackArg().
Referenced by clang::ento::AnyFunctionCall::argumentsMayEscape(), clang::ento::ObjCMethodCall::argumentsMayEscape(), and invalidateRegions().
|
protectedpure virtual |
Copies this CallEvent, with vtable intact, into a new block of memory.
Implemented in clang::ento::SimpleFunctionCall, clang::ento::BlockCall, clang::ento::CXXStaticOperatorCall, clang::ento::CXXMemberCall, clang::ento::CXXMemberOperatorCall, clang::ento::CXXDestructorCall, clang::ento::CXXConstructorCall, clang::ento::CXXInheritedConstructorCall, clang::ento::CXXAllocatorCall, clang::ento::CXXDeallocatorCall, and clang::ento::ObjCMethodCall.
Referenced by cloneWithState().
CallEventRef< T > clang::ento::CallEvent::cloneWithState | ( | ProgramStateRef | NewState | ) | const |
Returns a copy of this CallEvent, but using the given state.
Definition at line 1473 of file CallEvent.h.
References cloneTo(), clang::Copy, and clang::T.
Referenced by clang::ento::ExprEngine::defaultEvalCall().
|
inline |
Returns a copy of this CallEvent, but using the given state.
Definition at line 382 of file CallEvent.h.
LLVM_DUMP_METHOD void CallEvent::dump | ( | ) | const |
void CallEvent::dump | ( | raw_ostream & | Out | ) | const |
Definition at line 331 of file CallEvent.cpp.
References D, E, getDecl(), getKindAsString(), getOriginExpr(), clang::ASTContext::getPrintingPolicy(), getState(), clang::Decl::print(), and clang::Stmt::printPretty().
|
inlinevirtual |
Some calls have parameter numbering mismatched from argument numbering.
This function converts an argument index to the corresponding parameter index. Returns std::nullopt is the argument doesn't correspond to any parameter variable.
Reimplemented in clang::ento::CXXStaticOperatorCall, and clang::ento::CXXMemberOperatorCall.
Definition at line 434 of file CallEvent.h.
Referenced by invalidateRegions().
Returns the expression associated with a given argument.
May be null if this expression does not appear in the source.
Reimplemented in clang::ento::SimpleFunctionCall, clang::ento::BlockCall, clang::ento::CXXStaticOperatorCall, clang::ento::CXXMemberCall, clang::ento::CXXMemberOperatorCall, clang::ento::CXXConstructorCall, clang::ento::CXXInheritedConstructorCall, clang::ento::CXXAllocatorCall, clang::ento::CXXDeallocatorCall, and clang::ento::ObjCMethodCall.
Definition at line 293 of file CallEvent.h.
Referenced by getArgSourceRange(), and getArgSVal().
|
virtual |
Returns the source range for errors associated with this argument.
May be invalid if the argument is not written in the source.
Definition at line 315 of file CallEvent.cpp.
References getArgExpr(), and clang::Stmt::getSourceRange().
Referenced by clang::ento::retaincountchecker::RetainCountChecker::checkSummary().
Returns the value of a given argument at the time of the call.
Reimplemented in clang::ento::CXXInheritedConstructorCall.
Definition at line 308 of file CallEvent.cpp.
References getArgExpr(), and getSVal().
Referenced by clang::ento::mpi::MPIChecker::checkDoubleNonblocking(), clang::ento::retaincountchecker::RetainCountChecker::checkSummary(), hasNonNullArgumentsWithType(), invalidateRegions(), clang::ento::retaincountchecker::RetainCountChecker::processSummaryOfInlined(), and updateOutParameters().
|
inlinevirtual |
Some call event sub-classes conveniently adjust mismatching AST indices to match parameter indices.
This function converts an argument index as understood by CallEvent to the argument index as understood by the AST.
Reimplemented in clang::ento::CXXStaticOperatorCall, and clang::ento::CXXMemberOperatorCall.
Definition at line 441 of file CallEvent.h.
AnalysisDeclContext * CallEvent::getCalleeAnalysisDeclContext | ( | ) | const |
Returns AnalysisDeclContext for the callee stack frame.
Currently may fail; returns null on failure.
Definition at line 152 of file CallEvent.cpp.
References D, clang::LocationContext::getAnalysisDeclContext(), clang::AnalysisDeclContextManager::getContext(), getDecl(), and clang::AnalysisDeclContext::getManager().
Referenced by getCalleeStackFrame().
|
inline |
Returns the name of the callee, if its name is a simple identifier.
Note that this will fail for Objective-C methods, blocks, and C++ overloaded operators. The former is named by a Selector rather than a simple identifier, and the latter two do not have names.
Definition at line 351 of file CallEvent.h.
References getDecl().
Referenced by clang::ento::mpi::MPIChecker::checkDoubleNonblocking(), and clang::ento::mpi::MPIChecker::checkUnmatchedWaits().
const StackFrameContext * CallEvent::getCalleeStackFrame | ( | unsigned | BlockCount | ) | const |
Returns the callee stack frame.
That stack frame will only be entered during analysis if the call is inlined, but it may still be useful in intermediate calculations even if the call isn't inlined. May fail; returns null on failure.
Definition at line 164 of file CallEvent.cpp.
References E, clang::LocationContext::getAnalysisDeclContext(), clang::CFGStmtMap::getBlock(), getCalleeAnalysisDeclContext(), clang::AnalysisDeclContext::getCFGStmtMap(), clang::AnalysisDeclContext::getManager(), getOriginExpr(), clang::AnalysisDeclContextManager::getStackFrame(), and clang::CFGBlock::size().
Referenced by getConstructionContext(), and getParameterLocation().
const CallEventRef CallEvent::getCaller | ( | ) | const |
Definition at line 520 of file CallEvent.cpp.
References clang::ento::CallEventManager::getCaller(), and getLocationContext().
Referenced by isCalledFromSystemHeader().
|
inline |
Definition at line 240 of file CallEvent.h.
const ConstructionContext * CallEvent::getConstructionContext | ( | ) | const |
Returns the construction context of the call, if it is a C++ constructor call or a call of a function returning a C++ class instance.
Otherwise return nullptr.
Definition at line 503 of file CallEvent.cpp.
References clang::CFGElement::getAs(), getCalleeStackFrame(), and clang::StackFrameContext::getCallSiteCFGElement().
Referenced by getReturnValueUnderConstruction().
|
inlinevirtual |
Returns the declaration of the function or method that will be called.
May be null.
Reimplemented in clang::ento::AnyFunctionCall, clang::ento::SimpleFunctionCall, clang::ento::BlockCall, clang::ento::CXXInstanceCall, clang::ento::CXXConstructorCall, clang::ento::CXXInheritedConstructorCall, clang::ento::CXXAllocatorCall, clang::ento::CXXDeallocatorCall, and clang::ento::ObjCMethodCall.
Definition at line 224 of file CallEvent.h.
Referenced by dump(), getCalleeAnalysisDeclContext(), getCalleeIdentifier(), clang::ento::AnyFunctionCall::getDecl(), getProgramPoint(), hasNonNullArgumentsWithType(), invalidateRegions(), isGlobalCFunction(), and isInSystemHeader().
Returns the result type of a function or method declaration.
This will return a null QualType if the result type cannot be determined.
Definition at line 351 of file CallEvent.cpp.
References D, clang::Type::getAs(), and clang::Type::isDependentType().
Referenced by clang::ento::ExprEngine::processCallExit().
|
inlineprotectedvirtual |
Used to specify non-argument regions that will be invalidated as a result of this call.
Reimplemented in clang::ento::BlockCall, clang::ento::CXXInstanceCall, clang::ento::AnyCXXConstructorCall, and clang::ento::ObjCMethodCall.
Definition at line 211 of file CallEvent.h.
Referenced by invalidateRegions().
|
pure virtual |
Populates the given SmallVector with the bindings in the callee's stack frame at the start of this call.
Implemented in clang::ento::AnyFunctionCall, clang::ento::BlockCall, clang::ento::CXXInstanceCall, clang::ento::AnyCXXConstructorCall, and clang::ento::ObjCMethodCall.
|
pure virtual |
Returns the kind of call this is.
Implemented in clang::ento::SimpleFunctionCall, clang::ento::BlockCall, clang::ento::CXXStaticOperatorCall, clang::ento::CXXMemberCall, clang::ento::CXXMemberOperatorCall, clang::ento::CXXDestructorCall, clang::ento::CXXConstructorCall, clang::ento::CXXInheritedConstructorCall, clang::ento::CXXAllocatorCall, clang::ento::CXXDeallocatorCall, and clang::ento::ObjCMethodCall.
Referenced by clang::ento::AnyFunctionCall::classof(), clang::ento::SimpleFunctionCall::classof(), clang::ento::BlockCall::classof(), clang::ento::CXXInstanceCall::classof(), clang::ento::CXXStaticOperatorCall::classof(), clang::ento::CXXMemberCall::classof(), clang::ento::CXXMemberOperatorCall::classof(), clang::ento::CXXDestructorCall::classof(), clang::ento::CXXConstructorCall::classof(), clang::ento::CXXInheritedConstructorCall::classof(), clang::ento::ObjCMethodCall::classof(), clang::ento::CXXAllocatorCall::classof(), clang::ento::CXXDeallocatorCall::classof(), and invalidateRegions().
|
pure virtual |
Implemented in clang::ento::SimpleFunctionCall, clang::ento::BlockCall, clang::ento::CXXStaticOperatorCall, clang::ento::CXXMemberCall, clang::ento::CXXMemberOperatorCall, clang::ento::CXXDestructorCall, clang::ento::CXXConstructorCall, clang::ento::CXXInheritedConstructorCall, clang::ento::CXXAllocatorCall, clang::ento::CXXDeallocatorCall, and clang::ento::ObjCMethodCall.
Referenced by dump().
|
inline |
The context in which the call is being evaluated.
Definition at line 238 of file CallEvent.h.
Referenced by clang::ento::CXXAllocatorCall::getArraySizeVal(), getCaller(), clang::ento::CXXInheritedConstructorCall::getInheritingStackFrame(), clang::ento::ObjCMethodCall::getMessageKind(), clang::ento::CXXAllocatorCall::getObjectUnderConstruction(), getProgramPoint(), clang::ento::ObjCMethodCall::getReceiverSVal(), getReturnValueUnderConstruction(), clang::ento::AnyFunctionCall::getRuntimeDefinition(), clang::ento::ObjCMethodCall::getRuntimeDefinition(), getSVal(), invalidateRegions(), isArgumentConstructedDirectly(), and clang::ento::ObjCMethodCall::isReceiverSelfOrSuper().
|
pure virtual |
Returns the number of arguments (explicit and implicit).
Note that this may be greater than the number of parameters in the callee's declaration, and that it may include arguments not written in the source.
Implemented in clang::ento::SimpleFunctionCall, clang::ento::BlockCall, clang::ento::CXXStaticOperatorCall, clang::ento::CXXMemberCall, clang::ento::CXXMemberOperatorCall, clang::ento::CXXDestructorCall, clang::ento::CXXConstructorCall, clang::ento::CXXInheritedConstructorCall, clang::ento::CXXAllocatorCall, clang::ento::CXXDeallocatorCall, and clang::ento::ObjCMethodCall.
Referenced by clang::ento::mpi::MPIChecker::checkDoubleNonblocking(), clang::ento::retaincountchecker::RetainCountChecker::checkSummary(), hasNonNullArgumentsWithType(), invalidateRegions(), clang::ento::retaincountchecker::RetainCountChecker::processSummaryOfInlined(), and updateOutParameters().
|
inlinevirtual |
Returns the expression whose value will be the result of this call.
May be null.
Reimplemented in clang::ento::SimpleFunctionCall, clang::ento::BlockCall, clang::ento::CXXStaticOperatorCall, clang::ento::CXXMemberCall, clang::ento::CXXMemberOperatorCall, clang::ento::CXXConstructorCall, clang::ento::CXXInheritedConstructorCall, clang::ento::CXXAllocatorCall, clang::ento::CXXDeallocatorCall, and clang::ento::ObjCMethodCall.
Definition at line 250 of file CallEvent.h.
Referenced by clang::ento::retaincountchecker::RetainCountChecker::checkSummary(), dump(), getCalleeStackFrame(), clang::ento::CXXInstanceCall::getDecl(), clang::ento::SimpleFunctionCall::getOriginExpr(), clang::ento::BlockCall::getOriginExpr(), clang::ento::CXXMemberCall::getOriginExpr(), clang::ento::CXXMemberOperatorCall::getOriginExpr(), clang::ento::CXXConstructorCall::getOriginExpr(), clang::ento::CXXInheritedConstructorCall::getOriginExpr(), clang::ento::CXXAllocatorCall::getOriginExpr(), clang::ento::CXXDeallocatorCall::getOriginExpr(), clang::ento::ObjCMethodCall::getOriginExpr(), getParameterLocation(), getProgramPoint(), getResultType(), getReturnValue(), getReturnValueUnderConstruction(), getSourceRange(), invalidateRegions(), and isArgumentConstructedDirectly().
const ParamVarRegion * CallEvent::getParameterLocation | ( | unsigned | Index, |
unsigned | BlockCount | ||
) | const |
Returns memory location for a parameter variable within the callee stack frame.
The behavior is undefined if the block count is different from the one that is there when call happens. May fail; returns null on failure.
Definition at line 194 of file CallEvent.cpp.
References getCalleeStackFrame(), and getOriginExpr().
Referenced by invalidateRegions().
ProgramPoint CallEvent::getProgramPoint | ( | bool | IsPreVisit = false , |
const ProgramPointTag * | Tag = nullptr |
||
) | const |
Returns an appropriate ProgramPoint for this call.
Definition at line 288 of file CallEvent.cpp.
References D, E, clang::SourceRange::getBegin(), getDecl(), getLocationContext(), getOriginExpr(), and getSourceRange().
QualType CallEvent::getResultType | ( | ) | const |
Returns the result type, adjusted for references.
Definition at line 71 of file CallEvent.cpp.
References E, getOriginExpr(), clang::ASTContext::getReferenceQualifiedType(), getState(), and clang::ASTContext::VoidTy.
Referenced by clang::ento::retaincountchecker::RetainCountChecker::checkSummary(), and updateOutParameters().
SVal CallEvent::getReturnValue | ( | ) | const |
Returns the return value of the call.
This should only be called if the CallEvent was created using a state in which the return value has already been bound to the origin expression.
Definition at line 322 of file CallEvent.cpp.
References E, getOriginExpr(), and getSVal().
Referenced by clang::ento::retaincountchecker::RetainCountChecker::checkSummary(), clang::ento::retaincountchecker::RetainCountChecker::processSummaryOfInlined(), and updateOutParameters().
std::optional< SVal > CallEvent::getReturnValueUnderConstruction | ( | ) | const |
If the call returns a C++ record type then the region of its return value can be retrieved from its construction context.
Definition at line 540 of file CallEvent.cpp.
References clang::ento::ExprEngine::computeObjectUnderConstruction(), clang::ento::ExprEngine::getBuilderContext(), getConstructionContext(), getLocationContext(), getOriginExpr(), and getState().
|
pure virtual |
Returns the definition of the function or method that will be called.
Implemented in clang::ento::AnyFunctionCall, clang::ento::BlockCall, clang::ento::CXXInstanceCall, clang::ento::CXXMemberCall, clang::ento::CXXDestructorCall, and clang::ento::ObjCMethodCall.
|
inlinevirtual |
Returns a source range for the entire call, suitable for outputting in diagnostics.
Reimplemented in clang::ento::CXXDestructorCall, and clang::ento::ObjCMethodCall.
Definition at line 284 of file CallEvent.h.
References getOriginExpr(), and clang::Stmt::getSourceRange().
Referenced by getProgramPoint(), clang::ento::mpi::MPIBugReporter::reportDoubleNonblocking(), and clang::ento::mpi::MPIBugReporter::reportUnmatchedWait().
|
inline |
The state in which the call is being evaluated.
Definition at line 235 of file CallEvent.h.
Referenced by clang::ento::ObjCMethodCall::canBeOverridenInSubclass(), dump(), clang::ento::CXXInheritedConstructorCall::getArgSVal(), clang::ento::CXXAllocatorCall::getArraySizeVal(), clang::ento::CXXInstanceCall::getCXXThisVal(), clang::ento::ObjCMethodCall::getExtraInvalidatedValues(), clang::ento::AnyFunctionCall::getInitialStackFrameContents(), clang::ento::BlockCall::getInitialStackFrameContents(), clang::ento::CXXInstanceCall::getInitialStackFrameContents(), clang::ento::AnyCXXConstructorCall::getInitialStackFrameContents(), clang::ento::ObjCMethodCall::getInitialStackFrameContents(), clang::ento::CXXAllocatorCall::getObjectUnderConstruction(), clang::ento::ObjCMethodCall::getReceiverSVal(), getResultType(), getReturnValueUnderConstruction(), clang::ento::AnyFunctionCall::getRuntimeDefinition(), clang::ento::CXXInstanceCall::getRuntimeDefinition(), clang::ento::ObjCMethodCall::getRuntimeDefinition(), getSVal(), invalidateRegions(), isArgumentConstructedDirectly(), isInSystemHeader(), and clang::ento::ObjCMethodCall::isReceiverSelfOrSuper().
Get the value of arbitrary expressions at this point in the path.
Definition at line 202 of file CallEvent.h.
References getLocationContext(), and getState().
Referenced by getArgSVal(), clang::ento::BlockCall::getBlockRegion(), clang::ento::CXXInstanceCall::getCXXThisVal(), clang::ento::SimpleFunctionCall::getDecl(), clang::ento::CXXInstanceCall::getDecl(), clang::ento::ObjCMethodCall::getReceiverSVal(), getReturnValue(), and clang::ento::ObjCMethodCall::isReceiverSelfOrSuper().
Returns true if the type of any of the non-null arguments satisfies the condition.
Definition at line 113 of file CallEvent.cpp.
References clang::Condition, E, getArgSVal(), getDecl(), getNumArgs(), isZeroConstant(), param_type_begin(), and param_type_end().
Referenced by hasNonZeroCallbackArg(), and hasVoidPointerToNonConstArg().
bool CallEvent::hasNonZeroCallbackArg | ( | ) | const |
Returns true if any of the arguments appear to represent callbacks.
Definition at line 136 of file CallEvent.cpp.
References hasNonNullArgumentsWithType(), and isCallback().
Referenced by argumentsMayEscape().
bool CallEvent::hasVoidPointerToNonConstArg | ( | ) | const |
Returns true if any of the arguments is void*.
Definition at line 140 of file CallEvent.cpp.
References hasNonNullArgumentsWithType(), and isVoidPointerToNonConst().
Referenced by clang::ento::AnyFunctionCall::argumentsMayEscape().
ProgramStateRef CallEvent::invalidateRegions | ( | unsigned | BlockCount, |
ProgramStateRef | Orig = nullptr |
||
) | const |
Returns a new state with all argument regions invalidated.
This accepts an alternate state in case some processing has already occurred.
Definition at line 233 of file CallEvent.cpp.
References argumentsMayEscape(), clang::ento::CE_CXXAllocator, findPtrToConstParams(), getAdjustedParameterIndex(), getArgSVal(), getDecl(), getExtraInvalidatedValues(), getKind(), getLocationContext(), getNumArgs(), getOriginExpr(), getParameterLocation(), getState(), isArgumentConstructedDirectly(), clang::Result, clang::ento::RegionAndSymbolInvalidationTraits::setTrait(), and clang::ento::RegionAndSymbolInvalidationTraits::TK_PreserveContents.
Returns true if on the current path, the argument was constructed by calling a C++ constructor over it.
This is an internal detail of the analysis which doesn't necessarily represent the program semantics: if we are supposed to construct an argument directly, we may still not do that because we don't know how (i.e., construction context is unavailable in the CFG or not supported by the analyzer).
Definition at line 422 of file CallEvent.h.
References getLocationContext(), clang::ento::ExprEngine::getObjectUnderConstruction(), getOriginExpr(), and getState().
Referenced by invalidateRegions().
bool CallEvent::isCalledFromSystemHeader | ( | ) | const |
Definition at line 533 of file CallEvent.cpp.
References getCaller().
Returns true if this is a statement is a function or method call of some kind.
Definition at line 347 of file CallEvent.cpp.
Referenced by shouldRemoveDeadBindings().
|
inline |
Definition at line 228 of file CallEvent.h.
bool CallEvent::isGlobalCFunction | ( | StringRef | SpecificName = StringRef() | ) | const |
Returns true if the callee is an externally-visible function in the top-level namespace, such as malloc
.
You can use this call to determine that a particular function really is a library function and not, say, a C++ member function with the same name.
If a name is provided, the function must additionally match the given name.
Note that this deliberately excludes C++ library functions in the std
namespace, but will include C library functions accessed through the std
namespace. This also does not check if the function is declared as 'extern "C"', or if it uses C++ name mangling.
Definition at line 144 of file CallEvent.cpp.
References getDecl(), and clang::ento::CheckerContext::isCLibraryFunction().
|
inline |
Returns true if the callee is known to be from a system header.
Definition at line 262 of file CallEvent.h.
References D, getDecl(), getState(), clang::ento::DefinedSVal::isValid(), and SM.
Referenced by clang::ento::ObjCMethodCall::argumentsMayEscape().
Returns true if the given decl is known to be variadic.
D
must not be null.
Definition at line 380 of file CallEvent.cpp.
References D.
Referenced by clang::ento::ExprEngine::computeObjectUnderConstruction().
|
inline |
Returns an iterator over the types of the call's formal parameters.
This uses the callee decl found by default name lookup rather than the definition because it represents a public interface, and probably has more annotations.
Definition at line 484 of file CallEvent.h.
References parameters().
Referenced by hasNonNullArgumentsWithType().
|
inline |
Definition at line 488 of file CallEvent.h.
References parameters().
Referenced by hasNonNullArgumentsWithType().
|
pure virtual |
Return call's formal parameters.
Remember that the number of formal parameters may not match the number of arguments for all calls. However, the first parameter will always correspond with the argument value returned by getArgSVal(0)
.
Implemented in clang::ento::AnyFunctionCall, clang::ento::BlockCall, and clang::ento::ObjCMethodCall.
Referenced by param_type_begin(), param_type_end(), and shouldEscapeOSArgumentOnCall().
|
inline |
Definition at line 232 of file CallEvent.h.
|
friend |
Definition at line 182 of file CallEvent.h.
|
friend |
Definition at line 174 of file CallEvent.h.
|
protected |
Definition at line 166 of file CallEvent.h.
Referenced by clang::ento::AnyCXXConstructorCall::AnyCXXConstructorCall(), clang::ento::CXXDestructorCall::CXXDestructorCall(), clang::ento::AnyCXXConstructorCall::getCXXThisVal(), clang::ento::CXXDestructorCall::getCXXThisVal(), clang::ento::ObjCMethodCall::getMessageKind(), clang::ento::CXXDestructorCall::isBaseDestructor(), and clang::ento::ObjCMethodCall::ObjCMethodCall().
|
protected |
Definition at line 171 of file CallEvent.h.
Referenced by clang::ento::CXXDestructorCall::CXXDestructorCall(), and clang::ento::CXXDestructorCall::getSourceRange().