clang
7.0.0
|
Represents a call to any sort of function that might have a FunctionDecl. More...
#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
Public Member Functions | |
const FunctionDecl * | getDecl () const override |
Returns the declaration of the function or method that will be called. More... | |
RuntimeDefinition | getRuntimeDefinition () const override |
Returns the definition of the function or method that will be called. More... | |
bool | argumentsMayEscape () const override |
Returns true if any of the arguments are known to escape to long- term storage, even if this method will not modify them. More... | |
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 call. More... | |
ArrayRef< ParmVarDecl * > | parameters () const override |
Return call's formal parameters. More... | |
![]() | |
CallEvent & | operator= (const CallEvent &)=delete |
virtual | ~CallEvent ()=default |
virtual Kind | getKind () const =0 |
Returns the kind of call this is. More... | |
const ProgramStateRef & | getState () const |
The state in which the call is being evaluated. More... | |
const LocationContext * | getLocationContext () const |
The context in which the call is being evaluated. More... | |
const Expr * | getOriginExpr () const |
Returns the expression whose value will be the result of this call. More... | |
virtual unsigned | getNumArgs () const =0 |
Returns the number of arguments (explicit and implicit). More... | |
bool | isInSystemHeader () const |
Returns true if the callee is known to be from a system header. More... | |
bool | isCalled (const CallDescription &CD) const |
Returns true if the CallEvent is a call to a function that matches the CallDescription. More... | |
virtual SourceRange | getSourceRange () const |
Returns a source range for the entire call, suitable for outputting in diagnostics. More... | |
virtual SVal | getArgSVal (unsigned Index) const |
Returns the value of a given argument at the time of the call. More... | |
virtual const Expr * | getArgExpr (unsigned Index) const |
Returns the expression associated with a given argument. More... | |
virtual SourceRange | getArgSourceRange (unsigned Index) const |
Returns the source range for errors associated with this argument. More... | |
QualType | getResultType () const |
Returns the result type, adjusted for references. More... | |
SVal | getReturnValue () const |
Returns the return value of the call. More... | |
bool | hasNonNullArgumentsWithType (bool(*Condition)(QualType)) const |
Returns true if the type of any of the non-null arguments satisfies the condition. More... | |
bool | hasNonZeroCallbackArg () const |
Returns true if any of the arguments appear to represent callbacks. More... | |
bool | hasVoidPointerToNonConstArg () const |
Returns true if any of the arguments is void*. More... | |
bool | isGlobalCFunction (StringRef SpecificName=StringRef()) const |
Returns true if the callee is an externally-visible function in the top-level namespace, such as malloc . More... | |
const IdentifierInfo * | getCalleeIdentifier () const |
Returns the name of the callee, if its name is a simple identifier. More... | |
ProgramPoint | getProgramPoint (bool IsPreVisit=false, const ProgramPointTag *Tag=nullptr) const |
Returns an appropriate ProgramPoint for this call. More... | |
ProgramStateRef | invalidateRegions (unsigned BlockCount, ProgramStateRef Orig=nullptr) const |
Returns a new state with all argument regions invalidated. More... | |
template<typename T > | |
CallEventRef< T > | cloneWithState (ProgramStateRef NewState) const |
Returns a copy of this CallEvent, but using the given state. More... | |
CallEventRef | cloneWithState (ProgramStateRef NewState) const |
Returns a copy of this CallEvent, but using the given state. More... | |
AnalysisDeclContext * | getCalleeAnalysisDeclContext () const |
Returns AnalysisDeclContext for the callee stack frame. More... | |
const StackFrameContext * | getCalleeStackFrame () const |
Returns the callee stack frame. More... | |
const VarRegion * | getParameterLocation (unsigned Index) const |
Returns memory location for a parameter variable within the callee stack frame. More... | |
bool | isArgumentConstructedDirectly (unsigned Index) const |
Returns true if on the current path, the argument was constructed by calling a C++ constructor over it. More... | |
Optional< unsigned > | getAdjustedParameterIndex (unsigned ArgumentIndex) const |
Some calls have parameter numbering mismatched from argument numbering. More... | |
param_type_iterator | param_type_begin () const |
Returns an iterator over the types of the call's formal parameters. More... | |
param_type_iterator | param_type_end () const |
void | dump (raw_ostream &Out) const |
void | dump () const |
template<typename T > | |
CallEventRef< T > | cloneWithState (ProgramStateRef NewState) const |
Static Public Member Functions | |
static bool | classof (const CallEvent *CA) |
![]() | |
static bool | isCallStmt (const Stmt *S) |
Returns true if this is a statement is a function or method call of some kind. More... | |
static QualType | getDeclaredResultType (const Decl *D) |
Returns the result type of a function or method declaration. More... | |
static bool | isVariadic (const Decl *D) |
Returns true if the given decl is known to be variadic. More... | |
Protected Member Functions | |
AnyFunctionCall (const Expr *E, ProgramStateRef St, const LocationContext *LCtx) | |
AnyFunctionCall (const Decl *D, ProgramStateRef St, const LocationContext *LCtx) | |
AnyFunctionCall (const AnyFunctionCall &Other)=default | |
![]() | |
CallEvent (const Expr *E, ProgramStateRef state, const LocationContext *lctx) | |
CallEvent (const Decl *D, ProgramStateRef state, const LocationContext *lctx) | |
CallEvent (const CallEvent &Original) | |
virtual void | cloneTo (void *Dest) const =0 |
Copies this CallEvent, with vtable intact, into a new block of memory. More... | |
SVal | getSVal (const Stmt *S) const |
Get the value of arbitrary expressions at this point in the path. More... | |
virtual void | getExtraInvalidatedValues (ValueList &Values, RegionAndSymbolInvalidationTraits *ETraits) const |
Used to specify non-argument regions that will be invalidated as a result of this call. More... | |
Additional Inherited Members | |
![]() | |
using | Kind = CallEventKind |
using | FrameBindingTy = std::pair< Loc, SVal > |
using | BindingsTy = SmallVectorImpl< FrameBindingTy > |
using | param_type_iterator = llvm::mapped_iterator< ArrayRef< ParmVarDecl * >::iterator, GetTypeFn > |
![]() | |
using | ValueList = SmallVectorImpl< SVal > |
![]() | |
const void * | Data |
SourceLocation | Location |
Represents a call to any sort of function that might have a FunctionDecl.
Definition at line 485 of file CallEvent.h.
|
inlineprotected |
Definition at line 487 of file CallEvent.h.
|
inlineprotected |
Definition at line 490 of file CallEvent.h.
|
protecteddefault |
|
overridevirtual |
Returns true if any of the arguments are known to escape to long- term storage, even if this method will not modify them.
Reimplemented from clang::ento::CallEvent.
Definition at line 507 of file CallEvent.cpp.
References clang::ento::CallEvent::argumentsMayEscape(), clang::ento::CallEvent::getDecl(), clang::NamedDecl::getIdentifier(), clang::IdentifierInfo::getName(), clang::ento::CallEvent::hasVoidPointerToNonConstArg(), and clang::IdentifierInfo::isStr().
Definition at line 511 of file CallEvent.h.
References clang::ento::CE_BEG_FUNCTION_CALLS, clang::ento::CE_END_FUNCTION_CALLS, and clang::ento::CallEvent::getKind().
|
inlineoverridevirtual |
Returns the declaration of the function or method that will be called.
May be null.
Reimplemented from clang::ento::CallEvent.
Reimplemented in clang::ento::SimpleFunctionCall.
Definition at line 498 of file CallEvent.h.
References clang::ento::CallEvent::getDecl().
Referenced by clang::CXXInstanceCall::getDecl().
|
overridevirtual |
Populates the given SmallVector with the bindings in the callee's stack frame at the start of this call.
Implements clang::ento::CallEvent.
Definition at line 498 of file CallEvent.cpp.
References addParameterValuesToBindings(), clang::LocationContext::getDecl(), and clang::ento::CallEvent::getState().
Referenced by clang::CXXInstanceCall::getInitialStackFrameContents(), and clang::CXXConstructorCall::getInitialStackFrameContents().
|
overridevirtual |
Returns the definition of the function or method that will be called.
Implements clang::ento::CallEvent.
Definition at line 453 of file CallEvent.cpp.
References clang::cross_tu::CrossTranslationUnitContext::emitCrossTUDiagnostics(), clang::LocationContext::getAnalysisDeclContext(), clang::ento::SubEngine::getAnalysisManager(), clang::AnalysisDeclContext::getBody(), clang::ento::SubEngine::getCrossTranslationUnitContext(), clang::cross_tu::CrossTranslationUnitContext::getCrossTUDefinition(), clang::AnalyzerOptions::getCTUDir(), clang::AnalyzerOptions::getCTUIndexName(), clang::AnalysisDeclContext::getDecl(), clang::ento::CallEvent::getDecl(), clang::ento::CallEvent::getLocationContext(), clang::NamedDecl::getName(), clang::ento::CallEvent::getState(), clang::AnalyzerOptions::naiveCTUEnabled(), and clang::ento::AnalysisManager::options.
Referenced by clang::CXXInstanceCall::getRuntimeDefinition(), clang::CXXMemberCall::getRuntimeDefinition(), and clang::CXXDestructorCall::getRuntimeDefinition().
|
overridevirtual |
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)
.
Implements clang::ento::CallEvent.
Definition at line 446 of file CallEvent.cpp.
References clang::ento::CallEvent::getDecl(), and clang::FunctionDecl::parameters().