Represents an abstract call to a function or method along a particular path. More...
#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
malloc
.
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.
◆ BindingsTy ◆ FrameBindingTy ◆ Kind ◆ param_type_iterator ◆ ValueList ◆ CallEvent() [1/3] ◆ CallEvent() [2/3] ◆ CallEvent() [3/3] clang::ento::CallEvent::CallEvent ( const CallEvent & Original ) inlineprotectedDefinition at line 193 of file CallEvent.h.
◆ ~CallEvent() virtual clang::ento::CallEvent::~CallEvent ( ) virtualdefault ◆ argumentsMayEscape() virtual bool clang::ento::CallEvent::argumentsMayEscape ( ) const inlinevirtual ◆ cloneTo() virtual void clang::ento::CallEvent::cloneTo ( void * Dest ) const protectedpure virtualCopies 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().
◆ cloneWithState() [1/2] ◆ cloneWithState() [2/2] ◆ dump() [1/2] LLVM_DUMP_METHOD void CallEvent::dump ( ) const ◆ dump() [2/2] void CallEvent::dump ( raw_ostream & Out ) const ◆ getAdjustedParameterIndex() virtual std::optional< unsigned > clang::ento::CallEvent::getAdjustedParameterIndex ( unsigned ASTArgumentIndex ) const inlinevirtual ◆ getArgExpr() virtual const Expr * clang::ento::CallEvent::getArgExpr ( unsigned Index ) const inlinevirtualReturns 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().
◆ getArgSourceRange() ◆ getArgSVal() ◆ getASTArgumentIndex() virtual unsigned clang::ento::CallEvent::getASTArgumentIndex ( unsigned CallArgumentIndex ) const inlinevirtual ◆ getCalleeAnalysisDeclContext() ◆ getCalleeIdentifier() const IdentifierInfo * clang::ento::CallEvent::getCalleeIdentifier ( ) const inline ◆ getCalleeStackFrame()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 165 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().
◆ getCaller() ◆ getCFGElementRef() ◆ getConstructionContext() ◆ getDecl() virtual const Decl * clang::ento::CallEvent::getDecl ( ) const inlinevirtualReturns 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().
◆ getDeclaredResultType() QualType CallEvent::getDeclaredResultType ( const Decl * D ) static ◆ getExtraInvalidatedValues() ◆ getInitialStackFrameContents() ◆ getKind() virtual Kind clang::ento::CallEvent::getKind ( ) const pure virtualReturns 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().
◆ getKindAsString() virtual StringRef clang::ento::CallEvent::getKindAsString ( ) const pure virtualImplemented 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().
◆ getLocationContext() const LocationContext * clang::ento::CallEvent::getLocationContext ( ) const inlineThe 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().
◆ getNumArgs() virtual unsigned clang::ento::CallEvent::getNumArgs ( ) const pure virtualReturns 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().
◆ getOriginExpr() virtual const Expr * clang::ento::CallEvent::getOriginExpr ( ) const inlinevirtualReturns 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().
◆ getParameterLocation() ◆ getProgramPoint() ◆ getResultType() QualType CallEvent::getResultType ( ) const ◆ getReturnValue() SVal CallEvent::getReturnValue ( ) const ◆ getReturnValueUnderConstruction() std::optional< SVal > CallEvent::getReturnValueUnderConstruction ( ) const ◆ getRuntimeDefinition() ◆ getSourceRange() virtual SourceRange clang::ento::CallEvent::getSourceRange ( ) const inlinevirtual ◆ getState()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::CXXInstanceCall::getDeclForDynamicType(), 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::ObjCMethodCall::getRuntimeDefinition(), getSVal(), invalidateRegions(), isArgumentConstructedDirectly(), isInSystemHeader(), and clang::ento::ObjCMethodCall::isReceiverSelfOrSuper().
◆ getSVal() SVal clang::ento::CallEvent::getSVal ( const Stmt * S ) const inlineprotected ◆ hasNonNullArgumentsWithType() bool CallEvent::hasNonNullArgumentsWithType ( bool(*)(QualType) Condition ) const ◆ hasNonZeroCallbackArg() bool CallEvent::hasNonZeroCallbackArg ( ) const ◆ hasVoidPointerToNonConstArg() bool CallEvent::hasVoidPointerToNonConstArg ( ) const ◆ invalidateRegions()Returns a new state with all argument regions invalidated.
This accepts an alternate state in case some processing has already occurred.
Definition at line 234 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.
◆ isArgumentConstructedDirectly() bool clang::ento::CallEvent::isArgumentConstructedDirectly ( unsigned Index ) const inline ◆ isCalledFromSystemHeader() bool CallEvent::isCalledFromSystemHeader ( ) const ◆ isCallStmt() bool CallEvent::isCallStmt ( const Stmt * S ) static ◆ isForeign() bool clang::ento::CallEvent::isForeign ( ) const inlineDefinition at line 228 of file CallEvent.h.
◆ isGlobalCFunction() 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 145 of file CallEvent.cpp.
References getDecl(), and clang::ento::CheckerContext::isCLibraryFunction().
◆ isInSystemHeader() bool clang::ento::CallEvent::isInSystemHeader ( ) const inline ◆ isVariadic() bool CallEvent::isVariadic ( const Decl * D ) static ◆ operator=() ◆ param_type_begin()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().
◆ param_type_end() ◆ parameters() ◆ setForeign() void clang::ento::CallEvent::setForeign ( bool B ) const inlineDefinition at line 232 of file CallEvent.h.
◆ CallEventManager ◆ llvm::IntrusiveRefCntPtrInfo ◆ Data const void* clang::ento::CallEvent::Data protected ◆ LocationThe documentation for this class was generated from the following files:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4