clang
9.0.0
|
#include "clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h"
Public Member Functions | |
MemRegionManager (ASTContext &c, llvm::BumpPtrAllocator &a) | |
~MemRegionManager () | |
ASTContext & | getContext () |
llvm::BumpPtrAllocator & | getAllocator () |
const StackLocalsSpaceRegion * | getStackLocalsRegion (const StackFrameContext *STC) |
getStackLocalsRegion - Retrieve the memory region associated with the specified stack frame. More... | |
const StackArgumentsSpaceRegion * | getStackArgumentsRegion (const StackFrameContext *STC) |
getStackArgumentsRegion - Retrieve the memory region associated with function/method arguments of the specified stack frame. More... | |
const GlobalsSpaceRegion * | getGlobalsRegion (MemRegion::Kind K=MemRegion::GlobalInternalSpaceRegionKind, const CodeTextRegion *R=nullptr) |
getGlobalsRegion - Retrieve the memory region associated with global variables. More... | |
const HeapSpaceRegion * | getHeapRegion () |
getHeapRegion - Retrieve the memory region associated with the generic "heap". More... | |
const UnknownSpaceRegion * | getUnknownRegion () |
getUnknownRegion - Retrieve the memory region associated with unknown memory space. More... | |
const CodeSpaceRegion * | getCodeRegion () |
const AllocaRegion * | getAllocaRegion (const Expr *Ex, unsigned Cnt, const LocationContext *LC) |
getAllocaRegion - Retrieve a region associated with a call to alloca(). More... | |
const CompoundLiteralRegion * | getCompoundLiteralRegion (const CompoundLiteralExpr *CL, const LocationContext *LC) |
getCompoundLiteralRegion - Retrieve the region associated with a given CompoundLiteral. More... | |
const CXXThisRegion * | getCXXThisRegion (QualType thisPointerTy, const LocationContext *LC) |
getCXXThisRegion - Retrieve the [artificial] region associated with the parameter 'this'. More... | |
const SymbolicRegion * | getSymbolicRegion (SymbolRef Sym) |
Retrieve or create a "symbolic" memory region. More... | |
const SymbolicRegion * | getSymbolicHeapRegion (SymbolRef sym) |
Return a unique symbolic region belonging to heap memory space. More... | |
const StringRegion * | getStringRegion (const StringLiteral *Str) |
const ObjCStringRegion * | getObjCStringRegion (const ObjCStringLiteral *Str) |
const VarRegion * | getVarRegion (const VarDecl *D, const LocationContext *LC) |
getVarRegion - Retrieve or create the memory region associated with a specified VarDecl and LocationContext. More... | |
const VarRegion * | getVarRegion (const VarDecl *D, const MemRegion *superR) |
getVarRegion - Retrieve or create the memory region associated with a specified VarDecl and super region. More... | |
const ElementRegion * | getElementRegion (QualType elementType, NonLoc Idx, const SubRegion *superRegion, ASTContext &Ctx) |
getElementRegion - Retrieve the memory region associated with the associated element type, index, and super region. More... | |
const ElementRegion * | getElementRegionWithSuper (const ElementRegion *ER, const SubRegion *superRegion) |
const FieldRegion * | getFieldRegion (const FieldDecl *fd, const SubRegion *superRegion) |
getFieldRegion - Retrieve or create the memory region associated with a specified FieldDecl. More... | |
const FieldRegion * | getFieldRegionWithSuper (const FieldRegion *FR, const SubRegion *superRegion) |
const ObjCIvarRegion * | getObjCIvarRegion (const ObjCIvarDecl *ivd, const SubRegion *superRegion) |
getObjCIvarRegion - Retrieve or create the memory region associated with a specified Objective-c instance variable. More... | |
const CXXTempObjectRegion * | getCXXTempObjectRegion (Expr const *Ex, LocationContext const *LC) |
const CXXBaseObjectRegion * | getCXXBaseObjectRegion (const CXXRecordDecl *BaseClass, const SubRegion *Super, bool IsVirtual) |
Create a CXXBaseObjectRegion with the given base class for region Super . More... | |
const CXXBaseObjectRegion * | getCXXBaseObjectRegionWithSuper (const CXXBaseObjectRegion *baseReg, const SubRegion *superRegion) |
Create a CXXBaseObjectRegion with the same CXXRecordDecl but a different super region. More... | |
const CXXDerivedObjectRegion * | getCXXDerivedObjectRegion (const CXXRecordDecl *BaseClass, const SubRegion *Super) |
Create a CXXDerivedObjectRegion with the given derived class for region Super . More... | |
const FunctionCodeRegion * | getFunctionCodeRegion (const NamedDecl *FD) |
const BlockCodeRegion * | getBlockCodeRegion (const BlockDecl *BD, CanQualType locTy, AnalysisDeclContext *AC) |
const BlockDataRegion * | getBlockDataRegion (const BlockCodeRegion *bc, const LocationContext *lc, unsigned blockCount) |
getBlockDataRegion - Get the memory region associated with an instance of a block. More... | |
const CXXTempObjectRegion * | getCXXStaticTempObjectRegion (const Expr *Ex) |
Create a CXXTempObjectRegion for temporaries which are lifetime-extended by static references. More... | |
template<typename RegionTy , typename SuperTy , typename Arg1Ty > | |
RegionTy * | getSubRegion (const Arg1Ty arg1, const SuperTy *superRegion) |
template<typename RegionTy , typename SuperTy , typename Arg1Ty , typename Arg2Ty > | |
RegionTy * | getSubRegion (const Arg1Ty arg1, const Arg2Ty arg2, const SuperTy *superRegion) |
template<typename RegionTy , typename SuperTy , typename Arg1Ty , typename Arg2Ty , typename Arg3Ty > | |
RegionTy * | getSubRegion (const Arg1Ty arg1, const Arg2Ty arg2, const Arg3Ty arg3, const SuperTy *superRegion) |
template<typename REG > | |
const REG * | LazyAllocate (REG *®ion) |
template<typename REG , typename ARG > | |
const REG * | LazyAllocate (REG *®ion, ARG a) |
Definition at line 1238 of file MemRegion.h.
|
inline |
Definition at line 1259 of file MemRegion.h.
|
default |
Referenced by getSubRegion().
const AllocaRegion * MemRegionManager::getAllocaRegion | ( | const Expr * | Ex, |
unsigned | Cnt, | ||
const LocationContext * | LC | ||
) |
getAllocaRegion - Retrieve a region associated with a call to alloca().
Definition at line 1121 of file MemRegion.cpp.
References clang::LocationContext::getStackFrame(), and getStackLocalsRegion().
|
inline |
Definition at line 1264 of file MemRegion.h.
Referenced by clang::ento::MemRegion::getAsOffset().
const BlockCodeRegion * MemRegionManager::getBlockCodeRegion | ( | const BlockDecl * | BD, |
CanQualType | locTy, | ||
AnalysisDeclContext * | AC | ||
) |
Definition at line 1017 of file MemRegion.cpp.
References getCodeRegion().
Referenced by clang::ento::SValBuilder::getBlockPointer(), and getVarRegion().
const BlockDataRegion * MemRegionManager::getBlockDataRegion | ( | const BlockCodeRegion * | bc, |
const LocationContext * | lc, | ||
unsigned | blockCount | ||
) |
getBlockDataRegion - Get the memory region associated with an instance of a block.
Unlike many other MemRegions, the LocationContext* argument is allowed to be NULL for cases where we have no known context.
Definition at line 939 of file MemRegion.cpp.
References clang::ento::BlockCodeRegion::getDecl(), getGlobalsRegion(), clang::LocationContext::getStackFrame(), getStackLocalsRegion(), getUnknownRegion(), and clang::BlockDecl::hasCaptures().
Referenced by clang::ento::SValBuilder::getBlockPointer().
const CodeSpaceRegion * MemRegionManager::getCodeRegion | ( | ) |
Definition at line 796 of file MemRegion.cpp.
Referenced by clang::ento::MemRegion::getAsOffset(), getBlockCodeRegion(), getFunctionCodeRegion(), and clang::ento::StaticGlobalSpaceRegion::Profile().
const CompoundLiteralRegion * MemRegionManager::getCompoundLiteralRegion | ( | const CompoundLiteralExpr * | CL, |
const LocationContext * | LC | ||
) |
getCompoundLiteralRegion - Retrieve the region associated with a given CompoundLiteral.
Definition at line 973 of file MemRegion.cpp.
References getGlobalsRegion(), clang::LocationContext::getStackFrame(), getStackLocalsRegion(), and clang::CompoundLiteralExpr::isFileScope().
Referenced by clang::ento::StoreManager::getLValueCompoundLiteral().
|
inline |
Definition at line 1262 of file MemRegion.h.
Referenced by clang::ento::AllocaRegion::dumpToStream(), clang::ento::StringRegion::dumpToStream(), clang::ento::ObjCStringRegion::dumpToStream(), clang::ento::CompoundLiteralRegion::dumpToStream(), clang::ento::CXXTempObjectRegion::dumpToStream(), clang::ento::ElementRegion::getAsArrayOffset(), and getVarRegion().
const CXXBaseObjectRegion * MemRegionManager::getCXXBaseObjectRegion | ( | const CXXRecordDecl * | BaseClass, |
const SubRegion * | Super, | ||
bool | IsVirtual | ||
) |
Create a CXXBaseObjectRegion with the given base class for region Super
.
The type of Super
is assumed be a class deriving from BaseClass
.
Definition at line 1074 of file MemRegion.cpp.
References isValidBaseClass().
Referenced by clang::ento::StoreManager::evalDerivedToBase().
|
inline |
Create a CXXBaseObjectRegion with the same CXXRecordDecl but a different super region.
Definition at line 1370 of file MemRegion.h.
References a, clang::ento::CXXBaseObjectRegion::getDecl(), and clang::ento::CXXBaseObjectRegion::isVirtual().
const CXXDerivedObjectRegion * MemRegionManager::getCXXDerivedObjectRegion | ( | const CXXRecordDecl * | BaseClass, |
const SubRegion * | Super | ||
) |
Create a CXXDerivedObjectRegion with the given derived class for region Super
.
This should not be used for casting an existing CXXBaseObjectRegion back to the derived type; instead, CXXBaseObjectRegion should be removed.
Definition at line 1094 of file MemRegion.cpp.
const CXXTempObjectRegion * MemRegionManager::getCXXStaticTempObjectRegion | ( | const Expr * | Ex | ) |
Create a CXXTempObjectRegion for temporaries which are lifetime-extended by static references.
This differs from getCXXTempObjectRegion in the super-region used.
Definition at line 967 of file MemRegion.cpp.
References getGlobalsRegion().
Referenced by clang::ento::ExprEngine::CreateCXXTemporaryObject(), and clang::ento::ExprEngine::getInitialState().
const CXXTempObjectRegion * MemRegionManager::getCXXTempObjectRegion | ( | Expr const * | Ex, |
LocationContext const * | LC | ||
) |
Definition at line 1044 of file MemRegion.cpp.
References clang::LocationContext::getStackFrame(), and getStackLocalsRegion().
Referenced by clang::ento::ExprEngine::CreateCXXTemporaryObject(), clang::ento::ExprEngine::getInitialState(), clang::ento::ExprEngine::VisitCXXConstructExpr(), and clang::ento::ExprEngine::VisitLambdaExpr().
const CXXThisRegion * MemRegionManager::getCXXThisRegion | ( | QualType | thisPointerTy, |
const LocationContext * | LC | ||
) |
getCXXThisRegion - Retrieve the [artificial] region associated with the parameter 'this'.
Definition at line 1100 of file MemRegion.cpp.
References clang::Type::getAs(), clang::LocationContext::getDecl(), clang::LocationContext::getParent(), getStackArgumentsRegion(), clang::LocationContext::getStackFrame(), and clang::LocationContext::inTopFrame().
Referenced by clang::ento::ExprEngine::VisitCXXThisExpr().
const ElementRegion * MemRegionManager::getElementRegion | ( | QualType | elementType, |
NonLoc | Idx, | ||
const SubRegion * | superRegion, | ||
ASTContext & | Ctx | ||
) |
getElementRegion - Retrieve the memory region associated with the associated element type, index, and super region.
Definition at line 989 of file MemRegion.cpp.
References clang::ASTContext::getCanonicalType(), and clang::CanQual< T >::getUnqualifiedType().
Referenced by clang::ento::mpi::MPIChecker::checkMissingWaits(), clang::ento::StoreManager::GetElementZeroRegion(), and clang::ento::StoreManager::MakeElementRegion().
|
inline |
Definition at line 1331 of file MemRegion.h.
References clang::ento::MemRegion::getContext(), clang::ento::ElementRegion::getElementType(), and clang::ento::ElementRegion::getIndex().
const FieldRegion * MemRegionManager::getFieldRegion | ( | const FieldDecl * | fd, |
const SubRegion * | superRegion | ||
) |
getFieldRegion - Retrieve or create the memory region associated with a specified FieldDecl.
'superRegion' corresponds to the containing memory region (which typically represents the memory representing a structure or class).
Definition at line 1032 of file MemRegion.cpp.
References d.
|
inline |
Definition at line 1344 of file MemRegion.h.
References clang::ento::FieldRegion::getDecl().
const FunctionCodeRegion * MemRegionManager::getFunctionCodeRegion | ( | const NamedDecl * | FD | ) |
Definition at line 1011 of file MemRegion.cpp.
References getCodeRegion().
Referenced by clang::ento::SValBuilder::getFunctionPointer(), and getVarRegion().
const GlobalsSpaceRegion * MemRegionManager::getGlobalsRegion | ( | MemRegion::Kind | K = MemRegion::GlobalInternalSpaceRegionKind , |
const CodeTextRegion * | R = nullptr |
||
) |
getGlobalsRegion - Retrieve the memory region associated with global variables.
Definition at line 767 of file MemRegion.cpp.
Referenced by getBlockDataRegion(), getCompoundLiteralRegion(), getCXXStaticTempObjectRegion(), getObjCStringRegion(), getStringRegion(), getVarRegion(), and clang::ento::getWidenedLoopState().
const HeapSpaceRegion * MemRegionManager::getHeapRegion | ( | ) |
getHeapRegion - Retrieve the memory region associated with the generic "heap".
Definition at line 788 of file MemRegion.cpp.
Referenced by getSymbolicHeapRegion().
const ObjCIvarRegion * MemRegionManager::getObjCIvarRegion | ( | const ObjCIvarDecl * | ivd, |
const SubRegion * | superRegion | ||
) |
getObjCIvarRegion - Retrieve or create the memory region associated with a specified Objective-c instance variable.
'superRegion' corresponds to the containing region (which typically represents the Objective-C object).
Definition at line 1038 of file MemRegion.cpp.
References d.
const ObjCStringRegion * MemRegionManager::getObjCStringRegion | ( | const ObjCStringLiteral * | Str | ) |
Definition at line 810 of file MemRegion.cpp.
References getGlobalsRegion().
const StackArgumentsSpaceRegion * MemRegionManager::getStackArgumentsRegion | ( | const StackFrameContext * | STC | ) |
getStackArgumentsRegion - Retrieve the memory region associated with function/method arguments of the specified stack frame.
Definition at line 754 of file MemRegion.cpp.
Referenced by getCXXThisRegion(), getVarRegion(), and clang::ento::getWidenedLoopState().
const StackLocalsSpaceRegion * MemRegionManager::getStackLocalsRegion | ( | const StackFrameContext * | STC | ) |
getStackLocalsRegion - Retrieve the memory region associated with the specified stack frame.
Definition at line 741 of file MemRegion.cpp.
Referenced by getAllocaRegion(), getBlockDataRegion(), getCompoundLiteralRegion(), getCXXTempObjectRegion(), getVarRegion(), and clang::ento::getWidenedLoopState().
const StringRegion * MemRegionManager::getStringRegion | ( | const StringLiteral * | Str | ) |
Definition at line 804 of file MemRegion.cpp.
References getGlobalsRegion().
RegionTy* clang::ento::MemRegionManager::getSubRegion | ( | const Arg1Ty | arg1, |
const SuperTy * | superRegion | ||
) |
Definition at line 66 of file MemRegion.cpp.
RegionTy* clang::ento::MemRegionManager::getSubRegion | ( | const Arg1Ty | arg1, |
const Arg2Ty | arg2, | ||
const SuperTy * | superRegion | ||
) |
Definition at line 83 of file MemRegion.cpp.
RegionTy* clang::ento::MemRegionManager::getSubRegion | ( | const Arg1Ty | arg1, |
const Arg2Ty | arg2, | ||
const Arg3Ty | arg3, | ||
const SuperTy * | superRegion | ||
) |
Definition at line 101 of file MemRegion.cpp.
References clang::ento::MemRegion::~MemRegion(), and ~MemRegionManager().
const SymbolicRegion * MemRegionManager::getSymbolicHeapRegion | ( | SymbolRef | sym | ) |
Return a unique symbolic region belonging to heap memory space.
Definition at line 1027 of file MemRegion.cpp.
References getHeapRegion().
Referenced by clang::ento::SValBuilder::getConjuredHeapSymbolVal().
const SymbolicRegion * MemRegionManager::getSymbolicRegion | ( | SymbolRef | Sym | ) |
Retrieve or create a "symbolic" memory region.
getSymbolicRegion - Retrieve or create a "symbolic" memory region.
Definition at line 1023 of file MemRegion.cpp.
References getUnknownRegion().
Referenced by clang::ento::SValBuilder::conjureSymbolVal(), clang::ento::SValBuilder::getDerivedRegionValueSymbolVal(), clang::ento::SValBuilder::getMetadataSymbolVal(), clang::ento::SValBuilder::getRegionValueSymbolVal(), and clang::ento::SValBuilder::makeLoc().
const UnknownSpaceRegion * MemRegionManager::getUnknownRegion | ( | ) |
getUnknownRegion - Retrieve the memory region associated with unknown memory space.
Definition at line 792 of file MemRegion.cpp.
Referenced by clang::ento::MemRegion::getAsOffset(), getBlockDataRegion(), getSymbolicRegion(), and getVarRegion().
const VarRegion * MemRegionManager::getVarRegion | ( | const VarDecl * | D, |
const LocationContext * | LC | ||
) |
getVarRegion - Retrieve or create the memory region associated with a specified VarDecl and LocationContext.
Definition at line 845 of file MemRegion.cpp.
References clang::Type::getAs(), getBlockCodeRegion(), clang::ASTContext::getBlockPointerType(), clang::VarDecl::getCanonicalDecl(), clang::ASTContext::getCanonicalType(), getContext(), clang::ento::VarRegion::getDecl(), clang::Decl::getDeclContext(), getFunctionCodeRegion(), clang::ASTContext::getFunctionNoProtoType(), getGlobalsRegion(), clang::Decl::getLocation(), clang::NamedDecl::getName(), clang::BlockDecl::getSignatureAsWritten(), clang::ASTContext::getSourceManager(), getStackArgumentsRegion(), getStackLocalsRegion(), getStackOrCaptureRegionForDeclContext(), clang::ValueDecl::getType(), clang::QualType::getTypePtrOrNull(), getUnknownRegion(), clang::VarDecl::hasGlobalStorage(), clang::VarDecl::hasLocalStorage(), clang::Type::isArithmeticType(), clang::QualType::isConstQualified(), clang::SourceManager::isInSystemHeader(), clang::QualType::isNull(), clang::VarDecl::isStaticLocal(), V, and clang::ASTContext::VoidTy.
Referenced by clang::ento::retaincountchecker::RetainCountChecker::checkPostStmt(), clang::ento::MemRegion::getAsOffset(), and clang::ento::StoreManager::getLValueVar().
getVarRegion - Retrieve or create the memory region associated with a specified VarDecl and super region.
Definition at line 932 of file MemRegion.cpp.
References clang::VarDecl::getCanonicalDecl().
const REG* clang::ento::MemRegionManager::LazyAllocate | ( | REG *& | region | ) |
Definition at line 721 of file MemRegion.cpp.
const REG* clang::ento::MemRegionManager::LazyAllocate | ( | REG *& | region, |
ARG | a | ||
) |
Definition at line 731 of file MemRegion.cpp.