25 #include "llvm/Support/raw_ostream.h"
27 using namespace clang;
34 template <
typename RegionTy,
typename SuperTy,
typename Arg1Ty>
35 RegionTy* MemRegionManager::getSubRegion(
const Arg1Ty arg1,
36 const SuperTy *superRegion) {
37 llvm::FoldingSetNodeID
ID;
38 RegionTy::ProfileRegion(ID, arg1, superRegion);
40 RegionTy* R = cast_or_null<RegionTy>(Regions.FindNodeOrInsertPos(ID,
44 R = A.Allocate<RegionTy>();
45 new (R) RegionTy(arg1, superRegion);
46 Regions.InsertNode(R, InsertPos);
52 template <
typename RegionTy,
typename SuperTy,
typename Arg1Ty,
typename Arg2Ty>
53 RegionTy* MemRegionManager::getSubRegion(
const Arg1Ty arg1,
const Arg2Ty arg2,
54 const SuperTy *superRegion) {
55 llvm::FoldingSetNodeID
ID;
56 RegionTy::ProfileRegion(ID, arg1, arg2, superRegion);
58 RegionTy* R = cast_or_null<RegionTy>(Regions.FindNodeOrInsertPos(ID,
62 R = A.Allocate<RegionTy>();
63 new (R) RegionTy(arg1, arg2, superRegion);
64 Regions.InsertNode(R, InsertPos);
70 template <
typename RegionTy,
typename SuperTy,
71 typename Arg1Ty,
typename Arg2Ty,
typename Arg3Ty>
72 RegionTy* MemRegionManager::getSubRegion(
const Arg1Ty arg1,
const Arg2Ty arg2,
74 const SuperTy *superRegion) {
75 llvm::FoldingSetNodeID
ID;
76 RegionTy::ProfileRegion(ID, arg1, arg2, arg3, superRegion);
78 RegionTy* R = cast_or_null<RegionTy>(Regions.FindNodeOrInsertPos(ID,
82 R = A.Allocate<RegionTy>();
83 new (R) RegionTy(arg1, arg2, arg3, superRegion);
84 Regions.InsertNode(R, InsertPos);
107 while (r !=
nullptr) {
110 if (
const SubRegion* sr = dyn_cast<SubRegion>(r))
111 r = sr->getSuperRegion();
122 if (
const SubRegion *sr = dyn_cast<SubRegion>(superRegion)) {
143 if (isa<VariableArrayType>(T))
165 if (isa<ConstantArrayType>(T))
186 :
DeclRegion(ivd, sReg, ObjCIvarRegionKind) {}
189 return cast<ObjCIvarDecl>(
D);
205 ID.AddInteger(static_cast<unsigned>(
getKind()));
209 ID.AddInteger(static_cast<unsigned>(
getKind()));
214 ID.AddInteger(static_cast<unsigned>(
getKind()));
218 void StringRegion::ProfileRegion(llvm::FoldingSetNodeID& ID,
221 ID.AddInteger(static_cast<unsigned>(StringRegionKind));
223 ID.AddPointer(superRegion);
226 void ObjCStringRegion::ProfileRegion(llvm::FoldingSetNodeID& ID,
229 ID.AddInteger(static_cast<unsigned>(ObjCStringRegionKind));
231 ID.AddPointer(superRegion);
234 void AllocaRegion::ProfileRegion(llvm::FoldingSetNodeID& ID,
235 const Expr *Ex,
unsigned cnt,
237 ID.AddInteger(static_cast<unsigned>(AllocaRegionKind));
240 ID.AddPointer(superRegion);
244 ProfileRegion(ID, Ex, Cnt, superRegion);
248 CompoundLiteralRegion::ProfileRegion(ID, CL, superRegion);
251 void CompoundLiteralRegion::ProfileRegion(llvm::FoldingSetNodeID& ID,
254 ID.AddInteger(static_cast<unsigned>(CompoundLiteralRegionKind));
256 ID.AddPointer(superRegion);
259 void CXXThisRegion::ProfileRegion(llvm::FoldingSetNodeID &ID,
262 ID.AddInteger(static_cast<unsigned>(CXXThisRegionKind));
264 ID.AddPointer(sRegion);
268 CXXThisRegion::ProfileRegion(ID, ThisPointerTy, superRegion);
271 void ObjCIvarRegion::ProfileRegion(llvm::FoldingSetNodeID& ID,
279 ID.AddInteger(static_cast<unsigned>(k));
281 ID.AddPointer(superRegion);
289 VarRegion::ProfileRegion(ID,
getDecl(), superRegion);
294 ID.AddInteger(static_cast<unsigned>(MemRegion::SymbolicRegionKind));
303 void ElementRegion::ProfileRegion(llvm::FoldingSetNodeID& ID,
306 ID.AddInteger(MemRegion::ElementRegionKind);
308 ID.AddPointer(superRegion);
313 ElementRegion::ProfileRegion(ID, ElementType, Index, superRegion);
316 void FunctionCodeRegion::ProfileRegion(llvm::FoldingSetNodeID& ID,
319 ID.AddInteger(MemRegion::FunctionCodeRegionKind);
324 FunctionCodeRegion::ProfileRegion(ID, FD, superRegion);
327 void BlockCodeRegion::ProfileRegion(llvm::FoldingSetNodeID& ID,
331 ID.AddInteger(MemRegion::BlockCodeRegionKind);
336 BlockCodeRegion::ProfileRegion(ID, BD, locTy, AC, superRegion);
339 void BlockDataRegion::ProfileRegion(llvm::FoldingSetNodeID& ID,
344 ID.AddInteger(MemRegion::BlockDataRegionKind);
347 ID.AddInteger(BlkCount);
352 BlockDataRegion::ProfileRegion(ID, BC, LC, BlockCount,
getSuperRegion());
355 void CXXTempObjectRegion::ProfileRegion(llvm::FoldingSetNodeID &ID,
366 void CXXBaseObjectRegion::ProfileRegion(llvm::FoldingSetNodeID &ID,
371 ID.AddBoolean(IsVirtual);
383 void GlobalsSpaceRegion::anchor() { }
384 void NonStaticGlobalSpaceRegion::anchor() { }
385 void StackSpaceRegion::anchor() { }
386 void TypedRegion::anchor() { }
387 void TypedValueRegion::anchor() { }
388 void CodeTextRegion::anchor() { }
389 void SubRegion::anchor() { }
401 llvm::raw_string_ostream os(s);
407 os <<
"<Unknown Region>";
411 os <<
"alloca{" <<
static_cast<const void*
>(Ex) <<
',' << Cnt <<
'}';
419 os <<
"block_code{" <<
static_cast<const void*
>(
this) <<
'}';
423 os <<
"block_data{" << BC;
428 os <<
"(" <<
I.getCapturedRegion() <<
"," <<
429 I.getOriginalRegion() <<
") ";
435 os <<
"{ " <<
static_cast<const void*
>(CL) <<
" }";
440 <<
static_cast<const void*
>(Ex) <<
'}';
444 os <<
"base{" << superRegion <<
',' <<
getDecl()->
getName() <<
'}';
452 os <<
"element{" << superRegion <<
','
457 os << superRegion <<
"->" << *
getDecl();
461 os <<
"ivar{" << superRegion <<
',' << *
getDecl() <<
'}';
465 assert(Str !=
nullptr &&
"Expecting non-null StringLiteral");
470 assert(Str !=
nullptr &&
"Expecting non-null ObjCStringLiteral");
475 os <<
"SymRegion{" << sym <<
'}';
479 os << *cast<VarDecl>(
D);
491 os <<
"CodeSpaceRegion";
495 os <<
"StaticGlobalsMemSpace{" << CR <<
'}';
499 os <<
"GlobalInternalSpaceRegion";
503 os <<
"GlobalSystemSpaceRegion";
507 os <<
"GlobalImmutableSpaceRegion";
511 os <<
"HeapSpaceRegion";
515 os <<
"UnknownSpaceRegion";
519 os <<
"StackArgumentsSpaceRegion";
523 os <<
"StackLocalsSpaceRegion";
535 assert(
canPrintPretty() &&
"This region cannot be printed pretty.");
542 llvm_unreachable(
"This region cannot be printed pretty.");
594 std::string VariableName;
595 std::string ArrayIndices;
598 llvm::raw_svector_ostream os(buf);
606 CI->getValue().toString(Idx);
607 ArrayIndices = (llvm::Twine(
"[") + Idx.str() +
"]" + ArrayIndices).str();
614 ArrayIndices = (llvm::Twine(
"[") + Idx +
"]" + ArrayIndices).str();
624 return (llvm::Twine(
"'") + os.str() + ArrayIndices +
"'").str();
626 return (llvm::Twine(os.str()) + ArrayIndices).str();
656 template <
typename REG>
657 const REG *MemRegionManager::LazyAllocate(REG*& region) {
659 region = A.Allocate<REG>();
660 new (region) REG(
this);
666 template <
typename REG,
typename ARG>
667 const REG *MemRegionManager::LazyAllocate(REG*& region, ARG a) {
669 region = A.Allocate<REG>();
670 new (region) REG(
this, a);
706 if (K == MemRegion::GlobalSystemSpaceRegionKind)
707 return LazyAllocate(SystemGlobals);
708 if (K == MemRegion::GlobalImmutableSpaceRegionKind)
709 return LazyAllocate(ImmutableGlobals);
710 assert(K == MemRegion::GlobalInternalSpaceRegionKind);
711 return LazyAllocate(InternalGlobals);
714 assert(K == MemRegion::StaticGlobalSpaceRegionKind);
725 return LazyAllocate(heap);
729 return LazyAllocate(unknown);
733 return LazyAllocate(code);
740 return getSubRegion<StringRegion>(
746 return getSubRegion<ObjCStringRegion>(
753 static llvm::PointerUnion<const StackFrameContext *, const VarRegion *>
759 if (cast<DeclContext>(SFC->getDecl()) == DC)
763 dyn_cast<BlockInvocationContext>(LC)) {
770 if (
const VarRegion *VR = dyn_cast<VarRegion>(
I.getOriginalRegion()))
771 if (VR->getDecl() == VD)
772 return cast<VarRegion>(
I.getCapturedRegion());
791 if (D->
getName().find(
"errno") != StringRef::npos)
813 llvm::PointerUnion<const StackFrameContext *, const VarRegion *> V =
827 sReg = isa<ParmVarDecl>(D) || isa<ImplicitParamDecl>(D)
833 const Decl *STCD = STC->getDecl();
834 if (isa<FunctionDecl>(STCD) || isa<ObjCMethodDecl>(STCD))
837 else if (
const BlockDecl *BD = dyn_cast<BlockDecl>(STCD)) {
853 STC->getAnalysisDeclContext());
864 return getSubRegion<VarRegion>(D, sReg);
869 return getSubRegion<VarRegion>(D, superR);
875 unsigned blockCount) {
897 return getSubRegion<BlockDataRegion>(BC, LC, blockCount, sReg);
902 return getSubRegion<CXXTempObjectRegion>(
919 return getSubRegion<CompoundLiteralRegion>(CL, sReg);
928 llvm::FoldingSetNodeID
ID;
929 ElementRegion::ProfileRegion(ID, T, Idx, superRegion);
932 MemRegion* data = Regions.FindNodeOrInsertPos(ID, InsertPos);
938 Regions.InsertNode(R, InsertPos);
946 return getSubRegion<FunctionCodeRegion>(FD,
getCodeRegion());
952 return getSubRegion<BlockCodeRegion>(BD, locTy, AC,
getCodeRegion());
968 return getSubRegion<FieldRegion>(d, superRegion);
974 return getSubRegion<ObjCIvarRegion>(d, superRegion);
999 for (
const auto &
I : Class->
bases()) {
1000 if (
I.getType()->getAsCXXRecordDecl()->getCanonicalDecl() == BaseClass)
1011 if (isa<TypedValueRegion>(Super)) {
1012 assert(
isValidBaseClass(RD, dyn_cast<TypedValueRegion>(Super), IsVirtual));
1019 dyn_cast<CXXBaseObjectRegion>(Super)) {
1020 Super = cast<SubRegion>(
Base->getSuperRegion());
1022 assert(Super && !isa<MemSpaceRegion>(Super));
1026 return getSubRegion<CXXBaseObjectRegion>(RD, IsVirtual, Super);
1041 (!D || D->isStatic() ||
1085 return isa<StackArgumentsSpaceRegion>(MS) ||
1086 isa<GlobalsSpaceRegion>(MS);
1095 case MemRegion::ElementRegionKind:
1096 case MemRegion::FieldRegionKind:
1097 case MemRegion::ObjCIvarRegionKind:
1098 case MemRegion::CXXBaseObjectRegionKind:
1099 R = cast<SubRegion>(R)->getSuperRegion();
1121 case ElementRegionKind: {
1128 case CXXBaseObjectRegionKind:
1129 if (!StripBaseCasts)
1131 R = cast<CXXBaseObjectRegion>(R)->getSuperRegion();
1165 int64_t i = CI->getValue().getSExtValue();
1177 offset += (i * size);
1188 assert(superR &&
"super region cannot be NULL");
1196 assert(Child &&
"Child must not be null");
1200 for (
const auto &
I : Child->
bases()) {
1201 if (
I.getType()->getAsCXXRecordDecl() == Base)
1210 const MemRegion *SymbolicOffsetBase =
nullptr;
1215 case CodeSpaceRegionKind:
1216 case StackLocalsSpaceRegionKind:
1217 case StackArgumentsSpaceRegionKind:
1218 case HeapSpaceRegionKind:
1219 case UnknownSpaceRegionKind:
1220 case StaticGlobalSpaceRegionKind:
1221 case GlobalInternalSpaceRegionKind:
1222 case GlobalSystemSpaceRegionKind:
1223 case GlobalImmutableSpaceRegionKind:
1225 assert(Offset == 0 && !SymbolicOffsetBase);
1228 case FunctionCodeRegionKind:
1229 case BlockCodeRegionKind:
1230 case BlockDataRegionKind:
1234 SymbolicOffsetBase = R;
1237 case SymbolicRegionKind:
1238 case AllocaRegionKind:
1239 case CompoundLiteralRegionKind:
1240 case CXXThisRegionKind:
1241 case StringRegionKind:
1242 case ObjCStringRegionKind:
1244 case CXXTempObjectRegionKind:
1248 case ObjCIvarRegionKind:
1256 case CXXBaseObjectRegionKind: {
1261 bool RootIsSymbolic =
false;
1263 Ty = TVR->getDesugaredValueType(
getContext());
1264 }
else if (
const SymbolicRegion *SR = dyn_cast<SymbolicRegion>(R)) {
1269 RootIsSymbolic =
true;
1275 SymbolicOffsetBase = R;
1277 if (RootIsSymbolic) {
1283 SymbolicOffsetBase = R;
1286 SymbolicOffsetBase = R;
1293 if (SymbolicOffsetBase)
1307 case ElementRegionKind: {
1314 SymbolicOffsetBase = R;
1323 if (SymbolicOffsetBase)
1326 int64_t i = CI->getValue().getSExtValue();
1331 SymbolicOffsetBase = R;
1335 case FieldRegionKind: {
1346 SymbolicOffsetBase = R;
1351 if (SymbolicOffsetBase)
1357 FE = RD->
field_end(); FI != FE; ++FI, ++idx) {
1370 if (SymbolicOffsetBase)
1379 std::pair<const VarRegion *, const VarRegion *>
1380 BlockDataRegion::getCaptureRegions(
const VarDecl *VD) {
1399 return std::make_pair(VR, OriginalVR);
1402 void BlockDataRegion::LazyInitializeReferencedVars() {
1409 std::distance(ReferencedBlockVars.begin(), ReferencedBlockVars.end());
1411 if (NumBlockVars == 0) {
1412 ReferencedVars = (
void*) 0x1;
1421 VarVec *BV = A.Allocate<VarVec>();
1422 new (BV) VarVec(BC, NumBlockVars);
1423 VarVec *BVOriginal = A.Allocate<VarVec>();
1424 new (BVOriginal) VarVec(BC, NumBlockVars);
1426 for (
const VarDecl *VD : ReferencedBlockVars) {
1429 std::tie(VR, OriginalVR) = getCaptureRegions(VD);
1432 BV->push_back(VR, BC);
1433 BVOriginal->push_back(OriginalVR, BC);
1436 ReferencedVars = BV;
1437 OriginalVars = BVOriginal;
1447 if (Vec == (
void*) 0x1)
1454 VecOriginal->
begin());
1464 if (Vec == (
void*) 0x1)
1471 VecOriginal->
end());
1478 if (
I.getCapturedRegion() == R)
1479 return I.getOriginalRegion();
1490 SymTraitsMap[Sym] |= IK;
1499 MRTraitsMap[MR] |= IK;
1504 const_symbol_iterator
I = SymTraitsMap.find(Sym);
1505 if (I != SymTraitsMap.end())
1506 return I->second & IK;
1517 return hasTrait(SR->getSymbol(), IK);
1519 const_region_iterator
I = MRTraitsMap.find(MR);
1520 if (I != MRTraitsMap.end())
1521 return I->second & IK;
bool hasStackStorage() const
void printPretty(raw_ostream &OS, PrinterHelper *Helper, const PrintingPolicy &Policy, unsigned Indentation=0) 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
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 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.
AnalysisDeclContext * getAnalysisDeclContext() const
Value representing integer constant.
const ObjCIvarRegion * getObjCIvarRegion(const ObjCIvarDecl *ivd, const SubRegion *superRegion)
getObjCIvarRegion - Retrieve or create the memory region associated with a specified Objective-c inst...
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...
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
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 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.
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()
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
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
Source range that this declaration covers.
The region of the static variables within the current CodeTextRegion scope.
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
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
Source range that this declaration covers.
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'...
const CXXBaseObjectRegion * getCXXBaseObjectRegion(const CXXRecordDecl *BaseClass, const SubRegion *Super, bool IsVirtual)
Create a CXXBaseObjectRegion with the given base class for region Super.
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.
const LocationContext * getParent() const
QualType getValueType() const override
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.
const ElementRegion * getElementRegion(QualType elementType, NonLoc Idx, const SubRegion *superRegion, ASTContext &Ctx)
getElementRegion - Retrieve the memory region associated with the associated element type...
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.
void Profile(llvm::FoldingSetNodeID &ID) const override
SourceManager & getSourceManager()
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
TypeSourceInfo * getSignatureAsWritten() const
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.
void Profile(llvm::FoldingSetNodeID &ID) const override
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.
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
const FieldRegion * getFieldRegion(const FieldDecl *fd, const SubRegion *superRegion)
getFieldRegion - Retrieve or create the memory region associated with a specified FieldDecl...
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 field is ...
void dumpToStream(raw_ostream &os) const override