;
43: svalBuilder(stateMgr.getSValBuilder()), StateMgr(stateMgr),
44MRMgr(svalBuilder.getRegionManager()), Ctx(stateMgr.getContext()) {}
52 Call.getInitialStackFrameContents(LCtx, InitialBindings);
54 for(
const auto&I : InitialBindings)
70assert(!
T.isNull());
87 if(isa<CodeTextRegion, SymbolicRegion>(R))
106 if(
const auto*TR = dyn_cast<TypedValueRegion>(R)) {
115 if(R->
isBoundable() && IsSameRegionType(R, CanonPointeeTy))
120 caseMemRegion::CXXThisRegionKind:
121 caseMemRegion::CodeSpaceRegionKind:
122 caseMemRegion::StackLocalsSpaceRegionKind:
123 caseMemRegion::StackArgumentsSpaceRegionKind:
124 caseMemRegion::HeapSpaceRegionKind:
125 caseMemRegion::UnknownSpaceRegionKind:
126 caseMemRegion::StaticGlobalSpaceRegionKind:
127 caseMemRegion::GlobalInternalSpaceRegionKind:
128 caseMemRegion::GlobalSystemSpaceRegionKind:
129 caseMemRegion::GlobalImmutableSpaceRegionKind: {
130llvm_unreachable(
"Invalid region cast");
133 caseMemRegion::FunctionCodeRegionKind:
134 caseMemRegion::BlockCodeRegionKind:
135 caseMemRegion::BlockDataRegionKind:
136 caseMemRegion::StringRegionKind:
138 caseMemRegion::SymbolicRegionKind:
139 caseMemRegion::AllocaRegionKind:
140 caseMemRegion::CompoundLiteralRegionKind:
141 caseMemRegion::FieldRegionKind:
142 caseMemRegion::ObjCIvarRegionKind:
143 caseMemRegion::ObjCStringRegionKind:
144 caseMemRegion::NonParamVarRegionKind:
145 caseMemRegion::ParamVarRegionKind:
146 caseMemRegion::CXXTempObjectRegionKind:
147 caseMemRegion::CXXLifetimeExtendedObjectRegionKind:
148 caseMemRegion::CXXBaseObjectRegionKind:
149 caseMemRegion::CXXDerivedObjectRegionKind:
152 caseMemRegion::ElementRegionKind: {
187 if(IsSameRegionType(baseR, CanonPointeeTy))
200int64_t newIndex = 0;
207 if(!pointeeTySize.
isZero()) {
211 if(off % pointeeTySize == 0) {
212newIndex = off / pointeeTySize;
229llvm_unreachable(
"unreachable");
237 const auto*TVR = dyn_cast<TypedValueRegion>(MR);
241 const CXXRecordDecl*RD = TVR->getValueType()->getAsCXXRecordDecl();
269 for(
const auto&I :
Path)
271I.Base->isVirtual());
284assert(BaseDecl &&
"not a C++ object?");
286 if(
const auto*AlreadyDerivedReg =
287dyn_cast<CXXDerivedObjectRegion>(DerivedReg)) {
288 if(
const auto*SR =
289dyn_cast<SymbolicRegion>(AlreadyDerivedReg->getSuperRegion()))
290 if(SR->getSymbol()->getType()->getPointeeCXXRecordDecl() == BaseDecl)
293DerivedReg = AlreadyDerivedReg->getSuperRegion();
297BaseDecl, cast<SubRegion>(DerivedReg), IsVirtual);
309 if(
const auto*TVR = dyn_cast<TypedValueRegion>(MR))
310 returnTVR->getValueType()->getAsCXXRecordDecl();
311 if(
const auto*SR = dyn_cast<SymbolicRegion>(MR))
312 returnSR->getSymbol()->getType()->getPointeeCXXRecordDecl();
324assert(!TargetType.
isNull());
326 if(!TargetClass && !TargetType->
isVoidType())
333 if(MRClass == TargetClass)
339 if(!TargetType->
isVoidType() && MRClass->hasDefinition()) {
344 if(MRClass->isDerivedFrom(TargetClass, Paths))
348 if(
const auto*BaseR = dyn_cast<CXXBaseObjectRegion>(MR)) {
350MR = BaseR->getSuperRegion();
367 if(Uncasted == MR) {
382 if(
const auto*SR = dyn_cast<SymbolicRegion>(MR)) {
385 if(TargetClass && SourceClass && TargetClass->
isDerivedFrom(SourceClass))
392 if(isa<TypedValueRegion>(MR))
399 if(
Base.isUnknownOrUndef())
406 caseloc::MemRegionValKind:
410 caseloc::GotoLabelKind:
414 caseloc::ConcreteIntKind:
428llvm_unreachable(
"Unhandled Base.");
433 if(
const auto*ID = dyn_cast<ObjCIvarDecl>(
D))
440 returngetLValueFieldOrIvar(
decl, base);
448 if(Offset.isZeroConstant()) {
452 if(!PointeeTy.
isNull() &&
462 if(
Base.isUnknownOrUndef() || isa<loc::ConcreteInt>(
Base))
465 if(isa<loc::GotoLabel>(
Base))
472 const auto*ElemR = dyn_cast<ElementRegion>(BaseRegion);
485Offset = Off.value();
499 SValBaseIdx = ElemR->getIndex();
501 if(!isa<nonloc::ConcreteInt>(BaseIdx))
504 constllvm::APSInt &BaseIdxI =
510 if(!isa<nonloc::ConcreteInt>(Offset)) {
511 if(isa<ElementRegion>(BaseRegion->
StripCasts()))
515elementType, Offset, cast<SubRegion>(ElemR->getSuperRegion()),
Ctx));
519assert(BaseIdxI.isSigned());
526 const SubRegion*ArrayR = cast<SubRegion>(ElemR->getSuperRegion());
538 if(!SymV || SymV != Sym)
Defines the clang::ASTContext interface.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
static bool regionMatchesCXXRecordType(SVal V, QualType Ty)
static const CXXRecordDecl * getCXXRecordType(const MemRegion *MR)
Returns the static type of the given region, if it represents a C++ class object.
C Language Family Type Representation.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
Represents a path from a specific derived class (which is not represented as part of the path) to a p...
BasePaths - Represents the set of paths from a derived class to one of its (direct or indirect) bases...
Represents a base class of a C++ class.
Represents a C++ struct/union/class.
CXXRecordDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
bool isDerivedFrom(const CXXRecordDecl *Base) const
Determine whether this class is derived from the class Base.
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
CharUnits - This is an opaque type for sizes expressed in character units.
bool isZero() const
isZero - Test whether the quantity equals zero.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
Decl - This represents one declaration (or definition), e.g.
ObjCIvarDecl - Represents an ObjC instance variable.
A (possibly-)qualified type.
QualType getLocalUnqualifiedType() const
Return this type with all of the instance-specific qualifiers removed, but without removing any quali...
bool isNull() const
Return true if this QualType doesn't point to a type yet.
QualType getCanonicalType() const
It represents a stack frame of the call stack (based on CallEvent).
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isBlockPointerType() const
const CXXRecordDecl * getPointeeCXXRecordDecl() const
If this is a pointer or reference to a RecordType, return the CXXRecordDecl that the type refers to.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types,...
bool isObjCObjectPointerType() const
Represents an abstract call to a function or method along a particular path.
ElementRegion is used to represent both array elements and casts.
RegionRawOffset getAsArrayOffset() const
Compute the offset within the array. The array might also be a subobject.
const CXXDerivedObjectRegion * getCXXDerivedObjectRegion(const CXXRecordDecl *BaseClass, const SubRegion *Super)
Create a CXXDerivedObjectRegion with the given derived class for region Super.
const FieldRegion * getFieldRegion(const FieldDecl *fd, const SubRegion *superRegion)
getFieldRegion - Retrieve or create the memory region associated with a specified FieldDecl.
const ElementRegion * getElementRegion(QualType elementType, NonLoc Idx, const SubRegion *superRegion, const ASTContext &Ctx)
getElementRegion - Retrieve the memory region associated with the associated element type,...
const ObjCIvarRegion * getObjCIvarRegion(const ObjCIvarDecl *ivd, const SubRegion *superRegion)
getObjCIvarRegion - Retrieve or create the memory region associated with a specified Objective-c inst...
const CXXBaseObjectRegion * getCXXBaseObjectRegion(const CXXRecordDecl *BaseClass, const SubRegion *Super, bool IsVirtual)
Create a CXXBaseObjectRegion with the given base class for region Super.
MemRegion - The root abstract class for all memory regions.
virtual bool isBoundable() const
LLVM_ATTRIBUTE_RETURNS_NONNULL const MemRegion * StripCasts(bool StripBaseAndDerivedCasts=true) const
ASTContext & getContext()
CharUnits getOffset() const
const MemRegion * getRegion() const
BasicValueFactory & getBasicValueFactory()
NonLoc makeArrayIndex(uint64_t idx)
ASTContext & getContext()
SVal convertToArrayIndex(SVal val)
NonLoc makeZeroArrayIndex()
SVal - This represents a symbolic expression, which can be either an L-value or an R-value.
std::optional< T > getAs() const
Convert to the specified SVal type, returning std::nullopt if this SVal is not of the desired type.
SymbolRef getAsLocSymbol(bool IncludeBaseRegions=false) const
If this SVal is a location and wraps a symbol, return that SymbolRef.
const MemRegion * getAsRegion() const
T castAs() const
Convert to the specified SVal type, asserting that this SVal is of the desired type.
virtual ~BindingsHandler()
bool HandleBinding(StoreManager &SMgr, Store store, const MemRegion *R, SVal val) override
SVal evalDerivedToBase(SVal Derived, const CastExpr *Cast)
Evaluates a chain of derived-to-base casts through the path specified in Cast.
ProgramStateManager & StateMgr
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)
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...
MemRegionManager & MRMgr
MRMgr - Manages region objects associated with this StoreManager.
SValBuilder & svalBuilder
virtual SVal getLValueIvar(const ObjCIvarDecl *decl, SVal base)
StoreManager(ProgramStateManager &stateMgr)
const ElementRegion * GetElementZeroRegion(const SubRegion *R, QualType T)
virtual SVal getLValueElement(QualType elementType, NonLoc offset, SVal Base)
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...
SubRegion - A region that subsets another larger region.
LLVM_ATTRIBUTE_RETURNS_NONNULL const MemRegion * getRegion() const
Get the underlining region.
Value representing integer constant.
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
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.
@ Bind
'bind' clause, allowed on routine constructs.
@ Result
The result type of a method or function.
const FunctionProtoType * T
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4