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/SmallVector.h"
155 return getLValueFieldOrIvar(D,
Base);
261 unsigned int Space,
bool IsDot)
const = 0;
280 explicit operator bool() {
return First && Binding; }
300 : store(store), mgr(smgr) {
302 mgr.incrementReferenceCount(store);
306 : store(sr.store), mgr(sr.mgr)
309 mgr.incrementReferenceCount(store);
314 mgr.decrementReferenceCount(store);
318 assert(&newStore.mgr == &mgr);
319 if (store != newStore.store) {
320 mgr.incrementReferenceCount(newStore.store);
321 mgr.decrementReferenceCount(store);
328std::unique_ptr<StoreManager>
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
C Language Family Type Representation.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Represents a path from a specific derived class (which is not represented as part of the path) to a p...
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
CompoundLiteralExpr - [C99 6.5.2.5].
Decl - This represents one declaration (or definition), e.g.
This represents one expression.
Represents a member of a struct/union/class.
ObjCIvarDecl - Represents an ObjC instance variable.
A (possibly-)qualified type.
It represents a stack frame of the call stack (based on CallEvent).
Represents a variable declaration or definition.
Represents an abstract call to a function or method along a particular path.
ElementRegion is used to represent both array elements and casts.
MemRegion - The root abstract class for all memory regions.
Information about invalidation for a particular region/symbol.
SVal - This represents a symbolic expression, which can be either an L-value or an R-value.
A utility class that visits the reachable symbols using a custom SymbolVisitor.
virtual ~BindingsHandler()
virtual bool HandleBinding(StoreManager &SMgr, Store store, const MemRegion *region, SVal val)=0
const MemRegion * getRegion()
bool HandleBinding(StoreManager &SMgr, Store store, const MemRegion *R, SVal val) override
FindUniqueBinding(SymbolRef sym)
SVal evalDerivedToBase(SVal Derived, const CastExpr *Cast)
Evaluates a chain of derived-to-base casts through the path specified in Cast.
ProgramStateManager & StateMgr
SValBuilder & getSValBuilder()
virtual StoreRef invalidateRegions(Store store, ArrayRef< SVal > Values, ConstCFGElementRef Elem, unsigned Count, const LocationContext *LCtx, const CallEvent *Call, InvalidatedSymbols &IS, RegionAndSymbolInvalidationTraits &ITraits, InvalidatedRegions *TopLevelRegions, InvalidatedRegions *Invalidated)=0
invalidateRegions - Clears out the specified regions from the store, marking their values as unknown.
virtual SVal getLValueField(const FieldDecl *D, SVal Base)
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...
std::optional< SVal > evalBaseToDerived(SVal Base, QualType DerivedPtrType)
Attempts to do a down cast.
const ElementRegion * MakeElementRegion(const SubRegion *baseRegion, QualType pointeeTy, uint64_t index=0)
SmallVector< const MemRegion *, 8 > InvalidatedRegions
virtual BindResult Bind(Store store, Loc loc, SVal val)=0
Return a store with the specified value bound to the given location.
virtual void iterBindings(Store store, BindingsHandler &f)=0
iterBindings - Iterate over the bindings in the Store.
MemRegionManager & MRMgr
MRMgr - Manages region objects associated with this StoreManager.
SValBuilder & svalBuilder
virtual BindResult 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 ...
virtual SVal getLValueIvar(const ObjCIvarDecl *decl, SVal base)
virtual std::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.
virtual void decrementReferenceCount(Store store)
If the StoreManager supports it, decrement the reference count of the specified Store object.
virtual ~StoreManager()=default
virtual void incrementReferenceCount(Store store)
If the StoreManager supports it, increment the reference count of the specified Store object.
virtual SVal ArrayToPointer(Loc Array, QualType ElementTy)=0
ArrayToPointer - Used by ExprEngine::VistCast to handle implicit conversions between arrays and point...
virtual bool includedInBindings(Store store, const MemRegion *region) const =0
virtual SVal getBinding(Store store, Loc loc, QualType T=QualType())=0
Return the value bound to specified location in a given state.
StoreManager(ProgramStateManager &stateMgr)
std::optional< SVal > getDefaultBinding(nonloc::LazyCompoundVal lcv)
Return the default value bound to a LazyCompoundVal.
virtual StoreRef removeDeadBindings(Store store, const StackFrame *SF, SymbolReaper &SymReaper)=0
virtual Loc getLValueVar(const VarDecl *VD, const LocationContext *LC)
const ElementRegion * GetElementZeroRegion(const SubRegion *R, QualType T)
BindResult enterStackFrame(Store store, const CallEvent &Call, const StackFrame *CalleeSF)
enterStackFrame - Let the StoreManager to do something when execution engine is about to execute into...
virtual BindResult BindDefaultInitial(Store store, const MemRegion *R, SVal V)=0
Return a store with the specified value bound to all sub-regions of the region.
virtual SVal getLValueElement(QualType elementType, NonLoc offset, SVal Base)
virtual void printJson(raw_ostream &Out, Store S, const char *NL, unsigned int Space, bool IsDot) const =0
std::optional< const MemRegion * > castRegion(const MemRegion *region, QualType CastToTy)
castRegion - Used by ExprEngine::VisitCast to handle casts from a MemRegion* to a specific location t...
Loc getLValueCompoundLiteral(const CompoundLiteralExpr *CL, const LocationContext *LC)
StoreRef & operator=(StoreRef const &newStore)
StoreRef(Store store, StoreManager &smgr)
SubRegion - A region that subsets another larger region.
A class responsible for cleaning up unused symbols.
While nonloc::CompoundVal covers a few simple use cases, nonloc::LazyCompoundVal is a more performant...
LLVM_ATTRIBUTE_RETURNS_NONNULL const TypedValueRegion * getRegion() const
This function itself is immaterial.
const void * getStore() const
It might return null.
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
llvm::DenseSet< SymbolRef > InvalidatedSymbols
const SymExpr * SymbolRef
std::unique_ptr< StoreManager > CreateRegionStoreManager(ProgramStateManager &StMgr)
const void * Store
Store - This opaque type encapsulates an immutable mapping from locations to values.
The JSON file list parser is used to communicate input to InstallAPI.
CFGBlock::ConstCFGElementRef ConstCFGElementRef
llvm::SmallVector< SVal, 0 > FailedToBindValues