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))
155 if (getDecl()->isBitField())
165 if (isa<ConstantArrayType>(T))
181 return svalBuilder.
makeIntVal(getStringLiteral()->getByteLength()+1,
186 :
DeclRegion(ivd, sReg, ObjCIvarRegionKind) {}
189 return cast<ObjCIvarDecl>(D);
193 return getDecl()->getType();
197 return QualType(getDecl()->getTypeForDecl(), 0);
205 ID.AddInteger(static_cast<unsigned>(
getKind()));
209 ID.AddInteger(static_cast<unsigned>(
getKind()));
210 ID.AddPointer(getStackFrame());
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,
363 ProfileRegion(ID, Ex, getSuperRegion());
366 void CXXBaseObjectRegion::ProfileRegion(llvm::FoldingSetNodeID &ID,
371 ID.AddBoolean(IsVirtual);
376 ProfileRegion(ID, getDecl(), isVirtual(), superRegion);
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() { }
396 dumpToStream(llvm::errs());
401 llvm::raw_string_ostream os(s);
407 os <<
"<Unknown Region>";
411 os <<
"alloca{" <<
static_cast<const void*
>(Ex) <<
',' << Cnt <<
'}';
415 os <<
"code{" << getDecl()->getDeclName().getAsString() <<
'}';
419 os <<
"block_code{" <<
static_cast<const void*
>(
this) <<
'}';
423 os <<
"block_data{" << BC;
426 I = referenced_vars_begin(),
427 E = referenced_vars_end(); I != E; ++I)
428 os <<
"(" << I.getCapturedRegion() <<
"," <<
429 I.getOriginalRegion() <<
") ";
435 os <<
"{ " <<
static_cast<const void*
>(CL) <<
" }";
439 os <<
"temp_object{" << getValueType().getAsString() <<
',' 440 <<
static_cast<const void*
>(Ex) <<
'}';
444 os <<
"base{" << superRegion <<
',' << getDecl()->getName() <<
'}';
452 os <<
"element{" << superRegion <<
',' 453 << Index <<
',' << getElementType().getAsString() <<
'}';
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 if (isa<HeapSpaceRegion>(getSuperRegion()))
477 os <<
"SymRegion{" << sym <<
'}';
481 os << *cast<VarDecl>(D);
485 dumpToStream(llvm::errs());
489 os <<
"raw_offset{" << getRegion() <<
',' << getOffset().getQuantity() <<
'}';
493 os <<
"CodeSpaceRegion";
497 os <<
"StaticGlobalsMemSpace{" << CR <<
'}';
501 os <<
"GlobalInternalSpaceRegion";
505 os <<
"GlobalSystemSpaceRegion";
509 os <<
"GlobalImmutableSpaceRegion";
513 os <<
"HeapSpaceRegion";
517 os <<
"UnknownSpaceRegion";
521 os <<
"StackArgumentsSpaceRegion";
525 os <<
"StackLocalsSpaceRegion";
529 return canPrintPrettyAsExpr();
537 assert(canPrintPretty() &&
"This region cannot be printed pretty.");
539 printPrettyAsExpr(os);
544 llvm_unreachable(
"This region cannot be printed pretty.");
552 os << getDecl()->getName();
560 os << getDecl()->getName();
572 assert(canPrintPrettyAsExpr());
574 os <<
"." << getDecl()->getName();
578 if (canPrintPrettyAsExpr()) {
580 printPrettyAsExpr(os);
583 os <<
"field " <<
"\'" << getDecl()->getName() <<
"'";
596 std::string VariableName;
597 std::string ArrayIndices;
600 llvm::raw_svector_ostream os(buf);
608 CI->getValue().toString(Idx);
609 ArrayIndices = (llvm::Twine(
"[") + Idx.str() +
"]" + ArrayIndices).str();
616 ArrayIndices = (llvm::Twine(
"[") + Idx +
"]" + ArrayIndices).str();
626 return (llvm::Twine(
"'") + os.str() + ArrayIndices +
"'").str();
628 return (llvm::Twine(os.str()) + ArrayIndices).str();
658 template <
typename REG>
659 const REG *MemRegionManager::LazyAllocate(REG*& region) {
661 region = A.Allocate<REG>();
662 new (region) REG(
this);
668 template <
typename REG,
typename ARG>
669 const REG *MemRegionManager::LazyAllocate(REG*& region, ARG a) {
671 region = A.Allocate<REG>();
672 new (region) REG(
this, a);
708 if (K == MemRegion::GlobalSystemSpaceRegionKind)
709 return LazyAllocate(SystemGlobals);
710 if (K == MemRegion::GlobalImmutableSpaceRegionKind)
711 return LazyAllocate(ImmutableGlobals);
712 assert(K == MemRegion::GlobalInternalSpaceRegionKind);
713 return LazyAllocate(InternalGlobals);
716 assert(K == MemRegion::StaticGlobalSpaceRegionKind);
727 return LazyAllocate(heap);
731 return LazyAllocate(unknown);
735 return LazyAllocate(code);
742 return getSubRegion<StringRegion>(
748 return getSubRegion<ObjCStringRegion>(
755 static llvm::PointerUnion<const StackFrameContext *, const VarRegion *>
761 if (cast<DeclContext>(SFC->getDecl()) == DC)
765 dyn_cast<BlockInvocationContext>(LC)) {
772 if (
const VarRegion *VR = dyn_cast<VarRegion>(I.getOriginalRegion()))
773 if (VR->getDecl() == VD)
774 return cast<VarRegion>(I.getCapturedRegion());
793 if (D->
getName().find(
"errno") != StringRef::npos)
815 llvm::PointerUnion<const StackFrameContext *, const VarRegion *> V =
829 sReg = isa<ParmVarDecl>(D) || isa<ImplicitParamDecl>(D)
835 const Decl *STCD = STC->getDecl();
836 if (isa<FunctionDecl>(STCD) || isa<ObjCMethodDecl>(STCD))
839 else if (
const BlockDecl *BD = dyn_cast<BlockDecl>(STCD)) {
855 STC->getAnalysisDeclContext());
866 return getSubRegion<VarRegion>(D, sReg);
871 return getSubRegion<VarRegion>(D, superR);
877 unsigned blockCount) {
899 return getSubRegion<BlockDataRegion>(BC, LC, blockCount, sReg);
904 return getSubRegion<CXXTempObjectRegion>(
921 return getSubRegion<CompoundLiteralRegion>(CL, sReg);
930 llvm::FoldingSetNodeID
ID;
931 ElementRegion::ProfileRegion(ID, T, Idx, superRegion);
934 MemRegion* data = Regions.FindNodeOrInsertPos(ID, InsertPos);
940 Regions.InsertNode(R, InsertPos);
948 return getSubRegion<FunctionCodeRegion>(FD,
getCodeRegion());
954 return getSubRegion<BlockCodeRegion>(BD, locTy, AC,
getCodeRegion());
970 return getSubRegion<FieldRegion>(d, superRegion);
976 return getSubRegion<ObjCIvarRegion>(d, superRegion);
1001 for (
const auto &I : Class->
bases()) {
1002 if (I.getType()->getAsCXXRecordDecl()->getCanonicalDecl() == BaseClass)
1013 if (isa<TypedValueRegion>(Super)) {
1014 assert(
isValidBaseClass(RD, dyn_cast<TypedValueRegion>(Super), IsVirtual));
1021 dyn_cast<CXXBaseObjectRegion>(Super)) {
1022 Super = cast<SubRegion>(
Base->getSuperRegion());
1024 assert(Super && !isa<MemSpaceRegion>(Super));
1028 return getSubRegion<CXXBaseObjectRegion>(RD, IsVirtual, Super);
1043 (!D || D->isStatic() ||
1074 return isa<StackSpaceRegion>(getMemorySpace());
1078 return isa<StackLocalsSpaceRegion>(getMemorySpace());
1082 return isa<StackArgumentsSpaceRegion>(getMemorySpace());
1087 return isa<StackArgumentsSpaceRegion>(MS) ||
1088 isa<GlobalsSpaceRegion>(MS);
1097 case MemRegion::ElementRegionKind:
1098 case MemRegion::FieldRegionKind:
1099 case MemRegion::ObjCIvarRegionKind:
1100 case MemRegion::CXXBaseObjectRegionKind:
1101 R = cast<SubRegion>(R)->getSuperRegion();
1123 case ElementRegionKind: {
1130 case CXXBaseObjectRegionKind:
1131 if (!StripBaseCasts)
1133 R = cast<CXXBaseObjectRegion>(R)->getSuperRegion();
1167 int64_t i = CI->getValue().getSExtValue();
1179 offset += (i * size);
1190 assert(superR &&
"super region cannot be NULL");
1198 assert(Child &&
"Child must not be null");
1202 for (
const auto &I : Child->
bases()) {
1203 if (I.getType()->getAsCXXRecordDecl() == Base)
1212 const MemRegion *SymbolicOffsetBase =
nullptr;
1217 case CodeSpaceRegionKind:
1218 case StackLocalsSpaceRegionKind:
1219 case StackArgumentsSpaceRegionKind:
1220 case HeapSpaceRegionKind:
1221 case UnknownSpaceRegionKind:
1222 case StaticGlobalSpaceRegionKind:
1223 case GlobalInternalSpaceRegionKind:
1224 case GlobalSystemSpaceRegionKind:
1225 case GlobalImmutableSpaceRegionKind:
1227 assert(Offset == 0 && !SymbolicOffsetBase);
1230 case FunctionCodeRegionKind:
1231 case BlockCodeRegionKind:
1232 case BlockDataRegionKind:
1236 SymbolicOffsetBase = R;
1239 case SymbolicRegionKind:
1240 case AllocaRegionKind:
1241 case CompoundLiteralRegionKind:
1242 case CXXThisRegionKind:
1243 case StringRegionKind:
1244 case ObjCStringRegionKind:
1246 case CXXTempObjectRegionKind:
1250 case ObjCIvarRegionKind:
1258 case CXXBaseObjectRegionKind: {
1263 bool RootIsSymbolic =
false;
1265 Ty = TVR->getDesugaredValueType(
getContext());
1266 }
else if (
const SymbolicRegion *SR = dyn_cast<SymbolicRegion>(R)) {
1271 RootIsSymbolic =
true;
1277 SymbolicOffsetBase = R;
1279 if (RootIsSymbolic) {
1285 SymbolicOffsetBase = R;
1288 SymbolicOffsetBase = R;
1295 if (SymbolicOffsetBase)
1309 case ElementRegionKind: {
1316 SymbolicOffsetBase = R;
1325 if (SymbolicOffsetBase)
1328 int64_t i = CI->getValue().getSExtValue();
1333 SymbolicOffsetBase = R;
1337 case FieldRegionKind: {
1348 SymbolicOffsetBase = R;
1353 if (SymbolicOffsetBase)
1359 FE = RD->
field_end(); FI != FE; ++FI, ++idx) {
1372 if (SymbolicOffsetBase)
1381 std::pair<const VarRegion *, const VarRegion *>
1382 BlockDataRegion::getCaptureRegions(
const VarDecl *VD) {
1401 return std::make_pair(VR, OriginalVR);
1404 void BlockDataRegion::LazyInitializeReferencedVars() {
1411 std::distance(ReferencedBlockVars.begin(), ReferencedBlockVars.end());
1413 if (NumBlockVars == 0) {
1414 ReferencedVars = (
void*) 0x1;
1423 VarVec *BV = A.Allocate<VarVec>();
1424 new (BV) VarVec(BC, NumBlockVars);
1425 VarVec *BVOriginal = A.Allocate<VarVec>();
1426 new (BVOriginal) VarVec(BC, NumBlockVars);
1428 for (
const VarDecl *VD : ReferencedBlockVars) {
1431 std::tie(VR, OriginalVR) = getCaptureRegions(VD);
1434 BV->push_back(VR, BC);
1435 BVOriginal->push_back(OriginalVR, BC);
1438 ReferencedVars = BV;
1439 OriginalVars = BVOriginal;
1449 if (Vec == (
void*) 0x1)
1456 VecOriginal->
begin());
1466 if (Vec == (
void*) 0x1)
1473 VecOriginal->
end());
1478 E = referenced_vars_end();
1480 if (I.getCapturedRegion() == R)
1481 return I.getOriginalRegion();
1492 SymTraitsMap[Sym] |= IK;
1499 setTrait(SR->getSymbol(), IK);
1501 MRTraitsMap[MR] |= IK;
1506 const_symbol_iterator I = SymTraitsMap.find(Sym);
1507 if (I != SymTraitsMap.end())
1508 return I->second & IK;
1519 return hasTrait(SR->getSymbol(), IK);
1521 const_region_iterator I = MRTraitsMap.find(MR);
1522 if (I != MRTraitsMap.end())
1523 return I->second & 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.
const ObjCIvarDecl * getDecl() const
PointerType - C99 6.7.5.1 - Pointer Declarators.
QualType getArrayIndexType() const
SymbolManager & getSymbolManager()
A (possibly-)qualified type.
MemRegion - The root abstract class for all memory regions.
bool hasTrait(SymbolRef Sym, InvalidationKinds IK) const
bool hasCaptures() const
hasCaptures - True if this block (or its nested blocks) captures anything of local storage from its e...
std::string getString() const
Get a string representation of a region for debug use.
const ASTRecordLayout & getASTRecordLayout(const RecordDecl *D) const
Get or compute information about the layout of the specified record (struct/union/class) D...
bool isArithmeticType() const
FunctionType - C99 6.7.5.3 - Function Declarators.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
CharUnits getBaseClassOffset(const CXXRecordDecl *Base) const
getBaseClassOffset - Get the offset, in chars, for the given base class.
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 void dumpToStream(raw_ostream &os) 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.
const RecordDecl * getParent() const
getParent - Returns the parent of this field declaration, which is the struct in which this field is ...
QualType getBlockPointerType(QualType T) const
Return the uniqued reference to the type for a block of the specified type.
The base class of the type hierarchy.
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
MemSpaceRegion - A memory region that represents a "memory space"; for example, the set of global var...
A container of type source information.
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'...
bool isCompleteDefinition() const
isCompleteDefinition - Return true if this decl has its body fully specified.
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()
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.
CompoundLiteralExpr - [C99 6.5.2.5].
void Profile(llvm::FoldingSetNodeID &ID) const override
const T * getAs() const
Member-template getAs<specific type>'.
void setTrait(SymbolRef Sym, InvalidationKinds IK)
QualType getElementType() const
void Profile(llvm::FoldingSetNodeID &ID) const override
const ObjCStringRegion * getObjCStringRegion(const ObjCStringLiteral *Str)
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. ...
CXXThisRegion - Represents the region for the implicit 'this' parameter in a call to a C++ method...
const MemRegion * getSuperRegion() const
RecordDecl - Represents a struct/union/class.
const SymbolicRegion * getSymbolicBase() const
If this is a symbolic region, returns the region.
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 dumpToStream(raw_ostream &os) const
void Profile(llvm::FoldingSetNodeID &ID) const override
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
const FieldDecl * getDecl() const
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
AnalysisDeclContext contains the context data for the function or method under analysis.
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.
void printPrettyAsExpr(raw_ostream &os) const override
Print the region as expression.
CharUnits getVBaseClassOffset(const CXXRecordDecl *VBase) const
getVBaseClassOffset - Get the offset, in chars, for the given base class.
TypeSourceInfo * getSignatureAsWritten() const
const SymbolicRegion * getSymbolicRegion(SymbolRef Sym)
Retrieve or create a "symbolic" memory region.
void Profile(llvm::FoldingSetNodeID &ID) const override
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 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 CXXRecordDecl * getDecl() const
QualType getValueType() const override
const StackFrameContext * getCurrentStackFrame() const
virtual bool inTopFrame() const
Return true if the current LocationContext has no caller context.
const LocationContext * getParent() const
bool hasStackParametersStorage() const
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 printPretty(raw_ostream &OS, PrinterHelper *Helper, const PrintingPolicy &Policy, unsigned Indentation=0, const ASTContext *Context=nullptr) const
void Profile(llvm::FoldingSetNodeID &ID) const override
CXXRecordDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
field_iterator field_begin() const
void dumpToStream(raw_ostream &os) const override
void dumpToStream(raw_ostream &os) const override
referenced_vars_iterator referenced_vars_end() const
void dumpToStream(raw_ostream &os) const override
Represent a region's offset within the top level base region.
const MemSpaceRegion * getMemorySpace() const
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)
void dumpToStream(raw_ostream &os) const override
const CodeSpaceRegion * getCodeRegion()
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
DefinedOrUnknownSVal getExtent(SValBuilder &svalBuilder) const override
getExtent - Returns the size of the region in bytes.
clang::SourceRange sourceRange() const
Retrieve source range from memory region.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
DefinedOrUnknownSVal getExtent(SValBuilder &svalBuilder) const override
getExtent - Returns the size of the region in bytes.
const RegionTy * getAs() const
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...
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.
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
bool hasLocalStorage() const
hasLocalStorage - Returns true if a variable with function scope is a non-static local variable...
const FunctionProtoType * T
bool canPrintPrettyAsExpr() const override
Returns true if this region's textual representation can be used as part of a larger expression...
DefinedOrUnknownSVal getExtent(SValBuilder &svalBuilder) const override
getExtent - Returns the size of the region in bytes.
void dumpToStream(raw_ostream &os) const override
field_iterator field_end() const
static const int64_t Symbolic
DeclContext * getDeclContext()
llvm::BumpPtrAllocator & getAllocator()
void Profile(llvm::FoldingSetNodeID &ID) const override
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const StackFrameContext * getStackFrame() const
The region of the static variables within the current CodeTextRegion scope.
const VarDecl * getDecl() const
Optional< T > getAs() const
Convert to the specified SVal type, returning None if this SVal is not of the desired type...
bool isConstQualified() const
Determine whether this type is const-qualified.
void dumpToStream(raw_ostream &os) const override
uint64_t getFieldOffset(unsigned FieldNo) const
getFieldOffset - Get the offset of the given field index, in bits.
const MemRegion * StripCasts(bool StripBaseCasts=true) const
void Profile(llvm::FoldingSetNodeID &ID) const
const BlockDecl * getDecl() const
FunctionCodeRegion - A region that represents code texts of function.
virtual bool canPrintPretty() const
Returns true if this region can be printed in a user-friendly way.
static bool isImmediateBase(const CXXRecordDecl *Child, const CXXRecordDecl *Base)
Returns true if Base is an immediate base class of Child.
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
bool hasGlobalStorage() const
Returns true for all variables that do not have local storage.
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
const StackFrameContext * getStackFrame() const
DefinedOrUnknownSVal getExtent(SValBuilder &svalBuilder) const override
getExtent - Returns the size of the region in bytes.
virtual void printPrettyAsExpr(raw_ostream &os) const
Print the region as expression.
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
referenced_vars_iterator referenced_vars_begin() const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
void dumpToStream(raw_ostream &os) const override
std::string getDescriptiveName(bool UseQuotes=true) const
Get descriptive name for memory region.
const CXXThisRegion * getCXXThisRegion(QualType thisPointerTy, const LocationContext *LC)
getCXXThisRegion - Retrieve the [artificial] region associated with the parameter 'this'...
RegionRawOffset getAsArrayOffset() const
Compute the offset within the array. The array might also be a subobject.
virtual void printPretty(raw_ostream &os) const
Print the region for use in diagnostics.
const CXXBaseObjectRegion * getCXXBaseObjectRegion(const CXXRecordDecl *BaseClass, const SubRegion *Super, bool IsVirtual)
Create a CXXBaseObjectRegion with the given base class for region Super.
bool isVirtuallyDerivedFrom(const CXXRecordDecl *Base) const
Determine whether this class is virtually derived from the class Base.
const SymbolicRegion * getSymbolicHeapRegion(SymbolRef sym)
Return a unique symbolic region belonging to heap memory space.
Dataflow Directional Tag Classes.
QualType getValueType() const override
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
bool isZeroConstant() const
llvm::iterator_range< referenced_decls_iterator > getReferencedBlockVars(const BlockDecl *BD)
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...
QualType getFunctionNoProtoType(QualType ResultTy, const FunctionType::ExtInfo &Info) const
Return a K&R style C function type like 'int()'.
Represents symbolic expression.
const VarRegion * getOriginalRegion(const VarRegion *VR) const
Return the original region for a captured region, if one exists.
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...
void dumpToStream(raw_ostream &os) const override
const FunctionCodeRegion * getFunctionCodeRegion(const NamedDecl *FD)
virtual bool canPrintPrettyAsExpr() const
Returns true if this region's textual representation can be used as part of a larger expression...
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 Decl * getDecl() const
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
SubRegion - A region that subsets another larger region.
uint64_t getCharWidth() const
Return the size of the character type, in bits.
bool isStaticLocal() const
isStaticLocal - Returns true if a variable with function scope is a static local variable.
RegionOffset getAsOffset() const
Compute the offset within the top level memory object.
bool hasStackStorage() const
void Profile(llvm::FoldingSetNodeID &ID) const override
const Type * getTypePtrOrNull() const
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
SourceManager & getSourceManager()
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types...
const BlockDataRegion * getBlockDataRegion(const BlockCodeRegion *bc, const LocationContext *lc, unsigned blockCount)
getBlockDataRegion - Get the memory region associated with an instance of a block.
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
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)
static void ProfileRegion(llvm::FoldingSetNodeID &ID, SymbolRef sym, const MemRegion *superRegion)
Represents a C++ struct/union/class.
void dumpToStream(raw_ostream &os) const override
virtual bool isSubRegionOf(const MemRegion *R) const
Check if the region is a subregion of the given region.
void printPrettyAsExpr(raw_ostream &os) const override
Print the region as expression.
ObjCIvarDecl - Represents an ObjC instance variable.
QualType getValueType() const override
const MemRegion * getBaseRegion() const
StringLiteral - This represents a string literal expression, e.g.
void dumpToStream(raw_ostream &os) const override
StringRegion - Region associated with a StringLiteral.
StringRef getName() const
getName - Get the name of identifier for this declaration as a StringRef.
void Profile(llvm::FoldingSetNodeID &ID) const override
ElementRegin is used to represent both array elements and casts.
static Decl::Kind getKind(const Decl *D)
void dumpToStream(raw_ostream &os) const override
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
bool hasStackNonParametersStorage() const
A trivial tuple used to represent a source range.
NamedDecl - This represents a decl with a name.
bool hasGlobalsOrParametersStorage() const
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
SourceLocation getLocation() const
void dumpToStream(raw_ostream &os) const override