14 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_STORE_H 15 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_STORE_H 20 #include "llvm/ADT/DenseSet.h" 28 class StackFrameContext;
34 class ProgramStateManager;
122 return getLValueFieldOrIvar(D, Base);
212 const Expr *E,
unsigned Count,
215 InvalidatedSymbols &IS,
217 InvalidatedRegions *InvalidatedTopLevel,
218 InvalidatedRegions *Invalidated) = 0;
232 virtual void print(
Store store, raw_ostream &Out,
233 const char* nl,
const char *sep) = 0;
250 : Sym(sym), Binding(nullptr), First(
true) {}
254 explicit operator bool() {
return First && Binding; }
270 QualType castTy,
bool performTestOnly =
true);
278 : store(store), mgr(smgr) {
284 : store(sr.store), mgr(sr.mgr)
296 assert(&newStore.mgr == &mgr);
297 if (store != newStore.store) {
306 std::unique_ptr<StoreManager>
308 std::unique_ptr<StoreManager>
SVal attemptDownCast(SVal Base, QualType DerivedPtrType, bool &Failed)
Attempts to do a down cast.
virtual DefinedOrUnknownSVal getSizeInElements(ProgramStateRef state, const MemRegion *region, QualType EleTy)
TypedValueRegion - An abstract class representing regions having a typed value.
SVal evalDerivedToBase(SVal Derived, const CastExpr *Cast)
Evaluates a chain of derived-to-base casts through the path specified in Cast.
A (possibly-)qualified type.
MemRegion - The root abstract class for all memory regions.
Information about invalidation for a particular region/symbol.
Decl - This represents one declaration (or definition), e.g.
FindUniqueBinding(SymbolRef sym)
const void * Store
Store - This opaque type encapsulates an immutable mapping from locations to values.
virtual StoreRef invalidateRegions(Store store, ArrayRef< SVal > Values, const Expr *E, unsigned Count, const LocationContext *LCtx, const CallEvent *Call, InvalidatedSymbols &IS, RegionAndSymbolInvalidationTraits &ITraits, InvalidatedRegions *InvalidatedTopLevel, InvalidatedRegions *Invalidated)=0
invalidateRegions - Clears out the specified regions from the store, marking their values as unknown...
Represents a path from a specific derived class (which is not represented as part of the path) to a p...
A utility class that visits the reachable symbols using a custom SymbolVisitor.
virtual StoreRef getInitialStore(const LocationContext *InitLoc)=0
getInitialStore - Returns the initial "empty" store representing the value bindings upon entry to an ...
VarDecl - An instance of this class is created to represent a variable declaration or definition...
CompoundLiteralExpr - [C99 6.5.2.5].
const ElementRegion * GetElementZeroRegion(const SubRegion *R, QualType T)
virtual SVal getBinding(Store store, Loc loc, QualType T=QualType())=0
Return the value bound to specified location in a given state.
std::unique_ptr< StoreManager > CreateFieldsOnlyRegionStoreManager(ProgramStateManager &StMgr)
const MemRegion * castRegion(const MemRegion *region, QualType CastToTy)
castRegion - Used by ExprEngine::VisitCast to handle casts from a MemRegion* to a specific location t...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
const MemRegion * getRegion()
i32 captured_struct **param SharedsTy A type which contains references the shared variables *param Shareds Context with the list of shared variables from the p *TaskFunction *param Data Additional data for task generation like final * state
Optional< SVal > getDefaultBinding(nonloc::LazyCompoundVal lcv)
Return the default value bound to a LazyCompoundVal.
virtual void decrementReferenceCount(Store store)
If the StoreManager supports it, decrement the reference count of the specified Store object...
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
virtual SVal getLValueField(const FieldDecl *D, SVal Base)
StoreRef enterStackFrame(Store store, const CallEvent &Call, const StackFrameContext *CalleeCtx)
enterStackFrame - Let the StoreManager to do something when execution engine is about to execute into...
virtual SVal getLValueIvar(const ObjCIvarDecl *decl, SVal base)
std::unique_ptr< StoreManager > CreateRegionStoreManager(ProgramStateManager &StMgr)
Loc makeLoc(SymbolRef sym)
Expr - This represents one expression.
const FunctionProtoType * T
SValBuilder & svalBuilder
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
virtual Loc getLValueVar(const VarDecl *VD, const LocationContext *LC)
virtual StoreRef removeDeadBindings(Store store, const StackFrameContext *LCtx, SymbolReaper &SymReaper)=0
StoreRef & operator=(StoreRef const &)
ProgramStateManager & StateMgr
virtual StoreRef Bind(Store store, Loc loc, SVal val)=0
Return a store with the specified value bound to the given location.
virtual Optional< SVal > getDefaultBinding(Store store, const MemRegion *R)=0
Return the default value bound to a region in a given store.
virtual StoreRef killBinding(Store ST, Loc L)=0
Create a new store with the specified binding removed.
SVal CastRetrievedVal(SVal val, const TypedValueRegion *region, QualType castTy, bool performTestOnly=true)
CastRetrievedVal - Used by subclasses of StoreManager to implement implicit casts that arise from loa...
SVal - This represents a symbolic expression, which can be either an L-value or an R-value...
virtual ~BindingsHandler()
A class responsible for cleaning up unused symbols.
const CompoundLiteralRegion * getCompoundLiteralRegion(const CompoundLiteralExpr *CL, const LocationContext *LC)
getCompoundLiteralRegion - Retrieve the region associated with a given CompoundLiteral.
llvm::DenseSet< SymbolRef > InvalidatedSymbols
Dataflow Directional Tag Classes.
virtual void iterBindings(Store store, BindingsHandler &f)=0
iterBindings - Iterate over the bindings in the Store.
const VarRegion * getVarRegion(const VarDecl *D, const LocationContext *LC)
getVarRegion - Retrieve or create the memory region associated with a specified VarDecl and LocationC...
const void * getStore() const
virtual bool includedInBindings(Store store, const MemRegion *region) const =0
virtual void print(Store store, raw_ostream &Out, const char *nl, const char *sep)=0
Represents an abstract call to a function or method along a particular path.
virtual bool scanReachableSymbols(Store S, const MemRegion *R, ScanReachableSymbols &Visitor)=0
Finds the transitive closure of symbols within the given region.
MemRegionManager & getRegionManager()
getRegionManager - Returns the internal RegionManager object that is used to query and manipulate Mem...
StoreRef(Store, StoreManager &)
SubRegion - A region that subsets another larger region.
virtual SVal ArrayToPointer(Loc Array, QualType ElementTy)=0
ArrayToPointer - Used by ExprEngine::VistCast to handle implicit conversions between arrays and point...
const ElementRegion * MakeElementRegion(const SubRegion *baseRegion, QualType pointeeTy, uint64_t index=0)
MemRegionManager & MRMgr
MRMgr - Manages region objects associated with this StoreManager.
virtual SVal getLValueElement(QualType elementType, NonLoc offset, SVal Base)
const TypedValueRegion * getRegion() const
virtual bool HandleBinding(StoreManager &SMgr, Store store, const MemRegion *region, SVal val)=0
ObjCIvarDecl - Represents an ObjC instance variable.
virtual void incrementReferenceCount(Store store)
If the StoreManager supports it, increment the reference count of the specified Store object...
virtual StoreRef BindDefault(Store store, const MemRegion *R, SVal V)
ElementRegin is used to represent both array elements and casts.
StoreManager(ProgramStateManager &stateMgr)
Loc getLValueCompoundLiteral(const CompoundLiteralExpr *CL, const LocationContext *LC)
SmallVector< const MemRegion *, 8 > InvalidatedRegions