25 #include "llvm/Support/raw_ostream.h"
27 using namespace clang;
36 template <
typename RegionTy,
typename A1>
37 RegionTy* MemRegionManager::getRegion(
const A1 a1) {
41 llvm::FoldingSetNodeID
ID;
42 RegionTy::ProfileRegion(ID, a1, superRegion);
44 RegionTy* R = cast_or_null<RegionTy>(Regions.FindNodeOrInsertPos(ID,
48 R = A.Allocate<RegionTy>();
49 new (R) RegionTy(a1, superRegion);
50 Regions.InsertNode(R, InsertPos);
56 template <
typename RegionTy,
typename A1>
57 RegionTy* MemRegionManager::getSubRegion(
const A1 a1,
59 llvm::FoldingSetNodeID
ID;
60 RegionTy::ProfileRegion(ID, a1, superRegion);
62 RegionTy* R = cast_or_null<RegionTy>(Regions.FindNodeOrInsertPos(ID,
66 R = A.Allocate<RegionTy>();
67 new (R) RegionTy(a1, superRegion);
68 Regions.InsertNode(R, InsertPos);
74 template <
typename RegionTy,
typename A1,
typename A2>
75 RegionTy* MemRegionManager::getRegion(
const A1 a1,
const A2 a2) {
79 llvm::FoldingSetNodeID
ID;
80 RegionTy::ProfileRegion(ID, a1, a2, superRegion);
82 RegionTy* R = cast_or_null<RegionTy>(Regions.FindNodeOrInsertPos(ID,
86 R = A.Allocate<RegionTy>();
87 new (R) RegionTy(a1, a2, superRegion);
88 Regions.InsertNode(R, InsertPos);
94 template <
typename RegionTy,
typename A1,
typename A2>
95 RegionTy* MemRegionManager::getSubRegion(
const A1 a1,
const A2 a2,
97 llvm::FoldingSetNodeID
ID;
98 RegionTy::ProfileRegion(ID, a1, a2, superRegion);
100 RegionTy* R = cast_or_null<RegionTy>(Regions.FindNodeOrInsertPos(ID,
104 R = A.Allocate<RegionTy>();
105 new (R) RegionTy(a1, a2, superRegion);
106 Regions.InsertNode(R, InsertPos);
112 template <
typename RegionTy,
typename A1,
typename A2,
typename A3>
113 RegionTy* MemRegionManager::getSubRegion(
const A1 a1,
const A2 a2,
const A3 a3,
115 llvm::FoldingSetNodeID
ID;
116 RegionTy::ProfileRegion(ID, a1, a2, a3, superRegion);
118 RegionTy* R = cast_or_null<RegionTy>(Regions.FindNodeOrInsertPos(ID,
122 R = A.Allocate<RegionTy>();
123 new (R) RegionTy(a1, a2, a3, superRegion);
124 Regions.InsertNode(R, InsertPos);
147 while (r !=
nullptr) {
150 if (
const SubRegion* sr = dyn_cast<SubRegion>(r))
151 r = sr->getSuperRegion();
162 if (
const SubRegion *sr = dyn_cast<SubRegion>(superRegion)) {
183 if (isa<VariableArrayType>(T))
205 if (isa<ConstantArrayType>(T))
226 :
DeclRegion(ivd, sReg, ObjCIvarRegionKind) {}
229 return cast<ObjCIvarDecl>(
D);
245 ID.AddInteger(static_cast<unsigned>(
getKind()));
249 ID.AddInteger(static_cast<unsigned>(
getKind()));
254 ID.AddInteger(static_cast<unsigned>(
getKind()));
261 ID.AddInteger(static_cast<unsigned>(StringRegionKind));
263 ID.AddPointer(superRegion);
269 ID.AddInteger(static_cast<unsigned>(ObjCStringRegionKind));
271 ID.AddPointer(superRegion);
275 const Expr *Ex,
unsigned cnt,
277 ID.AddInteger(static_cast<unsigned>(AllocaRegionKind));
280 ID.AddPointer(superRegion);
288 CompoundLiteralRegion::ProfileRegion(ID, CL, superRegion);
291 void CompoundLiteralRegion::ProfileRegion(llvm::FoldingSetNodeID& ID,
294 ID.AddInteger(static_cast<unsigned>(CompoundLiteralRegionKind));
296 ID.AddPointer(superRegion);
299 void CXXThisRegion::ProfileRegion(llvm::FoldingSetNodeID &ID,
302 ID.AddInteger(static_cast<unsigned>(CXXThisRegionKind));
304 ID.AddPointer(sRegion);
308 CXXThisRegion::ProfileRegion(ID, ThisPointerTy, superRegion);
311 void ObjCIvarRegion::ProfileRegion(llvm::FoldingSetNodeID& ID,
319 ID.AddInteger(static_cast<unsigned>(k));
321 ID.AddPointer(superRegion);
329 VarRegion::ProfileRegion(ID,
getDecl(), superRegion);
334 ID.AddInteger(static_cast<unsigned>(MemRegion::SymbolicRegionKind));
343 void ElementRegion::ProfileRegion(llvm::FoldingSetNodeID& ID,
346 ID.AddInteger(MemRegion::ElementRegionKind);
348 ID.AddPointer(superRegion);
353 ElementRegion::ProfileRegion(ID, ElementType, Index, superRegion);
359 ID.AddInteger(MemRegion::FunctionCodeRegionKind);
371 ID.AddInteger(MemRegion::BlockCodeRegionKind);
384 ID.AddInteger(MemRegion::BlockDataRegionKind);
387 ID.AddInteger(BlkCount);
395 void CXXTempObjectRegion::ProfileRegion(llvm::FoldingSetNodeID &ID,
406 void CXXBaseObjectRegion::ProfileRegion(llvm::FoldingSetNodeID &ID,
411 ID.AddBoolean(IsVirtual);
423 void GlobalsSpaceRegion::anchor() { }
424 void HeapSpaceRegion::anchor() { }
425 void UnknownSpaceRegion::anchor() { }
426 void StackLocalsSpaceRegion::anchor() { }
427 void StackArgumentsSpaceRegion::anchor() { }
431 void SubRegion::anchor() { }
443 llvm::raw_string_ostream os(s);
449 os <<
"<Unknown Region>";
453 os <<
"alloca{" <<
static_cast<const void*
>(
Ex) <<
',' <<
Cnt <<
'}';
461 os <<
"block_code{" <<
static_cast<const void*
>(
this) <<
'}';
465 os <<
"block_data{" << BC;
470 os <<
"(" <<
I.getCapturedRegion() <<
"," <<
471 I.getOriginalRegion() <<
") ";
477 os <<
"{ " <<
static_cast<const void*
>(CL) <<
" }";
482 <<
static_cast<const void*
>(Ex) <<
'}';
486 os <<
"base{" << superRegion <<
',' <<
getDecl()->
getName() <<
'}';
494 os <<
"element{" << superRegion <<
','
499 os << superRegion <<
"->" << *
getDecl();
503 os <<
"ivar{" << superRegion <<
',' << *
getDecl() <<
'}';
507 assert(Str !=
nullptr &&
"Expecting non-null StringLiteral");
512 assert(Str !=
nullptr &&
"Expecting non-null ObjCStringLiteral");
517 os <<
"SymRegion{" <<
sym <<
'}';
521 os << *cast<VarDecl>(
D);
533 os <<
"CodeSpaceRegion";
537 os <<
"StaticGlobalsMemSpace{" << CR <<
'}';
541 os <<
"GlobalInternalSpaceRegion";
545 os <<
"GlobalSystemSpaceRegion";
549 os <<
"GlobalImmutableSpaceRegion";
553 os <<
"HeapSpaceRegion";
557 os <<
"UnknownSpaceRegion";
561 os <<
"StackArgumentsSpaceRegion";
565 os <<
"StackLocalsSpaceRegion";
577 assert(
canPrintPretty() &&
"This region cannot be printed pretty.");
584 llvm_unreachable(
"This region cannot be printed pretty.");
636 std::string VariableName;
637 std::string ArrayIndices;
640 llvm::raw_svector_ostream os(buf);
648 CI->getValue().toString(Idx);
649 ArrayIndices = (llvm::Twine(
"[") + Idx.str() +
"]" + ArrayIndices).str();
656 ArrayIndices = (llvm::Twine(
"[") + Idx +
"]" + ArrayIndices).str();
666 return (llvm::Twine(
"'") + os.str() + ArrayIndices +
"'").str();
668 return (llvm::Twine(os.str()) + ArrayIndices).str();
698 template <
typename REG>
699 const REG *MemRegionManager::LazyAllocate(REG*& region) {
701 region = A.Allocate<REG>();
702 new (region) REG(
this);
708 template <
typename REG,
typename ARG>
709 const REG *MemRegionManager::LazyAllocate(REG*& region, ARG a) {
711 region = A.Allocate<REG>();
712 new (region) REG(
this, a);
748 if (K == MemRegion::GlobalSystemSpaceRegionKind)
749 return LazyAllocate(SystemGlobals);
750 if (K == MemRegion::GlobalImmutableSpaceRegionKind)
751 return LazyAllocate(ImmutableGlobals);
752 assert(K == MemRegion::GlobalInternalSpaceRegionKind);
753 return LazyAllocate(InternalGlobals);
756 assert(K == MemRegion::StaticGlobalSpaceRegionKind);
767 return LazyAllocate(heap);
771 return LazyAllocate(unknown);
775 return LazyAllocate(code);
793 static llvm::PointerUnion<const StackFrameContext *, const VarRegion *>
799 if (cast<DeclContext>(SFC->getDecl()) == DC)
803 dyn_cast<BlockInvocationContext>(LC)) {
810 if (
const VarRegion *VR = dyn_cast<VarRegion>(
I.getOriginalRegion()))
811 if (VR->getDecl() == VD)
812 return cast<VarRegion>(
I.getCapturedRegion());
828 if (
C.getSourceManager().isInSystemHeader(D->getLocation())) {
831 if (D->
getName().find(
"errno") != StringRef::npos)
853 llvm::PointerUnion<const StackFrameContext *, const VarRegion *> V =
865 sReg = isa<ParmVarDecl>(D) || isa<ImplicitParamDecl>(D)
871 const Decl *STCD = STC->getDecl();
872 if (isa<FunctionDecl>(STCD) || isa<ObjCMethodDecl>(STCD))
875 else if (
const BlockDecl *BD = dyn_cast<BlockDecl>(STCD)) {
891 STC->getAnalysisDeclContext());
902 return getSubRegion<VarRegion>(D, sReg);
907 return getSubRegion<VarRegion>(D, superR);
913 unsigned blockCount) {
935 return getSubRegion<BlockDataRegion>(BC, LC, blockCount, sReg);
940 return getSubRegion<CXXTempObjectRegion>(
957 return getSubRegion<CompoundLiteralRegion>(CL, sReg);
966 llvm::FoldingSetNodeID
ID;
967 ElementRegion::ProfileRegion(ID, T, Idx, superRegion);
970 MemRegion* data = Regions.FindNodeOrInsertPos(ID, InsertPos);
976 Regions.InsertNode(R, InsertPos);
984 return getSubRegion<FunctionCodeRegion>(FD,
getCodeRegion());
990 return getSubRegion<BlockCodeRegion>(BD, locTy, AC,
getCodeRegion());
1006 return getSubRegion<FieldRegion>(d, superRegion);
1012 return getSubRegion<ObjCIvarRegion>(d, superRegion);
1037 for (
const auto &
I : Class->
bases()) {
1038 if (
I.getType()->getAsCXXRecordDecl()->getCanonicalDecl() == BaseClass)
1049 if (isa<TypedValueRegion>(Super)) {
1050 assert(
isValidBaseClass(RD, dyn_cast<TypedValueRegion>(Super), IsVirtual));
1057 dyn_cast<CXXBaseObjectRegion>(Super)) {
1058 Super =
Base->getSuperRegion();
1060 assert(Super && !isa<MemSpaceRegion>(Super));
1064 return getSubRegion<CXXBaseObjectRegion>(RD, IsVirtual, Super);
1079 (!D || D->isStatic() ||
1123 return isa<StackArgumentsSpaceRegion>(MS) ||
1124 isa<GlobalsSpaceRegion>(MS);
1133 case MemRegion::ElementRegionKind:
1134 case MemRegion::FieldRegionKind:
1135 case MemRegion::ObjCIvarRegionKind:
1136 case MemRegion::CXXBaseObjectRegionKind:
1137 R = cast<SubRegion>(R)->getSuperRegion();
1159 case ElementRegionKind: {
1166 case CXXBaseObjectRegionKind:
1167 if (!StripBaseCasts)
1169 R = cast<CXXBaseObjectRegion>(R)->getSuperRegion();
1203 int64_t i = CI->getValue().getSExtValue();
1215 offset += (i * size);
1226 assert(superR &&
"super region cannot be NULL");
1234 assert(Child &&
"Child must not be null");
1238 for (
const auto &
I : Child->
bases()) {
1239 if (
I.getType()->getAsCXXRecordDecl() == Base)
1248 const MemRegion *SymbolicOffsetBase =
nullptr;
1253 case CodeSpaceRegionKind:
1254 case StackLocalsSpaceRegionKind:
1255 case StackArgumentsSpaceRegionKind:
1256 case HeapSpaceRegionKind:
1257 case UnknownSpaceRegionKind:
1258 case StaticGlobalSpaceRegionKind:
1259 case GlobalInternalSpaceRegionKind:
1260 case GlobalSystemSpaceRegionKind:
1261 case GlobalImmutableSpaceRegionKind:
1263 assert(Offset == 0 && !SymbolicOffsetBase);
1266 case FunctionCodeRegionKind:
1267 case BlockCodeRegionKind:
1268 case BlockDataRegionKind:
1272 SymbolicOffsetBase = R;
1275 case SymbolicRegionKind:
1276 case AllocaRegionKind:
1277 case CompoundLiteralRegionKind:
1278 case CXXThisRegionKind:
1279 case StringRegionKind:
1280 case ObjCStringRegionKind:
1282 case CXXTempObjectRegionKind:
1286 case ObjCIvarRegionKind:
1294 case CXXBaseObjectRegionKind: {
1299 bool RootIsSymbolic =
false;
1301 Ty = TVR->getDesugaredValueType(
getContext());
1302 }
else if (
const SymbolicRegion *SR = dyn_cast<SymbolicRegion>(R)) {
1307 RootIsSymbolic =
true;
1313 SymbolicOffsetBase = R;
1315 if (RootIsSymbolic) {
1321 SymbolicOffsetBase = R;
1324 SymbolicOffsetBase = R;
1331 if (SymbolicOffsetBase)
1345 case ElementRegionKind: {
1352 SymbolicOffsetBase = R;
1361 if (SymbolicOffsetBase)
1364 int64_t i = CI->getValue().getSExtValue();
1369 SymbolicOffsetBase = R;
1373 case FieldRegionKind: {
1384 SymbolicOffsetBase = R;
1389 if (SymbolicOffsetBase)
1395 FE = RD->
field_end(); FI != FE; ++FI, ++idx) {
1408 if (SymbolicOffsetBase)
1417 std::pair<const VarRegion *, const VarRegion *>
1418 BlockDataRegion::getCaptureRegions(
const VarDecl *VD) {
1437 return std::make_pair(VR, OriginalVR);
1440 void BlockDataRegion::LazyInitializeReferencedVars() {
1447 std::distance(ReferencedBlockVars.begin(), ReferencedBlockVars.end());
1449 if (NumBlockVars == 0) {
1450 ReferencedVars = (
void*) 0x1;
1459 VarVec *BV = A.Allocate<VarVec>();
1460 new (BV) VarVec(BC, NumBlockVars);
1461 VarVec *BVOriginal = A.Allocate<VarVec>();
1462 new (BVOriginal) VarVec(BC, NumBlockVars);
1464 for (
const VarDecl *VD : ReferencedBlockVars) {
1467 std::tie(VR, OriginalVR) = getCaptureRegions(VD);
1470 BV->push_back(VR, BC);
1471 BVOriginal->push_back(OriginalVR, BC);
1474 ReferencedVars = BV;
1475 OriginalVars = BVOriginal;
1485 if (Vec == (
void*) 0x1)
1492 VecOriginal->
begin());
1502 if (Vec == (
void*) 0x1)
1509 VecOriginal->
end());
1516 if (
I.getCapturedRegion() == R)
1517 return I.getOriginalRegion();
1528 SymTraitsMap[Sym] |= IK;
1537 MRTraitsMap[MR] |= IK;
1542 const_symbol_iterator
I = SymTraitsMap.find(Sym);
1543 if (I != SymTraitsMap.end())
1544 return I->second & IK;
1555 return hasTrait(SR->getSymbol(), IK);
1557 const_region_iterator
I = MRTraitsMap.find(MR);
1558 if (I != MRTraitsMap.end())
1559 return I->second & IK;
bool hasStackStorage() const
void Profile(llvm::FoldingSetNodeID &ID) const
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
void dumpToStream(raw_ostream &os) const override
const StringRegion * getStringRegion(const StringLiteral *Str)
const RegionTy * getAs() const
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.
std::string getDescriptiveName(bool UseQuotes=true) const
Get descriptive name for memory region.
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.
float __ovld __cnfn distance(float p0, float p1)
Returns the distance between p0 and p1.
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
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.
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
CharUnits getBaseClassOffset(const CXXRecordDecl *Base) const
getBaseClassOffset - Get the offset, in chars, for the given base class.
llvm::BumpPtrAllocator & getAllocator()
bool hasTrait(SymbolRef Sym, InvalidationKinds IK) const
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...
SourceRange getSourceRange() const override LLVM_READONLY
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
SourceRange getSourceRange() const override LLVM_READONLY
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...
clang::SourceRange sourceRange() const
Retrieve source range from memory region.
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
A trivial tuple used to represent a source range.
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