25 #include "llvm/Support/raw_ostream.h"
27 using namespace clang;
36 template <
typename RegionTy,
typename A1>
37 RegionTy* MemRegionManager::getRegion(
const A1 a1) {
42 llvm::FoldingSetNodeID
ID;
43 RegionTy::ProfileRegion(ID, a1, superRegion);
45 RegionTy* R = cast_or_null<RegionTy>(Regions.FindNodeOrInsertPos(ID,
49 R = (RegionTy*) A.Allocate<RegionTy>();
50 new (R) RegionTy(a1, superRegion);
51 Regions.InsertNode(R, InsertPos);
57 template <
typename RegionTy,
typename A1>
58 RegionTy* MemRegionManager::getSubRegion(
const A1 a1,
60 llvm::FoldingSetNodeID
ID;
61 RegionTy::ProfileRegion(ID, a1, superRegion);
63 RegionTy* R = cast_or_null<RegionTy>(Regions.FindNodeOrInsertPos(ID,
67 R = (RegionTy*) A.Allocate<RegionTy>();
68 new (R) RegionTy(a1, superRegion);
69 Regions.InsertNode(R, InsertPos);
75 template <
typename RegionTy,
typename A1,
typename A2>
76 RegionTy* MemRegionManager::getRegion(
const A1 a1,
const A2 a2) {
81 llvm::FoldingSetNodeID
ID;
82 RegionTy::ProfileRegion(ID, a1, a2, superRegion);
84 RegionTy* R = cast_or_null<RegionTy>(Regions.FindNodeOrInsertPos(ID,
88 R = (RegionTy*) A.Allocate<RegionTy>();
89 new (R) RegionTy(a1, a2, superRegion);
90 Regions.InsertNode(R, InsertPos);
96 template <
typename RegionTy,
typename A1,
typename A2>
97 RegionTy* MemRegionManager::getSubRegion(
const A1 a1,
const A2 a2,
100 llvm::FoldingSetNodeID
ID;
101 RegionTy::ProfileRegion(ID, a1, a2, superRegion);
103 RegionTy* R = cast_or_null<RegionTy>(Regions.FindNodeOrInsertPos(ID,
107 R = (RegionTy*) A.Allocate<RegionTy>();
108 new (R) RegionTy(a1, a2, superRegion);
109 Regions.InsertNode(R, InsertPos);
115 template <
typename RegionTy,
typename A1,
typename A2,
typename A3>
116 RegionTy* MemRegionManager::getSubRegion(
const A1 a1,
const A2 a2,
const A3 a3,
119 llvm::FoldingSetNodeID
ID;
120 RegionTy::ProfileRegion(ID, a1, a2, a3, superRegion);
122 RegionTy* R = cast_or_null<RegionTy>(Regions.FindNodeOrInsertPos(ID,
126 R = (RegionTy*) A.Allocate<RegionTy>();
127 new (R) RegionTy(a1, a2, a3, superRegion);
128 Regions.InsertNode(R, InsertPos);
151 while (r !=
nullptr) {
154 if (
const SubRegion* sr = dyn_cast<SubRegion>(r))
155 r = sr->getSuperRegion();
166 if (
const SubRegion *sr = dyn_cast<SubRegion>(superRegion)) {
187 if (isa<VariableArrayType>(T))
209 if (isa<ConstantArrayType>(T))
230 :
DeclRegion(ivd, sReg, ObjCIvarRegionKind) {}
233 return cast<ObjCIvarDecl>(
D);
249 ID.AddInteger((
unsigned)
getKind());
253 ID.AddInteger((
unsigned)
getKind());
258 ID.AddInteger((
unsigned)
getKind());
267 ID.AddPointer(superRegion);
275 ID.AddPointer(superRegion);
279 const Expr *Ex,
unsigned cnt,
284 ID.AddPointer(superRegion);
292 CompoundLiteralRegion::ProfileRegion(ID, CL, superRegion);
295 void CompoundLiteralRegion::ProfileRegion(llvm::FoldingSetNodeID& ID,
300 ID.AddPointer(superRegion);
303 void CXXThisRegion::ProfileRegion(llvm::FoldingSetNodeID &ID,
308 ID.AddPointer(sRegion);
312 CXXThisRegion::ProfileRegion(ID, ThisPointerTy, superRegion);
315 void ObjCIvarRegion::ProfileRegion(llvm::FoldingSetNodeID& ID,
323 ID.AddInteger((
unsigned) k);
325 ID.AddPointer(superRegion);
333 VarRegion::ProfileRegion(ID,
getDecl(), superRegion);
347 void ElementRegion::ProfileRegion(llvm::FoldingSetNodeID& ID,
352 ID.AddPointer(superRegion);
357 ElementRegion::ProfileRegion(ID, ElementType, Index, superRegion);
391 ID.AddInteger(BlkCount);
399 void CXXTempObjectRegion::ProfileRegion(llvm::FoldingSetNodeID &ID,
410 void CXXBaseObjectRegion::ProfileRegion(llvm::FoldingSetNodeID &ID,
415 ID.AddBoolean(IsVirtual);
427 void GlobalsSpaceRegion::anchor() { }
428 void HeapSpaceRegion::anchor() { }
429 void UnknownSpaceRegion::anchor() { }
430 void StackLocalsSpaceRegion::anchor() { }
431 void StackArgumentsSpaceRegion::anchor() { }
435 void SubRegion::anchor() { }
447 llvm::raw_string_ostream os(s);
453 os <<
"<Unknown Region>";
457 os <<
"alloca{" << (
const void*) Ex <<
',' <<
Cnt <<
'}';
465 os <<
"block_code{" << (
const void*)
this <<
'}';
469 os <<
"block_data{" << BC;
474 os <<
"(" <<
I.getCapturedRegion() <<
"," <<
475 I.getOriginalRegion() <<
") ";
481 os <<
"{ " << (
const void*) CL <<
" }";
486 << (
const void*) Ex <<
'}';
490 os <<
"base{" << superRegion <<
',' <<
getDecl()->
getName() <<
'}';
498 os <<
"element{" << superRegion <<
','
503 os << superRegion <<
"->" << *
getDecl();
507 os <<
"ivar{" << superRegion <<
',' << *
getDecl() <<
'}';
511 assert(Str !=
nullptr &&
"Expecting non-null StringLiteral");
516 assert(Str !=
nullptr &&
"Expecting non-null ObjCStringLiteral");
521 os <<
"SymRegion{" <<
sym <<
'}';
525 os << *cast<VarDecl>(
D);
537 os <<
"CodeSpaceRegion";
541 os <<
"StaticGlobalsMemSpace{" << CR <<
'}';
545 os <<
"GlobalInternalSpaceRegion";
549 os <<
"GlobalSystemSpaceRegion";
553 os <<
"GlobalImmutableSpaceRegion";
557 os <<
"HeapSpaceRegion";
561 os <<
"UnknownSpaceRegion";
565 os <<
"StackArgumentsSpaceRegion";
569 os <<
"StackLocalsSpaceRegion";
581 assert(
canPrintPretty() &&
"This region cannot be printed pretty.");
589 llvm_unreachable(
"This region cannot be printed pretty.");
646 template <
typename REG>
647 const REG *MemRegionManager::LazyAllocate(REG*& region) {
649 region = (REG*) A.Allocate<REG>();
650 new (region) REG(
this);
656 template <
typename REG,
typename ARG>
657 const REG *MemRegionManager::LazyAllocate(REG*& region, ARG a) {
659 region = (REG*) A.Allocate<REG>();
660 new (region) REG(
this, a);
697 return LazyAllocate(SystemGlobals);
699 return LazyAllocate(ImmutableGlobals);
701 return LazyAllocate(InternalGlobals);
715 return LazyAllocate(heap);
719 return LazyAllocate(unknown);
723 return LazyAllocate(code);
741 static llvm::PointerUnion<const StackFrameContext *, const VarRegion *>
747 if (cast<DeclContext>(SFC->getDecl()) == DC)
751 dyn_cast<BlockInvocationContext>(LC)) {
758 if (
const VarRegion *VR = dyn_cast<VarRegion>(
I.getOriginalRegion()))
759 if (VR->getDecl() == VD)
760 return cast<VarRegion>(
I.getCapturedRegion());
776 if (
C.getSourceManager().isInSystemHeader(D->
getLocation())) {
779 if (D->
getName().find(
"errno") != StringRef::npos)
801 llvm::PointerUnion<const StackFrameContext *, const VarRegion *> V =
813 sReg = isa<ParmVarDecl>(D) || isa<ImplicitParamDecl>(D)
819 const Decl *STCD = STC->getDecl();
820 if (isa<FunctionDecl>(STCD) || isa<ObjCMethodDecl>(STCD))
823 else if (
const BlockDecl *BD = dyn_cast<BlockDecl>(STCD)) {
839 STC->getAnalysisDeclContext());
850 return getSubRegion<VarRegion>(D, sReg);
855 return getSubRegion<VarRegion>(D, superR);
861 unsigned blockCount) {
883 return getSubRegion<BlockDataRegion>(BC, LC, blockCount, sReg);
888 return getSubRegion<CXXTempObjectRegion>(
906 return getSubRegion<CompoundLiteralRegion>(CL, sReg);
916 llvm::FoldingSetNodeID
ID;
917 ElementRegion::ProfileRegion(ID, T, Idx, superRegion);
920 MemRegion* data = Regions.FindNodeOrInsertPos(ID, InsertPos);
926 Regions.InsertNode(R, InsertPos);
934 return getSubRegion<FunctionCodeRegion>(FD,
getCodeRegion());
940 return getSubRegion<BlockCodeRegion>(BD, locTy, AC,
getCodeRegion());
956 return getSubRegion<FieldRegion>(d, superRegion);
962 return getSubRegion<ObjCIvarRegion>(d, superRegion);
987 for (
const auto &
I : Class->
bases()) {
988 if (
I.getType()->getAsCXXRecordDecl()->getCanonicalDecl() == BaseClass)
999 if (isa<TypedValueRegion>(Super)) {
1000 assert(
isValidBaseClass(RD, dyn_cast<TypedValueRegion>(Super), IsVirtual));
1007 dyn_cast<CXXBaseObjectRegion>(Super)) {
1008 Super =
Base->getSuperRegion();
1010 assert(Super && !isa<MemSpaceRegion>(Super));
1014 return getSubRegion<CXXBaseObjectRegion>(RD, IsVirtual, Super);
1029 (!D || D->isStatic() ||
1073 return isa<StackArgumentsSpaceRegion>(MS) ||
1074 isa<GlobalsSpaceRegion>(MS);
1087 R = cast<SubRegion>(R)->getSuperRegion();
1117 if (!StripBaseCasts)
1119 R = cast<CXXBaseObjectRegion>(R)->getSuperRegion();
1153 int64_t i = CI->getValue().getSExtValue();
1165 offset += (i * size);
1176 assert(superR &&
"super region cannot be NULL");
1184 assert(Child &&
"Child must not be null");
1188 for (
const auto &
I : Child->
bases()) {
1189 if (
I.getType()->getAsCXXRecordDecl() == Base)
1198 const MemRegion *SymbolicOffsetBase =
nullptr;
1213 assert(Offset == 0 && !SymbolicOffsetBase);
1222 SymbolicOffsetBase = R;
1227 case CompoundLiteralRegionKind:
1228 case CXXThisRegionKind:
1249 bool RootIsSymbolic =
false;
1251 Ty = TVR->getDesugaredValueType(
getContext());
1252 }
else if (
const SymbolicRegion *SR = dyn_cast<SymbolicRegion>(R)) {
1257 RootIsSymbolic =
true;
1263 SymbolicOffsetBase = R;
1265 if (RootIsSymbolic) {
1271 SymbolicOffsetBase = R;
1274 SymbolicOffsetBase = R;
1281 if (SymbolicOffsetBase)
1302 SymbolicOffsetBase = R;
1311 if (SymbolicOffsetBase)
1314 int64_t i = CI->getValue().getSExtValue();
1319 SymbolicOffsetBase = R;
1334 SymbolicOffsetBase = R;
1339 if (SymbolicOffsetBase)
1345 FE = RD->
field_end(); FI != FE; ++FI, ++idx)
1358 if (SymbolicOffsetBase)
1367 std::pair<const VarRegion *, const VarRegion *>
1368 BlockDataRegion::getCaptureRegions(
const VarDecl *VD) {
1387 return std::make_pair(VR, OriginalVR);
1390 void BlockDataRegion::LazyInitializeReferencedVars() {
1397 std::distance(ReferencedBlockVars.begin(), ReferencedBlockVars.end());
1399 if (NumBlockVars == 0) {
1400 ReferencedVars = (
void*) 0x1;
1409 VarVec *BV = (VarVec*) A.Allocate<VarVec>();
1410 new (BV) VarVec(BC, NumBlockVars);
1411 VarVec *BVOriginal = (VarVec*) A.Allocate<VarVec>();
1412 new (BVOriginal) VarVec(BC, NumBlockVars);
1414 for (
const VarDecl *VD : ReferencedBlockVars) {
1417 std::tie(VR, OriginalVR) = getCaptureRegions(VD);
1420 BV->push_back(VR, BC);
1421 BVOriginal->push_back(OriginalVR, BC);
1424 ReferencedVars = BV;
1425 OriginalVars = BVOriginal;
1435 if (Vec == (
void*) 0x1)
1442 VecOriginal->
begin());
1452 if (Vec == (
void*) 0x1)
1459 VecOriginal->
end());
1466 if (
I.getCapturedRegion() == R)
1467 return I.getOriginalRegion();
1478 SymTraitsMap[Sym] |= IK;
1487 MRTraitsMap[MR] |= IK;
1492 const_symbol_iterator
I = SymTraitsMap.find(Sym);
1493 if (I != SymTraitsMap.end())
1494 return I->second & IK;
1505 return hasTrait(SR->getSymbol(), IK);
1507 const_region_iterator
I = MRTraitsMap.find(MR);
1508 if (I != MRTraitsMap.end())
1509 return I->second & IK;
bool hasStackStorage() const
void Profile(llvm::FoldingSetNodeID &ID) const
bool hasTrait(SymbolRef Sym, InvalidationKinds IK)
void dumpToStream(raw_ostream &os) const override
TypedValueRegion - An abstract class representing regions having a typed value.
nonloc::ConcreteInt makeIntVal(const IntegerLiteral *integer)
CompoundLiteralRegion - A memory region representing a compound literal.
StringRef getName() const
getName - Get the name of identifier for this declaration as a StringRef.
PointerType - C99 6.7.5.1 - Pointer Declarators.
SymbolManager & getSymbolManager()
A (possibly-)qualified type.
MemRegion - The root abstract class for all memory regions.
QualType getArrayIndexType() const
const FieldRegion * getFieldRegion(const FieldDecl *fd, const MemRegion *superRegion)
getFieldRegion - Retrieve or create the memory region associated with a specified FieldDecl...
virtual bool canPrintPretty() const
Returns true if this region can be printed in a user-friendly way.
const CodeTextRegion * getCodeRegion() const
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
FunctionType - C99 6.7.5.3 - Function Declarators.
const StackFrameContext * getStackFrame() const
Defines the SourceManager interface.
bool canPrintPrettyAsExpr() const override
Returns true if this region's textual representation can be used as part of a larger expression...
virtual bool inTopFrame() const
Return true if the current LocationContext has no caller context.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
bool hasGlobalsOrParametersStorage() const
BlockCodeRegion - A region that represents code texts of blocks (closures).
virtual QualType getValueType() const =0
Decl - This represents one declaration (or definition), e.g.
void dumpToStream(raw_ostream &os) const override
const StringRegion * getStringRegion(const StringLiteral *Str)
const GlobalsSpaceRegion * getGlobalsRegion(MemRegion::Kind K=MemRegion::GlobalInternalSpaceRegionKind, const CodeTextRegion *R=nullptr)
getGlobalsRegion - Retrieve the memory region associated with global variables.
std::string getAsString() const
The base class of the type hierarchy.
CharUnits getOffset() const
CharUnits getVBaseClassOffset(const CXXRecordDecl *VBase) const
getVBaseClassOffset - Get the offset, in chars, for the given base class.
MemSpaceRegion - A memory region that represents a "memory space"; for example, the set of global var...
A container of type source information.
static void ProfileRegion(llvm::FoldingSetNodeID &ID, const NamedDecl *FD, const MemRegion *)
AnalysisDeclContext * getAnalysisDeclContext() const
Value representing integer constant.
AllocaRegion - A region that represents an untyped blob of bytes created by a call to 'alloca'...
CodeSpaceRegion - The memory space that holds the executable code of functions and blocks...
const StackArgumentsSpaceRegion * getStackArgumentsRegion(const StackFrameContext *STC)
getStackArgumentsRegion - Retrieve the memory region associated with function/method arguments of the...
ASTContext & getContext()
QualType getBlockPointerType(QualType T) const
Return the uniqued reference to the type for a block of the specified type.
VarDecl - An instance of this class is created to represent a variable declaration or definition...
void printPretty(raw_ostream &os) const override
Print the region for use in diagnostics.
referenced_vars_iterator referenced_vars_begin() const
CompoundLiteralExpr - [C99 6.5.2.5].
void Profile(llvm::FoldingSetNodeID &ID) const override
bool hasCaptures() const
hasCaptures - True if this block (or its nested blocks) captures anything of local storage from its e...
void setTrait(SymbolRef Sym, InvalidationKinds IK)
field_iterator field_begin() const
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
QualType getElementType() const
void Profile(llvm::FoldingSetNodeID &ID) const override
bool hasGlobalStorage() const
Returns true for all variables that do not have local storage.
std::string getString() const
Get a string representation of a region for debug use.
const ObjCStringRegion * getObjCStringRegion(const ObjCStringLiteral *Str)
const MemRegion * getBaseRegion() const
static bool isValidBaseClass(const CXXRecordDecl *BaseClass, const TypedValueRegion *Super, bool IsVirtual)
Checks whether BaseClass is a valid virtual or direct non-virtual base class of the type of Super...
Describes how types, statements, expressions, and declarations should be printed. ...
bool isZeroConstant() const
QualType getFunctionNoProtoType(QualType ResultTy, const FunctionType::ExtInfo &Info) const
Return a K&R style C function type like 'int()'.
referenced_vars_iterator referenced_vars_end() const
CXXThisRegion - Represents the region for the implicit 'this' parameter in a call to a C++ method...
RecordDecl - Represents a struct/union/class.
const MemSpaceRegion * getMemorySpace() const
const BlockDecl * getDecl() const
DefinedOrUnknownSVal getExtent(SValBuilder &svalBuilder) const override
getExtent - Returns the size of the region in bytes.
const HeapSpaceRegion * getHeapRegion()
getHeapRegion - Retrieve the memory region associated with the generic "heap".
The region associated with an ObjCStringLiteral.
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 ...
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
bool isCompleteDefinition() const
isCompleteDefinition - Return true if this decl has its body fully specified.
AnalysisDeclContext contains the context data for the function or method under analysis.
const MemRegion * getRegion() const
bool hasStackParametersStorage() const
const StackLocalsSpaceRegion * getStackLocalsRegion(const StackFrameContext *STC)
getStackLocalsRegion - Retrieve the memory region associated with the specified stack frame...
const ObjCIvarRegion * getObjCIvarRegion(const ObjCIvarDecl *ivd, const MemRegion *superRegion)
getObjCIvarRegion - Retrieve or create the memory region associated with a specified Objective-c inst...
void Profile(llvm::FoldingSetNodeID &ID) const override
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
const CXXRecordDecl * getDecl() const
void printPrettyAsExpr(raw_ostream &os) const override
Print the region as expression.
const SymbolicRegion * getSymbolicRegion(SymbolRef Sym)
Retrieve or create a "symbolic" memory region.
void Profile(llvm::FoldingSetNodeID &ID) const override
const VarDecl * getDecl() const
RegionRawOffset getAsArrayOffset() const
Compute the offset within the array. The array might also be a subobject.
BlockDataRegion - A region that represents a block instance.
const AllocaRegion * getAllocaRegion(const Expr *Ex, unsigned Cnt, const LocationContext *LC)
getAllocaRegion - Retrieve a region associated with a call to alloca().
const SymbolicRegion * getSymbolicBase() const
If this is a symbolic region, returns the region.
const ObjCIvarDecl * getDecl() const
const UnknownSpaceRegion * getUnknownRegion()
getUnknownRegion - Retrieve the memory region associated with unknown memory space.
CharUnits - This is an opaque type for sizes expressed in character units.
void dumpToStream(raw_ostream &os) const override
const StringLiteral * getStringLiteral() const
QualType getValueType() const override
void Profile(llvm::FoldingSetNodeID &ID) const override
void Profile(llvm::FoldingSetNodeID &ID) const override
void dumpToStream(raw_ostream &os) const override
ObjCStringLiteral, used for Objective-C string literals i.e.
void Profile(llvm::FoldingSetNodeID &ID) const override
CXXRecordDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
const ASTRecordLayout & getASTRecordLayout(const RecordDecl *D) const
Get or compute information about the layout of the specified record (struct/union/class) D...
void dumpToStream(raw_ostream &os) const override
uint64_t getFieldOffset(unsigned FieldNo) const
getFieldOffset - Get the offset of the given field index, in bits.
void dumpToStream(raw_ostream &os) const override
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types...
std::string getAsString() const
getNameAsString - Retrieve the human-readable string for this name.
void dumpToStream(raw_ostream &os) const override
static void ProfileRegion(llvm::FoldingSetNodeID &ID, const ObjCStringLiteral *Str, const MemRegion *superRegion)
bool isStaticLocal() const
isStaticLocal - Returns true if a variable with function scope is a static local variable.
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
detail::InMemoryDirectory::const_iterator I
Represent a region's offset within the top level base region.
virtual void printPrettyAsExpr(raw_ostream &os) const
Print the region as expression.
void Profile(llvm::FoldingSetNodeID &ID) const override
static void ProfileRegion(llvm::FoldingSetNodeID &ID, const Decl *D, const MemRegion *superRegion, Kind k)
bool canPrintPretty() const override
Returns true if this region can be printed in a user-friendly way.
const BlockCodeRegion * getBlockCodeRegion(const BlockDecl *BD, CanQualType locTy, AnalysisDeclContext *AC)
const CXXBaseObjectRegion * getCXXBaseObjectRegion(const CXXRecordDecl *BaseClass, const MemRegion *Super, bool IsVirtual)
Create a CXXBaseObjectRegion with the given base class for region Super.
const MemRegion * getSuperRegion() const
field_iterator field_end() const
void dumpToStream(raw_ostream &os) const override
const CodeSpaceRegion * getCodeRegion()
const StackFrameContext * getStackFrame() const
DefinedOrUnknownSVal getExtent(SValBuilder &svalBuilder) const override
getExtent - Returns the size of the region in bytes.
const MemRegion * StripCasts(bool StripBaseCasts=true) const
DefinedOrUnknownSVal getExtent(SValBuilder &svalBuilder) const override
getExtent - Returns the size of the region in bytes.
ID
Defines the set of possible language-specific address spaces.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
const VarRegion * getOriginalRegion(const VarRegion *VR) const
Return the original region for a captured region, if one exists.
SymbolicRegion - A special, "non-concrete" region.
ASTRecordLayout - This class contains layout information for one RecordDecl, which is a struct/union/...
bool canPrintPrettyAsExpr() const override
Returns true if this region's textual representation can be used as part of a larger expression...
const Type * getTypePtrOrNull() const
BlockDecl - This represents a block literal declaration, which is like an unnamed FunctionDecl...
Expr - This represents one expression.
void printPrettyAsExpr(raw_ostream &os) const override
Print the region as expression.
virtual bool canPrintPrettyAsExpr() const
Returns true if this region's textual representation can be used as part of a larger expression...
bool canPrintPrettyAsExpr() const override
Returns true if this region's textual representation can be used as part of a larger expression...
QualType getDesugaredValueType(ASTContext &Context) const
DefinedOrUnknownSVal getExtent(SValBuilder &svalBuilder) const override
getExtent - Returns the size of the region in bytes.
const ElementRegion * getElementRegion(QualType elementType, NonLoc Idx, const MemRegion *superRegion, ASTContext &Ctx)
getElementRegion - Retrieve the memory region associated with the associated element type...
void dumpToStream(raw_ostream &os) const override
Optional< T > getAs() const
Convert to the specified SVal type, returning None if this SVal is not of the desired type...
static const int64_t Symbolic
DeclContext * getDeclContext()
CharUnits getBaseClassOffset(const CXXRecordDecl *Base) const
getBaseClassOffset - Get the offset, in chars, for the given base class.
llvm::BumpPtrAllocator & getAllocator()
void Profile(llvm::FoldingSetNodeID &ID) const override
DeclarationName getDeclName() const
getDeclName - Get the actual, stored name of the declaration, which may be a special name...
The region of the static variables within the current CodeTextRegion scope.
static void ProfileRegion(llvm::FoldingSetNodeID &, const BlockCodeRegion *, const LocationContext *, unsigned, const MemRegion *)
void dumpToStream(raw_ostream &os) const override
QualType getValueType() const override
FunctionCodeRegion - A region that represents code texts of function.
ASTContext & getContext() const
const StackFrameContext * getCurrentStackFrame() const
virtual void dumpToStream(raw_ostream &os) const
static bool isImmediateBase(const CXXRecordDecl *Child, const CXXRecordDecl *Base)
Returns true if Base is an immediate base class of Child.
const FieldDecl * getDecl() const
void dumpToStream(raw_ostream &os) const override
const CXXTempObjectRegion * getCXXTempObjectRegion(Expr const *Ex, LocationContext const *LC)
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
Represents a static or instance method of a struct/union/class.
ASTContext & getContext()
void dumpToStream(raw_ostream &os) const override
void printPrettyAsExpr(raw_ostream &os) const override
Print the region as expression.
SVal - This represents a symbolic expression, which can be either an L-value or an R-value...
void dumpToStream(raw_ostream &os) const override
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
DefinedOrUnknownSVal getExtent(SValBuilder &svalBuilder) const override
getExtent - Returns the size of the region in bytes.
const Decl * getDecl() const
virtual void printPretty(raw_ostream &os) const
Print the region for use in diagnostics.
const CompoundLiteralRegion * getCompoundLiteralRegion(const CompoundLiteralExpr *CL, const LocationContext *LC)
getCompoundLiteralRegion - Retrieve the region associated with a given CompoundLiteral.
void Profile(llvm::FoldingSetNodeID &ID) const override
bool isVirtuallyDerivedFrom(const CXXRecordDecl *Base) const
Determine whether this class is virtually derived from the class Base.
void dumpToStream(raw_ostream &os) const override
const CXXThisRegion * getCXXThisRegion(QualType thisPointerTy, const LocationContext *LC)
getCXXThisRegion - Retrieve the [artificial] region associated with the parameter 'this'...
RegionOffset getAsOffset() const
Compute the offset within the top level memory object.
const SymbolicRegion * getSymbolicHeapRegion(SymbolRef sym)
Return a unique symbolic region belonging to heap memory space.
static void ProfileRegion(llvm::FoldingSetNodeID &ID, const BlockDecl *BD, CanQualType, const AnalysisDeclContext *, const MemRegion *)
const LocationContext * getParent() const
QualType getValueType() const override
static void ProfileRegion(llvm::FoldingSetNodeID &ID, const Expr *Ex, unsigned Cnt, const MemRegion *superRegion)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
llvm::iterator_range< referenced_decls_iterator > getReferencedBlockVars(const BlockDecl *BD)
const NamedDecl * getDecl() const
const VarRegion * getVarRegion(const VarDecl *D, const LocationContext *LC)
getVarRegion - Retrieve or create the memory region associated with a specified VarDecl and LocationC...
InvalidationKinds
Describes different invalidation traits.
static void ProfileRegion(llvm::FoldingSetNodeID &ID, const StringLiteral *Str, const MemRegion *superRegion)
Represents symbolic expression.
detail::InMemoryDirectory::const_iterator E
void Profile(llvm::FoldingSetNodeID &ID) const override
static llvm::PointerUnion< const StackFrameContext *, const VarRegion * > getStackOrCaptureRegionForDeclContext(const LocationContext *LC, const DeclContext *DC, const VarDecl *VD)
Look through a chain of LocationContexts to either find the StackFrameContext that matches a DeclCont...
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
void dumpToStream(raw_ostream &os) const override
const FunctionCodeRegion * getFunctionCodeRegion(const NamedDecl *FD)
specific_decl_iterator - Iterates over a subrange of declarations stored in a DeclContext, providing only those that are of type SpecificDecl (or a class derived from it).
const CXXTempObjectRegion * getCXXStaticTempObjectRegion(const Expr *Ex)
Create a CXXTempObjectRegion for temporaries which are lifetime-extended by static references...
void dumpToStream(raw_ostream &os) const override
virtual MemRegionManager * getMemRegionManager() const =0
void dumpToStream(raw_ostream &os) const override
const T * getAs() const
Member-template getAs<specific type>'.
SubRegion - A region that subsets another larger region.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
uint64_t getCharWidth() const
Return the size of the character type, in bits.
const BlockDataRegion * getBlockDataRegion(const BlockCodeRegion *bc, const LocationContext *lc, unsigned blockCount)
getBlockDataRegion - Get the memory region associated with an instance of a block.
MemRegionManager * getMemRegionManager() const override
void Profile(llvm::FoldingSetNodeID &ID) const override
bool canPrintPrettyAsExpr() const override
Returns true if this region's textual representation can be used as part of a larger expression...
const SymbolExtent * getExtentSymbol(const SubRegion *R)
void dumpToStream(raw_ostream &os) const
static void ProfileRegion(llvm::FoldingSetNodeID &ID, SymbolRef sym, const MemRegion *superRegion)
Represents a C++ struct/union/class.
void dumpToStream(raw_ostream &os) const override
void printPrettyAsExpr(raw_ostream &os) const override
Print the region as expression.
ObjCIvarDecl - Represents an ObjC instance variable.
const BlockCodeRegion * getCodeRegion() const
QualType getValueType() const override
StringLiteral - This represents a string literal expression, e.g.
void dumpToStream(raw_ostream &os) const override
StringRegion - Region associated with a StringLiteral.
ElementRegin is used to represent both array elements and casts.
virtual bool isSubRegionOf(const MemRegion *R) const
Check if the region is a subregion of the given region.
void dumpToStream(raw_ostream &os) const override
SourceLocation getLocation() const
bool hasStackNonParametersStorage() const
NamedDecl - This represents a decl with a name.
bool isArithmeticType() const
bool isConstQualified() const
Determine whether this type is const-qualified.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
void dumpToStream(raw_ostream &os) const override
void dumpToStream(raw_ostream &os) const override
bool hasLocalStorage() const
hasLocalStorage - Returns true if a variable with function scope is a non-static local variable...
const RecordDecl * getParent() const
getParent - Returns the parent of this field declaration, which is the struct in which this method is...
void dumpToStream(raw_ostream &os) const override