class CallEvent
Declaration
class CallEvent { /* full declaration omitted */ };
Description
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.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:148
Member Variables
- private clang::ento::ProgramStateRef State
- private const clang::LocationContext* LCtx
- private llvm::PointerUnion<const Expr*, const Decl*> Origin
- private Optional<bool> Foreign
- protected const void* Data
- protected clang::SourceLocation Location
- private unsigned int RefCount = 0
Method Overview
- protected CallEvent(const clang::Expr * E, clang::ento::ProgramStateRef state, const clang::LocationContext * lctx)
- protected CallEvent(const clang::Decl * D, clang::ento::ProgramStateRef state, const clang::LocationContext * lctx)
- protected CallEvent(const clang::ento::CallEvent & Original)
- private void Release() const
- private void Retain() const
- public virtual bool argumentsMayEscape() const
- protected virtual void cloneTo(void * Dest) const
- public template <typename T>CallEventRef<T> cloneWithState(clang::ento::ProgramStateRef NewState) const
- public CallEventRef<> cloneWithState(clang::ento::ProgramStateRef NewState) const
- public void dump() const
- public void dump(llvm::raw_ostream & Out) const
- public virtual unsigned int getASTArgumentIndex(unsigned int CallArgumentIndex) const
- public virtual Optional<unsigned int> getAdjustedParameterIndex(unsigned int ASTArgumentIndex) const
- public virtual const clang::Expr * getArgExpr(unsigned int Index) const
- public virtual clang::ento::SVal getArgSVal(unsigned int Index) const
- public virtual clang::SourceRange getArgSourceRange(unsigned int Index) const
- public clang::AnalysisDeclContext * getCalleeAnalysisDeclContext() const
- public const clang::IdentifierInfo * getCalleeIdentifier() const
- public const clang::StackFrameContext * getCalleeStackFrame(unsigned int BlockCount) const
- public const clang::ConstructionContext * getConstructionContext() const
- public virtual const clang::Decl * getDecl() const
- public static clang::QualType getDeclaredResultType(const clang::Decl * D)
- protected virtual void getExtraInvalidatedValues(clang::ento::CallEvent::ValueList & Values, clang::ento::RegionAndSymbolInvalidationTraits * ETraits) const
- public virtual void getInitialStackFrameContents(const clang::StackFrameContext * CalleeCtx, clang::ento::CallEvent::BindingsTy & Bindings) const
- public virtual clang::ento::CallEvent::Kind getKind() const
- public virtual llvm::StringRef getKindAsString() const
- public const clang::LocationContext * getLocationContext() const
- public virtual unsigned int getNumArgs() const
- public virtual const clang::Expr * getOriginExpr() const
- public const clang::ento::ParamVarRegion * getParameterLocation(unsigned int Index, unsigned int BlockCount) const
- public clang::ProgramPoint getProgramPoint(bool IsPreVisit = false, const clang::ProgramPointTag * Tag = nullptr) const
- public clang::QualType getResultType() const
- public clang::ento::SVal getReturnValue() const
- public Optional<clang::ento::SVal> getReturnValueUnderConstruction() const
- public virtual clang::ento::RuntimeDefinition getRuntimeDefinition() const
- protected clang::ento::SVal getSVal(const clang::Stmt * S) const
- public virtual clang::SourceRange getSourceRange() const
- public const clang::ento::ProgramStateRef & getState() const
- public bool hasNonNullArgumentsWithType(bool (*)(clang::QualType) Condition) const
- public bool hasNonZeroCallbackArg() const
- public bool hasVoidPointerToNonConstArg() const
- public clang::ento::ProgramStateRef invalidateRegions(unsigned int BlockCount, clang::ento::ProgramStateRef Orig = nullptr) const
- public bool isArgumentConstructedDirectly(unsigned int Index) const
- public static bool isCallStmt(const clang::Stmt * S)
- public bool isForeign() const
- public bool isGlobalCFunction(llvm::StringRef SpecificName = llvm::StringRef()) const
- public bool isInSystemHeader() const
- public static bool isVariadic(const clang::Decl * D)
- public clang::ento::CallEvent::param_type_iterator param_type_begin() const
- public clang::ento::CallEvent::param_type_iterator param_type_end() const
- public virtual ArrayRef<clang::ParmVarDecl *> parameters() const
- public void setForeign(bool B) const
- public virtual ~CallEvent()
Methods
¶CallEvent(const clang::Expr* E,
clang::ento::ProgramStateRef state,
const clang::LocationContext* lctx)
CallEvent(const clang::Expr* E,
clang::ento::ProgramStateRef state,
const clang::LocationContext* lctx)
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:178
Parameters
- const clang::Expr* E
- clang::ento::ProgramStateRef state
- const clang::LocationContext* lctx
¶CallEvent(const clang::Decl* D,
clang::ento::ProgramStateRef state,
const clang::LocationContext* lctx)
CallEvent(const clang::Decl* D,
clang::ento::ProgramStateRef state,
const clang::LocationContext* lctx)
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:181
Parameters
- const clang::Decl* D
- clang::ento::ProgramStateRef state
- const clang::LocationContext* lctx
¶CallEvent(const clang::ento::CallEvent& Original)
CallEvent(const clang::ento::CallEvent& Original)
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:185
Parameters
- const clang::ento::CallEvent& Original
¶void Release() const
void Release() const
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:173
¶void Retain() const
void Retain() const
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:172
¶virtual bool argumentsMayEscape() const
virtual bool argumentsMayEscape() const
Description
Returns true if any of the arguments are known to escape to long- term storage, even if this method will not modify them.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:314
¶virtual void cloneTo(void* Dest) const
virtual void cloneTo(void* Dest) const
Description
Copies this CallEvent, with vtable intact, into a new block of memory.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:190
Parameters
- void* Dest
¶template <typename T>
CallEventRef<T> cloneWithState(
clang::ento::ProgramStateRef NewState) const
template <typename T>
CallEventRef<T> cloneWithState(
clang::ento::ProgramStateRef NewState) const
Description
Returns a copy of this CallEvent, but using the given state.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:371
Templates
- T
Parameters
- clang::ento::ProgramStateRef NewState
¶CallEventRef<> cloneWithState(
clang::ento::ProgramStateRef NewState) const
CallEventRef<> cloneWithState(
clang::ento::ProgramStateRef NewState) const
Description
Returns a copy of this CallEvent, but using the given state.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:374
Parameters
- clang::ento::ProgramStateRef NewState
¶void dump() const
void dump() const
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:478
¶void dump(llvm::raw_ostream& Out) const
void dump(llvm::raw_ostream& Out) const
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:477
Parameters
- llvm::raw_ostream& Out
¶virtual unsigned int getASTArgumentIndex(
unsigned int CallArgumentIndex) const
virtual unsigned int getASTArgumentIndex(
unsigned int CallArgumentIndex) const
Description
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.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:433
Parameters
- unsigned int CallArgumentIndex
¶virtual Optional<unsigned int>
getAdjustedParameterIndex(
unsigned int ASTArgumentIndex) const
virtual Optional<unsigned int>
getAdjustedParameterIndex(
unsigned int ASTArgumentIndex) const
Description
Some calls have parameter numbering mismatched from argument numbering. This function converts an argument index to the corresponding parameter index. Returns None is the argument doesn't correspond to any parameter variable.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:426
Parameters
- unsigned int ASTArgumentIndex
¶virtual const clang::Expr* getArgExpr(
unsigned int Index) const
virtual const clang::Expr* getArgExpr(
unsigned int Index) const
Description
Returns the expression associated with a given argument. May be null if this expression does not appear in the source.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:283
Parameters
- unsigned int Index
¶virtual clang::ento::SVal getArgSVal(
unsigned int Index) const
virtual clang::ento::SVal getArgSVal(
unsigned int Index) const
Description
Returns the value of a given argument at the time of the call.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:279
Parameters
- unsigned int Index
¶virtual clang::SourceRange getArgSourceRange(
unsigned int Index) const
virtual clang::SourceRange getArgSourceRange(
unsigned int Index) const
Description
Returns the source range for errors associated with this argument. May be invalid if the argument is not written in the source.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:288
Parameters
- unsigned int Index
¶clang::AnalysisDeclContext*
getCalleeAnalysisDeclContext() const
clang::AnalysisDeclContext*
getCalleeAnalysisDeclContext() const
Description
Returns AnalysisDeclContext for the callee stack frame. Currently may fail; returns null on failure.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:394
¶const clang::IdentifierInfo* getCalleeIdentifier()
const
const clang::IdentifierInfo* getCalleeIdentifier()
const
Description
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.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:343
¶const clang::StackFrameContext*
getCalleeStackFrame(unsigned int BlockCount) const
const clang::StackFrameContext*
getCalleeStackFrame(unsigned int BlockCount) const
Description
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.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:400
Parameters
- unsigned int BlockCount
¶const clang::ConstructionContext*
getConstructionContext() const
const clang::ConstructionContext*
getConstructionContext() const
Description
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.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:440
¶virtual const clang::Decl* getDecl() const
virtual const clang::Decl* getDecl() const
Description
Returns the declaration of the function or method that will be called. May be null.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:214
¶static clang::QualType getDeclaredResultType(
const clang::Decl* D)
static clang::QualType getDeclaredResultType(
const clang::Decl* D)
Description
Returns the result type of a function or method declaration. This will return a null QualType if the result type cannot be determined.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:385
Parameters
- const clang::Decl* D
¶virtual void getExtraInvalidatedValues(
clang::ento::CallEvent::ValueList& Values,
clang::ento::
RegionAndSymbolInvalidationTraits*
ETraits) const
virtual void getExtraInvalidatedValues(
clang::ento::CallEvent::ValueList& Values,
clang::ento::
RegionAndSymbolInvalidationTraits*
ETraits) const
Description
Used to specify non-argument regions that will be invalidated as a result of this call.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:201
Parameters
¶virtual void getInitialStackFrameContents(
const clang::StackFrameContext* CalleeCtx,
clang::ento::CallEvent::BindingsTy& Bindings)
const
virtual void getInitialStackFrameContents(
const clang::StackFrameContext* CalleeCtx,
clang::ento::CallEvent::BindingsTy& Bindings)
const
Description
Populates the given SmallVector with the bindings in the callee's stack frame at the start of this call.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:366
Parameters
- const clang::StackFrameContext* CalleeCtx
- clang::ento::CallEvent::BindingsTy& Bindings
¶virtual clang::ento::CallEvent::Kind getKind()
const
virtual clang::ento::CallEvent::Kind getKind()
const
Description
Returns the kind of call this is.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:209
¶virtual llvm::StringRef getKindAsString() const
virtual llvm::StringRef getKindAsString() const
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:210
¶const clang::LocationContext* getLocationContext()
const
const clang::LocationContext* getLocationContext()
const
Description
The context in which the call is being evaluated.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:230
¶virtual unsigned int getNumArgs() const
virtual unsigned int getNumArgs() const
Description
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.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:249
¶virtual const clang::Expr* getOriginExpr() const
virtual const clang::Expr* getOriginExpr() const
Description
Returns the expression whose value will be the result of this call. May be null.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:240
¶const clang::ento::ParamVarRegion*
getParameterLocation(
unsigned int Index,
unsigned int BlockCount) const
const clang::ento::ParamVarRegion*
getParameterLocation(
unsigned int Index,
unsigned int BlockCount) const
Description
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.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:405
Parameters
- unsigned int Index
- unsigned int BlockCount
¶clang::ProgramPoint getProgramPoint(
bool IsPreVisit = false,
const clang::ProgramPointTag* Tag =
nullptr) const
clang::ProgramPoint getProgramPoint(
bool IsPreVisit = false,
const clang::ProgramPointTag* Tag =
nullptr) const
Description
Returns an appropriate ProgramPoint for this call.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:351
Parameters
- bool IsPreVisit = false
- const clang::ProgramPointTag* Tag = nullptr
¶clang::QualType getResultType() const
clang::QualType getResultType() const
Description
Returns the result type, adjusted for references.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:291
¶clang::ento::SVal getReturnValue() const
clang::ento::SVal getReturnValue() const
Description
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.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:297
¶Optional<clang::ento::SVal>
getReturnValueUnderConstruction() const
Optional<clang::ento::SVal>
getReturnValueUnderConstruction() const
Description
If the call returns a C++ record type then the region of its return value can be retrieved from its construction context.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:444
¶virtual clang::ento::RuntimeDefinition
getRuntimeDefinition() const
virtual clang::ento::RuntimeDefinition
getRuntimeDefinition() const
Description
Returns the definition of the function or method that will be called.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:236
¶clang::ento::SVal getSVal(
const clang::Stmt* S) const
clang::ento::SVal getSVal(
const clang::Stmt* S) const
Description
Get the value of arbitrary expressions at this point in the path.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:193
Parameters
- const clang::Stmt* S
¶virtual clang::SourceRange getSourceRange() const
virtual clang::SourceRange getSourceRange() const
Description
Returns a source range for the entire call, suitable for outputting in diagnostics.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:274
¶const clang::ento::ProgramStateRef& getState()
const
const clang::ento::ProgramStateRef& getState()
const
Description
The state in which the call is being evaluated.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:225
¶bool hasNonNullArgumentsWithType(
bool (*)(clang::QualType) Condition) const
bool hasNonNullArgumentsWithType(
bool (*)(clang::QualType) Condition) const
Description
Returns true if the type of any of the non-null arguments satisfies the condition.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:301
Parameters
- bool (*)(clang::QualType) Condition
¶bool hasNonZeroCallbackArg() const
bool hasNonZeroCallbackArg() const
Description
Returns true if any of the arguments appear to represent callbacks.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:304
¶bool hasVoidPointerToNonConstArg() const
bool hasVoidPointerToNonConstArg() const
Description
Returns true if any of the arguments is void*.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:307
¶clang::ento::ProgramStateRef invalidateRegions(
unsigned int BlockCount,
clang::ento::ProgramStateRef Orig =
nullptr) const
clang::ento::ProgramStateRef invalidateRegions(
unsigned int BlockCount,
clang::ento::ProgramStateRef Orig =
nullptr) const
Description
Returns a new state with all argument regions invalidated. This accepts an alternate state in case some processing has already occurred.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:358
Parameters
- unsigned int BlockCount
- clang::ento::ProgramStateRef Orig = nullptr
¶bool isArgumentConstructedDirectly(
unsigned int Index) const
bool isArgumentConstructedDirectly(
unsigned int Index) const
Description
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).
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:414
Parameters
- unsigned int Index
¶static bool isCallStmt(const clang::Stmt* S)
static bool isCallStmt(const clang::Stmt* S)
Description
Returns true if this is a statement is a function or method call of some kind.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:380
Parameters
- const clang::Stmt* S
¶bool isForeign() const
bool isForeign() const
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:218
¶bool isGlobalCFunction(
llvm::StringRef SpecificName =
llvm::StringRef()) const
bool isGlobalCFunction(
llvm::StringRef SpecificName =
llvm::StringRef()) const
Description
Returns true if the callee is an externally-visible function in the top-level namespace, such as \c 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 \c std namespace, but will include C library functions accessed through the\c std namespace. This also does not check if the function is declared as 'extern "C"', or if it uses C++ name mangling.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:334
Parameters
- llvm::StringRef SpecificName = llvm::StringRef()
¶bool isInSystemHeader() const
bool isInSystemHeader() const
Description
Returns true if the callee is known to be from a system header.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:252
¶static bool isVariadic(const clang::Decl* D)
static bool isVariadic(const clang::Decl* D)
Description
Returns true if the given decl is known to be variadic. \p D must not be null.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:390
Parameters
- const clang::Decl* D
¶clang::ento::CallEvent::param_type_iterator
param_type_begin() const
clang::ento::CallEvent::param_type_iterator
param_type_begin() const
Description
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.
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:468
¶clang::ento::CallEvent::param_type_iterator
param_type_end() const
clang::ento::CallEvent::param_type_iterator
param_type_end() const
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:472
¶virtual ArrayRef<clang::ParmVarDecl*> parameters()
const
virtual ArrayRef<clang::ParmVarDecl*> parameters()
const
Description
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 \c getArgSVal(0).
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:458
¶void setForeign(bool B) const
void setForeign(bool B) const
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:222
Parameters
- bool B
¶virtual ~CallEvent()
virtual ~CallEvent()
Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:206