13 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_STORE_H 14 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_STORE_H 24 #include "llvm/ADT/ArrayRef.h" 25 #include "llvm/ADT/DenseSet.h" 26 #include "llvm/ADT/Optional.h" 27 #include "llvm/ADT/SmallVector.h" 36 class CompoundLiteralExpr;
40 class LocationContext;
42 class StackFrameContext;
47 class ProgramStateManager;
48 class ScanReachableSymbols;
146 return getLValueFieldOrIvar(D, Base);
236 const Expr *E,
unsigned Count,
257 unsigned int Space,
bool IsDot)
const = 0;
276 explicit operator bool() {
return First && Binding; }
302 : store(store), mgr(smgr) {
308 : store(sr.store), mgr(sr.mgr)
320 assert(&newStore.mgr == &mgr);
321 if (store != newStore.store) {
330 std::unique_ptr<StoreManager>
332 std::unique_ptr<StoreManager>
339 #endif // LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_STORE_H
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.
bool Cast(InterpState &S, CodePtr OpPC)
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.
C Language Family Type Representation.
Decl - This represents one declaration (or definition), e.g.
FindUniqueBinding(SymbolRef sym)
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
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 BindDefaultZero(Store store, const MemRegion *R)=0
Return a store with in which all values within the given region are reset to zero.
virtual StoreRef getInitialStore(const LocationContext *InitLoc)=0
getInitialStore - Returns the initial "empty" store representing the value bindings upon entry to an ...
Represents a variable declaration or definition.
CompoundLiteralExpr - [C99 6.5.2.5].
StoreRef(Store store, StoreManager &smgr)
const void * Store
Store - This opaque type encapsulates an immutable mapping from locations to values.
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...
virtual void printJson(raw_ostream &Out, Store S, const char *NL, unsigned int Space, bool IsDot) const =0
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Represents a member of a struct/union/class.
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.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
SValBuilder & getSValBuilder()
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)
virtual StoreRef BindDefaultInitial(Store store, const MemRegion *R, SVal V)=0
Return a store with the specified value bound to all sub-regions of the region.
std::unique_ptr< StoreManager > CreateRegionStoreManager(ProgramStateManager &StMgr)
Loc makeLoc(SymbolRef sym)
StoreRef & operator=(StoreRef const &newStore)
This represents one expression.
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
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 - 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.
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
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...
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)
SVal CastRetrievedVal(SVal val, const TypedValueRegion *region, QualType castTy)
CastRetrievedVal - Used by subclasses of StoreManager to implement implicit casts that arise from loa...
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...
ElementRegion is used to represent both array elements and casts.
virtual ~StoreManager()=default
StoreManager(ProgramStateManager &stateMgr)
Loc getLValueCompoundLiteral(const CompoundLiteralExpr *CL, const LocationContext *LC)