Go to the documentation of this file.
15 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_MEMREGION_H
16 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_MEMREGION_H
31 #include "llvm/ADT/DenseMap.h"
32 #include "llvm/ADT/FoldingSet.h"
33 #include "llvm/ADT/Optional.h"
34 #include "llvm/ADT/PointerIntPair.h"
35 #include "llvm/Support/Allocator.h"
36 #include "llvm/Support/Casting.h"
45 class AnalysisDeclContext;
48 class LocationContext;
49 class StackFrameContext;
55 class MemRegionManager;
98 #define REGION(Id, Parent) Id ## Kind,
99 #define REGION_RANGE(Id, First, Last) BEGIN_##Id = First, END_##Id = Last,
100 #include "clang/StaticAnalyzer/Core/PathSensitive/Regions.def"
114 virtual void Profile(llvm::FoldingSetNodeID&
ID)
const = 0;
124 LLVM_ATTRIBUTE_RETURNS_NONNULL
131 LLVM_ATTRIBUTE_RETURNS_NONNULL
175 template<
typename RegionTy>
const RegionTy*
getAs()
const;
176 template <
typename RegionTy>
177 LLVM_ATTRIBUTE_RETURNS_NONNULL
const RegionTy *
castAs()
const;
217 void Profile(llvm::FoldingSetNodeID &
ID)
const override;
221 return k >= BEGIN_MEMSPACES && k <= END_MEMSPACES;
237 return R->
getKind() == CodeSpaceRegionKind;
242 virtual void anchor();
252 return k >= BEGIN_GLOBAL_MEMSPACES && k <= END_GLOBAL_MEMSPACES;
272 void Profile(llvm::FoldingSetNodeID &
ID)
const override;
276 LLVM_ATTRIBUTE_RETURNS_NONNULL
280 return R->
getKind() == StaticGlobalSpaceRegionKind;
291 void anchor()
override;
302 return k >= BEGIN_NON_STATIC_GLOBAL_MEMSPACES &&
303 k <= END_NON_STATIC_GLOBAL_MEMSPACES;
319 return R->
getKind() == GlobalSystemSpaceRegionKind;
338 return R->
getKind() == GlobalImmutableSpaceRegionKind;
355 return R->
getKind() == GlobalInternalSpaceRegionKind;
369 return R->
getKind() == HeapSpaceRegionKind;
383 return R->
getKind() == UnknownSpaceRegionKind;
388 virtual void anchor();
400 LLVM_ATTRIBUTE_RETURNS_NONNULL
403 void Profile(llvm::FoldingSetNodeID &
ID)
const override;
407 return k >= BEGIN_STACK_MEMSPACES && k <= END_STACK_MEMSPACES;
421 return R->
getKind() == StackLocalsSpaceRegionKind;
436 return R->
getKind() == StackArgumentsSpaceRegionKind;
443 virtual void anchor();
454 LLVM_ATTRIBUTE_RETURNS_NONNULL
464 return R->
getKind() > END_MEMSPACES;
488 static void ProfileRegion(llvm::FoldingSetNodeID&
ID,
const Expr *Ex,
492 LLVM_ATTRIBUTE_RETURNS_NONNULL
497 void Profile(llvm::FoldingSetNodeID&
ID)
const override;
502 return R->
getKind() == AllocaRegionKind;
508 void anchor()
override;
526 return k >= BEGIN_TYPED_REGIONS && k <= END_TYPED_REGIONS;
532 void anchor()
override;
558 return k >= BEGIN_TYPED_VALUE_REGIONS && k <= END_TYPED_VALUE_REGIONS;
563 void anchor()
override;
575 return k >= BEGIN_CODE_TEXT_REGIONS && k <= END_CODE_TEXT_REGIONS;
587 assert(isa<ObjCMethodDecl>(fd) || isa<FunctionDecl>(fd));
590 static void ProfileRegion(llvm::FoldingSetNodeID&
ID,
const NamedDecl *FD,
596 if (
const auto *D = dyn_cast<FunctionDecl>(FD)) {
600 assert(isa<ObjCMethodDecl>(FD));
601 assert(
false &&
"Getting the type of ObjCMethod is not supported yet");
614 void Profile(llvm::FoldingSetNodeID&
ID)
const override;
617 return R->
getKind() == FunctionCodeRegionKind;
636 :
CodeTextRegion(sreg, BlockCodeRegionKind), BD(bd), AC(ac), locTy(lTy) {
642 static void ProfileRegion(llvm::FoldingSetNodeID&
ID,
const BlockDecl *BD,
651 LLVM_ATTRIBUTE_RETURNS_NONNULL
656 LLVM_ATTRIBUTE_RETURNS_NONNULL
661 void Profile(llvm::FoldingSetNodeID&
ID)
const override;
664 return R->
getKind() == BlockCodeRegionKind;
680 void *ReferencedVars =
nullptr;
681 void *OriginalVars =
nullptr;
685 :
TypedRegion(sreg, BlockDataRegionKind), BC(bc), LC(lc),
690 assert(isa<GlobalImmutableSpaceRegion>(sreg) ||
691 isa<StackLocalsSpaceRegion>(sreg) ||
692 isa<UnknownSpaceRegion>(sreg));
695 static void ProfileRegion(llvm::FoldingSetNodeID&,
const BlockCodeRegion *,
700 LLVM_ATTRIBUTE_RETURNS_NONNULL
703 LLVM_ATTRIBUTE_RETURNS_NONNULL
715 : R(r), OriginalR(originalR) {}
717 LLVM_ATTRIBUTE_RETURNS_NONNULL
719 return cast<VarRegion>(*R);
722 LLVM_ATTRIBUTE_RETURNS_NONNULL
724 return cast<VarRegion>(*OriginalR);
728 assert((R ==
nullptr) == (I.R ==
nullptr));
733 assert((R ==
nullptr) == (I.R ==
nullptr));
753 void Profile(llvm::FoldingSetNodeID&
ID)
const override;
756 return R->
getKind() == BlockDataRegionKind;
760 void LazyInitializeReferencedVars();
761 std::pair<const VarRegion *, const VarRegion *>
762 getCaptureRegions(
const VarDecl *VD);
776 :
SubRegion(sreg, SymbolicRegionKind), sym(
s) {
779 assert(
s && isa<SymbolData>(
s));
780 assert(
s->getType()->isAnyPointerType() ||
781 s->getType()->isReferenceType() ||
782 s->getType()->isBlockPointerType());
783 assert(isa<UnknownSpaceRegion>(sreg) || isa<HeapSpaceRegion>(sreg) ||
784 isa<GlobalSystemSpaceRegion>(sreg));
793 void Profile(llvm::FoldingSetNodeID&
ID)
const override;
802 return R->
getKind() == SymbolicRegionKind;
817 static void ProfileRegion(llvm::FoldingSetNodeID &
ID,
822 LLVM_ATTRIBUTE_RETURNS_NONNULL
829 void Profile(llvm::FoldingSetNodeID&
ID)
const override {
836 return R->
getKind() == StringRegionKind;
852 static void ProfileRegion(llvm::FoldingSetNodeID &
ID,
857 LLVM_ATTRIBUTE_RETURNS_NONNULL
864 void Profile(llvm::FoldingSetNodeID&
ID)
const override {
871 return R->
getKind() == ObjCStringRegionKind;
887 assert(isa<GlobalInternalSpaceRegion>(sReg) ||
888 isa<StackLocalsSpaceRegion>(sReg));
891 static void ProfileRegion(llvm::FoldingSetNodeID&
ID,
900 void Profile(llvm::FoldingSetNodeID&
ID)
const override;
904 LLVM_ATTRIBUTE_RETURNS_NONNULL
908 return R->
getKind() == CompoundLiteralRegionKind;
924 return k >= BEGIN_DECL_REGIONS && k <= END_DECL_REGIONS;
938 assert(isa<GlobalsSpaceRegion>(sReg) || isa<StackSpaceRegion>(sReg) ||
939 isa<BlockDataRegion>(sReg) || isa<UnknownSpaceRegion>(sReg));
956 return k >= BEGIN_VAR_REGIONS && k <= END_VAR_REGIONS;
967 :
VarRegion(sReg, NonParamVarRegionKind), VD(vd) {
972 assert(isa<GlobalsSpaceRegion>(sReg) || isa<StackSpaceRegion>(sReg) ||
973 isa<BlockDataRegion>(sReg) || isa<UnknownSpaceRegion>(sReg));
977 static void ProfileRegion(llvm::FoldingSetNodeID &
ID,
const VarDecl *VD,
981 void Profile(llvm::FoldingSetNodeID &
ID)
const override;
983 LLVM_ATTRIBUTE_RETURNS_NONNULL
998 return R->
getKind() == NonParamVarRegionKind;
1015 const Expr *OriginExpr;
1019 :
VarRegion(SReg, ParamVarRegionKind), OriginExpr(OE), Index(Idx) {
1020 assert(!cast<StackSpaceRegion>(SReg)->
getStackFrame()->inTopFrame());
1024 static void ProfileRegion(llvm::FoldingSetNodeID &
ID,
const Expr *OE,
1028 LLVM_ATTRIBUTE_RETURNS_NONNULL
1032 void Profile(llvm::FoldingSetNodeID&
ID)
const override;
1045 return R->
getKind() == ParamVarRegionKind;
1058 ThisPointerTy(thisPointerTy) {
1060 "Invalid region type!");
1063 static void ProfileRegion(llvm::FoldingSetNodeID &
ID,
1068 void Profile(llvm::FoldingSetNodeID &
ID)
const override;
1077 return R->
getKind() == CXXThisRegionKind;
1090 :
DeclRegion(sReg, FieldRegionKind), FD(fd) {
1094 static void ProfileRegion(llvm::FoldingSetNodeID &
ID,
const FieldDecl *FD,
1096 ID.AddInteger(
static_cast<unsigned>(FieldRegionKind));
1102 LLVM_ATTRIBUTE_RETURNS_NONNULL
1105 void Profile(llvm::FoldingSetNodeID &
ID)
const override;
1120 return R->
getKind() == FieldRegionKind;
1131 static void ProfileRegion(llvm::FoldingSetNodeID&
ID,
const ObjCIvarDecl *ivd,
1135 LLVM_ATTRIBUTE_RETURNS_NONNULL
1138 void Profile(llvm::FoldingSetNodeID&
ID)
const override;
1148 return R->
getKind() == ObjCIvarRegionKind;
1163 : Region(reg),
Offset(offset) {}
1186 assert((!isa<nonloc::ConcreteInt>(Idx) ||
1188 "The index must be signed");
1190 "Invalid region type!");
1193 static void ProfileRegion(llvm::FoldingSetNodeID&
ID,
QualType elementType,
1208 void Profile(llvm::FoldingSetNodeID&
ID)
const override;
1211 return R->
getKind() == ElementRegionKind;
1224 assert(isa<StackLocalsSpaceRegion>(sReg) ||
1225 isa<GlobalInternalSpaceRegion>(sReg));
1228 static void ProfileRegion(llvm::FoldingSetNodeID &
ID,
1232 LLVM_ATTRIBUTE_RETURNS_NONNULL
1239 void Profile(llvm::FoldingSetNodeID &
ID)
const override;
1242 return R->
getKind() == CXXTempObjectRegionKind;
1251 llvm::PointerIntPair<const CXXRecordDecl *, 1, bool> Data;
1259 static void ProfileRegion(llvm::FoldingSetNodeID &
ID,
const CXXRecordDecl *RD,
1263 LLVM_ATTRIBUTE_RETURNS_NONNULL
1271 void Profile(llvm::FoldingSetNodeID &
ID)
const override;
1278 return region->
getKind() == CXXBaseObjectRegionKind;
1299 "Should have unwrapped a base region instead!");
1302 static void ProfileRegion(llvm::FoldingSetNodeID &
ID,
const CXXRecordDecl *RD,
1306 LLVM_ATTRIBUTE_RETURNS_NONNULL
1313 void Profile(llvm::FoldingSetNodeID &
ID)
const override;
1320 return region->
getKind() == CXXDerivedObjectRegionKind;
1324 template<
typename RegionTy>
1326 if (
const auto *RT = dyn_cast<RegionTy>(
this))
1332 template <
typename RegionTy>
1334 return cast<RegionTy>(
this);
1343 llvm::BumpPtrAllocator& A;
1345 llvm::FoldingSet<MemRegion> Regions;
1351 llvm::DenseMap<const StackFrameContext *, StackLocalsSpaceRegion *>
1352 StackLocalsSpaceRegions;
1353 llvm::DenseMap<const StackFrameContext *, StackArgumentsSpaceRegion *>
1354 StackArgumentsSpaceRegions;
1355 llvm::DenseMap<const CodeTextRegion *, StaticGlobalSpaceRegion *>
1356 StaticsGlobalSpaceRegions;
1513 unsigned blockCount);
1521 template <
typename RegionTy,
typename SuperTy,
1523 RegionTy* getSubRegion(
const Arg1Ty arg1,
1524 const SuperTy* superRegion);
1526 template <
typename RegionTy,
typename SuperTy,
1527 typename Arg1Ty,
typename Arg2Ty>
1528 RegionTy* getSubRegion(
const Arg1Ty arg1,
const Arg2Ty arg2,
1529 const SuperTy* superRegion);
1531 template <
typename RegionTy,
typename SuperTy,
1532 typename Arg1Ty,
typename Arg2Ty,
typename Arg3Ty>
1533 RegionTy* getSubRegion(
const Arg1Ty arg1,
const Arg2Ty arg2,
1535 const SuperTy* superRegion);
1537 template <
typename REG>
1538 const REG* LazyAllocate(REG*& region);
1540 template <
typename REG,
typename ARG>
1541 const REG* LazyAllocate(REG*& region, ARG a);
1558 using StorageTypeForKinds =
unsigned char;
1560 llvm::DenseMap<const MemRegion *, StorageTypeForKinds> MRTraitsMap;
1561 llvm::DenseMap<SymbolRef, StorageTypeForKinds> SymTraitsMap;
1563 using const_region_iterator =
1564 llvm::DenseMap<const MemRegion *, StorageTypeForKinds>::const_iterator;
1565 using const_symbol_iterator =
1566 llvm::DenseMap<SymbolRef, StorageTypeForKinds>::const_iterator;
1606 #endif // LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_MEMREGION_H
const NonParamVarRegion * getNonParamVarRegion(const VarDecl *VD, const MemRegion *superR)
getVarRegion - Retrieve or create the memory region associated with a specified VarDecl and LocationC...
QualType getDesugaredValueType(ASTContext &Context) const
QualType getValueType() const override
void Profile(llvm::FoldingSetNodeID &ID) const override
The region associated with an ObjCStringLiteral.
bool isBoundable() const override
DeclRegion(const MemRegion *sReg, Kind k)
__DEVICE__ int max(int __a, int __b)
const ObjCIvarRegion * getObjCIvarRegion(const ObjCIvarDecl *ivd, const SubRegion *superRegion)
getObjCIvarRegion - Retrieve or create the memory region associated with a specified Objective-c inst...
static bool classof(const MemRegion *R)
void dumpToStream(raw_ostream &os) const override
const StackArgumentsSpaceRegion * getStackArgumentsRegion(const StackFrameContext *STC)
getStackArgumentsRegion - Retrieve the memory region associated with function/method arguments of the...
bool canPrintPretty() const override
Returns true if this region can be printed in a user-friendly way.
const LLVM_ATTRIBUTE_RETURNS_NONNULL Expr * getExpr() const
bool isBlockPointerType() const
It wraps the AnalysisDeclContext to represent both the call stack with the help of StackFrameContext ...
bool canPrintPrettyAsExpr() const override
Returns true if this region's textual representation can be used as part of a larger expression.
const CodeSpaceRegion * getCodeRegion()
static bool classof(const MemRegion *region)
const LLVM_ATTRIBUTE_RETURNS_NONNULL CompoundLiteralExpr * getLiteralExpr() const
virtual void Profile(llvm::FoldingSetNodeID &ID) const =0
A trivial tuple used to represent a source range.
virtual const ValueDecl * getDecl() const =0
virtual MemRegionManager & getMemRegionManager() const =0
const LLVM_ATTRIBUTE_RETURNS_NONNULL CXXRecordDecl * getDecl() const
static bool classof(const MemRegion *R)
T castAs() const
Convert to the specified SVal type, asserting that this SVal is of the desired type.
bool canPrintPrettyAsExpr() const override
Returns true if this region's textual representation can be used as part of a larger expression.
QualType getValueType() const override
const CompoundLiteralRegion * getCompoundLiteralRegion(const CompoundLiteralExpr *CL, const LocationContext *LC)
getCompoundLiteralRegion - Retrieve the region associated with a given CompoundLiteral.
referenced_vars_iterator referenced_vars_begin() const
bool isBoundable() const override
void Profile(llvm::FoldingSetNodeID &ID) const override
const LLVM_ATTRIBUTE_RETURNS_NONNULL MemRegion * StripCasts(bool StripBaseAndDerivedCasts=true) const
bool hasStackParametersStorage() const
static bool classof(const MemRegion *R)
This represents a decl that may have a name.
const ElementRegion * getElementRegionWithSuper(const ElementRegion *ER, const SubRegion *superRegion)
@ TK_SuppressEscape
Suppress pointer-escaping of a region.
A (possibly-)qualified type.
static bool classof(const MemRegion *R)
const LLVM_ATTRIBUTE_RETURNS_NONNULL VarRegion * getOriginalRegion() const
AnalysisDeclContext contains the context data for the function, method or block under analysis.
const SymbolicRegion * getSymbolicHeapRegion(SymbolRef sym)
Return a unique symbolic region belonging to heap memory space.
QualType getDesugaredLocationType(ASTContext &Context) const
Represents a member of a struct/union/class.
QualType getValueType() const override
Represents a parameter to a function.
QualType getLocationType() const override
CompoundLiteralRegion - A memory region representing a compound literal.
QualType getValueType() const override
bool canPrintPrettyAsExpr() const override
Returns true if this region's textual representation can be used as part of a larger expression.
void Profile(llvm::FoldingSetNodeID &ID) const override
void Profile(llvm::FoldingSetNodeID &ID) const override
MemSpaceRegion - A memory region that represents a "memory space"; for example, the set of global var...
void dumpToStream(raw_ostream &os) const override
const BlockDataRegion * getBlockDataRegion(const BlockCodeRegion *bc, const LocationContext *lc, unsigned blockCount)
getBlockDataRegion - Get the memory region associated with an instance of a block.
const LLVM_ATTRIBUTE_RETURNS_NONNULL BlockCodeRegion * getCodeRegion() const
bool hasGlobalsOrParametersStorage() const
const UnknownSpaceRegion * getUnknownRegion()
getUnknownRegion - Retrieve the memory region associated with unknown memory space.
bool isSubRegionOf(const MemRegion *R) const override
Check if the region is a subregion of the given region.
void dumpToStream(raw_ostream &os) const override
It represents a stack frame of the call stack (based on CallEvent).
const HeapSpaceRegion * getHeapRegion()
getHeapRegion - Retrieve the memory region associated with the generic "heap".
void Profile(llvm::FoldingSetNodeID &ID) const override
Value representing integer constant.
const CXXDerivedObjectRegion * getCXXDerivedObjectRegion(const CXXRecordDecl *BaseClass, const SubRegion *Super)
Create a CXXDerivedObjectRegion with the given derived class for region Super.
const FunctionCodeRegion * getFunctionCodeRegion(const NamedDecl *FD)
const MemRegion * getRegion() const
It might return null.
static bool classof(const MemRegion *R)
void Profile(llvm::FoldingSetNodeID &ID) const override
RegionOffset(const MemRegion *r, int64_t off)
const VarRegion * getVarRegion(const VarDecl *VD, const LocationContext *LC)
getVarRegion - Retrieve or create the memory region associated with a specified VarDecl and LocationC...
const LLVM_ATTRIBUTE_RETURNS_NONNULL CodeTextRegion * getCodeRegion() const
void dumpToStream(raw_ostream &os) const override
bool operator==(const referenced_vars_iterator &I) const
SymbolRef getSymbol() const
It might return null.
QualType getElementType() const
CodeTextRegion(const MemSpaceRegion *sreg, Kind k)
void dumpToStream(raw_ostream &os) const override
BlockCodeRegion - A region that represents code texts of blocks (closures).
const NamedDecl * getDecl() const
const LLVM_ATTRIBUTE_RETURNS_NONNULL VarRegion * getCapturedRegion() const
const CXXBaseObjectRegion * getCXXBaseObjectRegion(const CXXRecordDecl *BaseClass, const SubRegion *Super, bool IsVirtual)
Create a CXXBaseObjectRegion with the given base class for region Super.
Represents a class type in Objective C.
referenced_vars_iterator(const MemRegion *const *r, const MemRegion *const *originalR)
void Profile(llvm::FoldingSetNodeID &ID) const override
MemRegion - The root abstract class for all memory regions.
Represent a region's offset within the top level base region.
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
QualType getValueType() const override
const T * getTypePtr() const
Retrieve the underlying type pointer, which refers to a canonical type.
@ TK_EntireMemSpace
When applied to a MemSpaceRegion, indicates the entire memory space should be invalidated.
QualType getValueType() const override
const AllocaRegion * getAllocaRegion(const Expr *Ex, unsigned Cnt, const LocationContext *LC)
getAllocaRegion - Retrieve a region associated with a call to alloca().
const FieldRegion * getFieldRegion(const FieldDecl *fd, const SubRegion *superRegion)
getFieldRegion - Retrieve or create the memory region associated with a specified FieldDecl.
static bool classof(const MemRegion *R)
CodeSpaceRegion - The memory space that holds the executable code of functions and blocks.
void Profile(llvm::FoldingSetNodeID &ID) const override
const LLVM_ATTRIBUTE_RETURNS_NONNULL CXXRecordDecl * getDecl() const
QualType getValueType() const override
void printPrettyAsExpr(raw_ostream &os) const override
Print the region as expression.
void dumpToStream(raw_ostream &os) const override
bool hasTrait(SymbolRef Sym, InvalidationKinds IK) const
ASTContext & getContext() const
void Profile(llvm::FoldingSetNodeID &ID) const override
const CXXThisRegion * getCXXThisRegion(QualType thisPointerTy, const LocationContext *LC)
getCXXThisRegion - Retrieve the [artificial] region associated with the parameter 'this'.
virtual bool isBoundable() const
QualType getValueType() const override
const SymbolicRegion * getSymbolicBase() const
If this is a symbolic region, returns the region.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
bool canPrintPrettyAsExpr() const override
Returns true if this region's textual representation can be used as part of a larger expression.
MemRegionManager(ASTContext &c, llvm::BumpPtrAllocator &a)
static bool classof(const MemRegion *R)
virtual QualType getLocationType() const =0
void printPrettyAsExpr(raw_ostream &os) const override
Print the region as expression.
LLVM_ATTRIBUTE_RETURNS_NONNULL AnalysisDeclContext * getAnalysisDeclContext() const
static bool classof(const MemRegion *R)
const BlockCodeRegion * getBlockCodeRegion(const BlockDecl *BD, CanQualType locTy, AnalysisDeclContext *AC)
ObjCStringLiteral, used for Objective-C string literals i.e.
The region containing globals which are considered not to be modified or point to data which could be...
AllocaRegion - A region that represents an untyped blob of bytes created by a call to 'alloca'.
void setTrait(SymbolRef Sym, InvalidationKinds IK)
DefinedOrUnknownSVal getStaticSize(const MemRegion *MR, SValBuilder &SVB) const
void Profile(llvm::FoldingSetNodeID &ID) const override
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
const LLVM_ATTRIBUTE_RETURNS_NONNULL ObjCStringLiteral * getObjCStringLiteral() const
const T * getAs() const
Member-template getAs<specific type>'.
InvalidationKinds
Describes different invalidation traits.
SubRegion(const MemRegion *sReg, Kind k)
virtual bool isSubRegionOf(const MemRegion *R) const
Check if the region is a subregion of the given region.
void Profile(llvm::FoldingSetNodeID &ID) const override
static bool classof(const MemRegion *R)
MemRegionManager & getMemRegionManager() const override
const ElementRegion * getElementRegion(QualType elementType, NonLoc Idx, const SubRegion *superRegion, ASTContext &Ctx)
getElementRegion - Retrieve the memory region associated with the associated element type,...
static bool classof(const MemRegion *R)
BlockDataRegion - A region that represents a block instance.
void dumpToStream(raw_ostream &os) const override
static bool classof(const MemRegion *R)
StringRegion - Region associated with a StringLiteral.
void dumpToStream(raw_ostream &os) const override
Represents a variable declaration or definition.
NonStaticGlobalSpaceRegion(MemRegionManager &mgr, Kind k)
const LLVM_ATTRIBUTE_RETURNS_NONNULL FieldDecl * getDecl() const override
StringLiteral - This represents a string literal expression, e.g.
referenced_vars_iterator & operator++()
static bool classof(const MemRegion *R)
void dumpToStream(raw_ostream &os) const override
void dumpToStream(raw_ostream &os) const override
virtual void printPretty(raw_ostream &os) const
Print the region for use in diagnostics.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
const LLVM_ATTRIBUTE_RETURNS_NONNULL BlockDecl * getDecl() const
CharUnits getOffset() const
const LLVM_ATTRIBUTE_RETURNS_NONNULL StringLiteral * getStringLiteral() const
static bool classof(const MemRegion *R)
bool hasStackNonParametersStorage() const
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
QualType getLocationType() const override
ElementRegion is used to represent both array elements and casts.
void Profile(llvm::FoldingSetNodeID &ID) const override
static bool classof(const MemRegion *R)
RegionOffset getAsOffset() const
Compute the offset within the top level memory object.
static bool classof(const MemRegion *R)
bool isBoundable() const override
void printPrettyAsExpr(raw_ostream &os) const override
Print the region as expression.
static bool classof(const MemRegion *R)
SymbolicRegion - A special, "non-concrete" region.
void printPrettyAsExpr(raw_ostream &os) const override
Print the region as expression.
bool isBoundable() const override
static bool classof(const MemRegion *R)
TypedRegion(const MemRegion *sReg, Kind k)
const LLVM_ATTRIBUTE_RETURNS_NONNULL RegionTy * castAs() const
virtual bool canPrintPrettyAsExpr() const
Returns true if this region's textual representation can be used as part of a larger expression.
The region for all the non-static global variables.
void Profile(llvm::FoldingSetNodeID &ID) const override
void dumpToStream(raw_ostream &os) const override
const ParamVarRegion * getParamVarRegion(const Expr *OriginExpr, unsigned Index, const LocationContext *LC)
getParamVarRegion - Retrieve or create the memory region associated with a specified CallExpr,...
int64_t getOffset() const
void dumpToStream(raw_ostream &os) const override
CompoundLiteralExpr - [C99 6.5.2.5].
QualType getDesugaredType(const ASTContext &Context) const
Return the specified type with any "sugar" removed from the type.
void dumpToStream(raw_ostream &os) const override
const RegionTy * getAs() const
static bool classof(const MemRegion *R)
Represents a C++ struct/union/class.
static bool classof(const MemRegion *R)
static bool classof(const MemRegion *R)
const LLVM_ATTRIBUTE_RETURNS_NONNULL MemSpaceRegion * getMemorySpace() const
bool hasStackStorage() const
bool canPrintPrettyAsExpr() const override
Returns true if this region's textual representation can be used as part of a larger expression.
static const int64_t Symbolic
static bool classof(const MemRegion *R)
GlobalsSpaceRegion(MemRegionManager &mgr, Kind k)
void dumpToStream(raw_ostream &os) const override
static bool classof(const MemRegion *R)
static bool classof(const MemRegion *R)
llvm::BumpPtrAllocator & getAllocator()
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
bool isBoundable() const override
VarRegion(const MemRegion *sReg, Kind k)
const CXXTempObjectRegion * getCXXTempObjectRegion(Expr const *Ex, LocationContext const *LC)
bool isNull() const
Return true if this QualType doesn't point to a type yet.
unsigned getIndex() const
FunctionCodeRegion - A region that represents code texts of function.
void dumpToStream(raw_ostream &os) const override
const StackLocalsSpaceRegion * getStackLocalsRegion(const StackFrameContext *STC)
getStackLocalsRegion - Retrieve the memory region associated with the specified stack frame.
QualType getValueType() const override
const StringRegion * getStringRegion(const StringLiteral *Str)
const FieldRegion * getFieldRegionWithSuper(const FieldRegion *FR, const SubRegion *superRegion)
void dumpToStream(raw_ostream &os) const override
void Profile(llvm::FoldingSetNodeID &ID) const override
const StackFrameContext * getStackFrame() const
It might return null.
bool isBoundable() const override
const CXXBaseObjectRegion * getCXXBaseObjectRegionWithSuper(const CXXBaseObjectRegion *baseReg, const SubRegion *superRegion)
Create a CXXBaseObjectRegion with the same CXXRecordDecl but a different super region.
const LLVM_ATTRIBUTE_RETURNS_NONNULL Expr * getOriginExpr() const
const LLVM_ATTRIBUTE_RETURNS_NONNULL BlockDecl * getDecl() const
void dumpToStream(raw_ostream &os) const override
void Profile(llvm::FoldingSetNodeID &ID) const override
referenced_vars_iterator referenced_vars_end() const
QualType getValueType() const override
const LLVM_ATTRIBUTE_RETURNS_NONNULL StackFrameContext * getStackFrame() const
const llvm::APSInt & getValue() const
static bool classof(const MemRegion *R)
void Profile(llvm::FoldingSetNodeID &ID) const override
const LLVM_ATTRIBUTE_RETURNS_NONNULL MemRegion * getMostDerivedObjectRegion() const
Recursively retrieve the region of the most derived class instance of regions of C++ base class insta...
void printPrettyAsExpr(raw_ostream &os) const override
Print the region as expression.
const ObjCStringRegion * getObjCStringRegion(const ObjCStringLiteral *Str)
const LLVM_ATTRIBUTE_RETURNS_NONNULL Expr * getExpr() const
static void ProfileRegion(llvm::FoldingSetNodeID &ID, SymbolRef sym, const MemRegion *superRegion)
void dumpToStream(raw_ostream &os) const override
const MemRegion * getRegion() const
PointerType - C99 6.7.5.1 - Pointer Declarators.
const LLVM_ATTRIBUTE_RETURNS_NONNULL VarDecl * getDecl() const override
static bool classof(const MemRegion *R)
@ TK_PreserveContents
Tells that a region's contents is not changed.
virtual QualType getValueType() const =0
void dumpToStream(raw_ostream &os) const override
raw_ostream & operator<<(raw_ostream &Out, const CheckerBase &Checker)
Dump checker name to stream.
void dumpToStream(raw_ostream &os) const override
void printPretty(raw_ostream &os) const override
Print the region for use in diagnostics.
bool hasSymbolicOffset() const
static bool classof(const MemRegion *R)
TypedRegion - An abstract class representing regions that are typed.
const CXXTempObjectRegion * getCXXStaticTempObjectRegion(const Expr *Ex)
Create a CXXTempObjectRegion for temporaries which are lifetime-extended by static references.
static bool classof(const MemRegion *R)
ObjCIvarDecl - Represents an ObjC instance variable.
StackSpaceRegion(MemRegionManager &mgr, Kind k, const StackFrameContext *sfc)
MemRegionManager & getMemRegionManager() const override
virtual void printPrettyAsExpr(raw_ostream &os) const
Print the region as expression.
ASTContext & getContext()
@ TK_DoNotInvalidateSuperRegion
QualType getValueType() const override
void Profile(llvm::FoldingSetNodeID &ID) const override
const LLVM_ATTRIBUTE_RETURNS_NONNULL MemRegion * getSuperRegion() const
void Profile(llvm::FoldingSetNodeID &ID) const override
__device__ __2f16 float bool s
std::string getDescriptiveName(bool UseQuotes=true) const
Get descriptive name for memory region.
void printPrettyAsExpr(raw_ostream &os) const override
Print the region as expression.
bool isBoundable() const override
const Type * getTypePtrOrNull() const
bool operator!=(const referenced_vars_iterator &I) const
virtual void dumpToStream(raw_ostream &os) const
static bool classof(const MemRegion *R)
The region of the static variables within the current CodeTextRegion scope.
__device__ __2f16 float c
CXXThisRegion - Represents the region for the implicit 'this' parameter in a call to a C++ method.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
SVal - This represents a symbolic expression, which can be either an L-value or an R-value.
CharUnits - This is an opaque type for sizes expressed in character units.
bool canPrintPrettyAsExpr() const override
Returns true if this region's textual representation can be used as part of a larger expression.
QualType getPointeeType() const
const GlobalsSpaceRegion * getGlobalsRegion(MemRegion::Kind K=MemRegion::GlobalInternalSpaceRegionKind, const CodeTextRegion *R=nullptr)
getGlobalsRegion - Retrieve the memory region associated with global variables.
The region containing globals which can be modified by calls to "internally" defined functions - (for...
void dumpToStream(raw_ostream &os) const
QualType getValueType() const override
TypedValueRegion - An abstract class representing regions having a typed value.
SubRegion - A region that subsets another larger region.
The region containing globals which are defined in system/external headers and are considered modifia...
const SymbolicRegion * getSymbolicRegion(SymbolRef Sym, const MemSpaceRegion *MemSpace=nullptr)
Retrieve or create a "symbolic" memory region.
void dumpToStream(raw_ostream &os) const override
void dumpToStream(raw_ostream &os) const override
const LLVM_ATTRIBUTE_RETURNS_NONNULL MemRegion * getBaseRegion() const
void Profile(llvm::FoldingSetNodeID &ID) const override
void Profile(llvm::FoldingSetNodeID &ID) const override
static bool classof(const MemRegion *R)
Information about invalidation for a particular region/symbol.
QualType getValueType() const override
MemSpaceRegion(MemRegionManager &mgr, Kind k)
This represents one expression.
static bool classof(const MemRegion *R)
void dumpToStream(raw_ostream &os) const override
static bool classof(const MemRegion *R)
QualType getLocationType() const override
void dumpToStream(raw_ostream &os) const override
const VarRegion * getOriginalRegion(const VarRegion *VR) const
Return the original region for a captured region, if one exists.
std::string getString() const
Get a string representation of a region for debug use.
virtual bool canPrintPretty() const
Returns true if this region can be printed in a user-friendly way.
QualType getLocationType() const override
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
static bool classof(const MemRegion *R)
TypedValueRegion(const MemRegion *sReg, Kind k)
void dumpToStream(raw_ostream &os) const override
void dumpToStream(raw_ostream &os) const override
const LLVM_ATTRIBUTE_RETURNS_NONNULL ObjCIvarDecl * getDecl() const override
const MemRegion * superRegion
static bool classof(const MemRegion *R)
const VarDecl * getDecl() const override=0
SourceRange sourceRange() const
Retrieve source range from memory region.
static bool classof(const MemRegion *R)
bool isBoundable() const override
RegionRawOffset getAsArrayOffset() const
Compute the offset within the array. The array might also be a subobject.
static bool classof(const MemRegion *region)
const ParmVarDecl * getDecl() const override
TODO: What does this return?
ParamVarRegion - Represents a region for paremters.