21 using namespace clang;
25 : svalBuilder(stateMgr.getSValBuilder()), StateMgr(stateMgr),
26 MRMgr(svalBuilder.getRegionManager()), Ctx(stateMgr.getContext()) {}
36 for (CallEvent::BindingsTy::iterator I = InitialBindings.begin(),
37 E = InitialBindings.end();
75 if (isa<CodeTextRegion>(R) || isa<SymbolicRegion>(R))
96 if (CanonPointeeTy == ObjTy)
112 llvm_unreachable(
"Invalid region cast");
153 const MemRegion *baseR = rawOff.getRegion();
169 if (CanonPointeeTy == ObjTy)
184 int64_t newIndex = 0;
191 if (!pointeeTySize.
isZero()) {
195 if (off % pointeeTySize == 0) {
196 newIndex = off / pointeeTySize;
212 llvm_unreachable(
"unreachable");
254 for (CXXBasePath::const_iterator I = Path.begin(), E = Path.end();
257 I->Base->isVirtual());
272 assert(BaseDecl &&
"not a C++ object?");
289 return TVR->getValueType()->getAsCXXRecordDecl();
291 return SR->getSymbol()->getType()->getPointeeCXXRecordDecl();
305 assert(!TargetType.
isNull());
307 if (!TargetClass && !TargetType->
isVoidType())
314 if (MRClass == TargetClass)
320 if (!TargetType->
isVoidType() && MRClass->hasDefinition()) {
325 if (MRClass->isDerivedFrom(TargetClass, Paths))
331 MR = BaseR->getSuperRegion();
348 if (Uncasted == MR) {
359 Failed = isa<TypedValueRegion>(MR);
368 QualType castTy,
bool performTestOnly) {
375 if (performTestOnly) {
412 llvm_unreachable(
"Unhandled Base.");
424 return getLValueFieldOrIvar(decl, base);
464 const llvm::APSInt &BaseIdxI =
471 if (isa<ElementRegion>(BaseRegion->
StripCasts()))
480 assert(BaseIdxI.isSigned());
499 if (!SymV || SymV != Sym)
TypedValueRegion - An abstract class representing regions having a typed value.
SVal evalDerivedToBase(SVal Derived, const CastExpr *Cast)
SVal evalDynamicCast(SVal Base, QualType DerivedPtrType, bool &Failed)
Evaluates C++ dynamic_cast cast. The callback may result in the following 3 scenarios: ...
MemRegion - The root abstract class for all memory regions.
const FieldRegion * getFieldRegion(const FieldDecl *fd, const MemRegion *superRegion)
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
virtual QualType getValueType() const =0
virtual bool isBoundable() const
const MemRegion * MakeElementRegion(const MemRegion *baseRegion, QualType pointeeTy, uint64_t index=0)
bool isBlockPointerType() const
Represents a path from a specific derived class (which is not represented as part of the path) to a p...
Value representing integer constant.
const CXXBaseSpecifier *const * path_const_iterator
virtual SVal dispatchCast(SVal val, QualType castTy)=0
NonLoc makeArrayIndex(uint64_t idx)
const MemRegion * castRegion(const MemRegion *region, QualType CastToTy)
Symbolic value. These values used to capture symbolic execution of the program.
bool HandleBinding(StoreManager &SMgr, Store store, const MemRegion *R, SVal val) override
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
static bool regionMatchesCXXRecordType(SVal V, QualType Ty)
SymbolRef getAsLocSymbol(bool IncludeBaseRegions=false) const
If this SVal is a location and wraps a symbol, return that SymbolRef. Otherwise return 0...
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
const ObjCIvarRegion * getObjCIvarRegion(const ObjCIvarDecl *ivd, const MemRegion *superRegion)
const CXXRecordDecl * getPointeeCXXRecordDecl() const
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
RegionRawOffset getAsArrayOffset() const
Compute the offset within the array. The array might also be a subobject.
path_iterator path_begin()
bool isUnknownOrUndef() const
CXXRecordDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
bool isIncompleteType(NamedDecl **Def=nullptr) const
Def If non-NULL, and the type refers to some kind of declaration that can be completed (such as a C s...
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
StoreRef enterStackFrame(Store store, const CallEvent &Call, const StackFrameContext *CalleeCtx)
const CXXBaseObjectRegion * getCXXBaseObjectRegion(const CXXRecordDecl *BaseClass, const MemRegion *Super, bool IsVirtual)
const MemRegion * getSuperRegion() const
virtual SVal getLValueIvar(const ObjCIvarDecl *decl, SVal base)
const MemRegion * StripCasts(bool StripBaseCasts=true) const
ID
Defines the set of possible language-specific address spaces.
QualType getPointeeType() const
SValBuilder & svalBuilder
const ElementRegion * getElementRegion(QualType elementType, NonLoc Idx, const MemRegion *superRegion, ASTContext &Ctx)
const ElementRegion * GetElementZeroRegion(const MemRegion *R, QualType T)
Optional< T > getAs() const
Convert to the specified SVal type, returning None if this SVal is not of the desired type...
static SVal getValue(SVal val, SValBuilder &svalBuilder)
ProgramStateManager & StateMgr
virtual StoreRef Bind(Store store, Loc loc, SVal val)=0
The result type of a method or function.
NonLoc makeZeroArrayIndex()
virtual void getInitialStackFrameContents(const StackFrameContext *CalleeCtx, BindingsTy &Bindings) const =0
SVal CastRetrievedVal(SVal val, const TypedValueRegion *region, QualType castTy, bool performTestOnly=true)
ASTContext & getContext()
virtual ~BindingsHandler()
unsigned getSubKind() const
bool isZero() const
isZero - Test whether the quantity equals zero.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
const MemRegion * getAsRegion() const
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
Represents an abstract call to a function or method along a particular path.
SVal convertToArrayIndex(SVal val)
ASTContext & getContext()
QualType getLocalUnqualifiedType() const
Return this type with all of the instance-specific qualifiers removed, but without removing any quali...
BasicValueFactory & getBasicValueFactory()
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
MemRegionManager & MRMgr
MRMgr - Manages region objects associated with this StoreManager.
virtual SVal getLValueElement(QualType elementType, NonLoc offset, SVal Base)
static const CXXRecordDecl * getCXXRecordType(const MemRegion *MR)
Represents a C++ struct/union/class.
bool isObjCObjectPointerType() const
virtual StoreRef BindDefault(Store store, const MemRegion *R, SVal V)
ElementRegin is used to represent both array elements and casts.
StoreManager(ProgramStateManager &stateMgr)
bool isNull() const
isNull - Return true if this QualType doesn't point to a type yet.
T castAs() const
Convert to the specified SVal type, asserting that this SVal is of the desired type.