clang  6.0.0svn
Public Member Functions | List of all members
clang::ento::MemRegionManager Class Reference

#include "clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h"

Public Member Functions

 MemRegionManager (ASTContext &c, llvm::BumpPtrAllocator &a)
 
 ~MemRegionManager ()
 
ASTContextgetContext ()
 
llvm::BumpPtrAllocator & getAllocator ()
 
const StackLocalsSpaceRegiongetStackLocalsRegion (const StackFrameContext *STC)
 getStackLocalsRegion - Retrieve the memory region associated with the specified stack frame. More...
 
const StackArgumentsSpaceRegiongetStackArgumentsRegion (const StackFrameContext *STC)
 getStackArgumentsRegion - Retrieve the memory region associated with function/method arguments of the specified stack frame. More...
 
const GlobalsSpaceRegiongetGlobalsRegion (MemRegion::Kind K=MemRegion::GlobalInternalSpaceRegionKind, const CodeTextRegion *R=nullptr)
 getGlobalsRegion - Retrieve the memory region associated with global variables. More...
 
const HeapSpaceRegiongetHeapRegion ()
 getHeapRegion - Retrieve the memory region associated with the generic "heap". More...
 
const UnknownSpaceRegiongetUnknownRegion ()
 getUnknownRegion - Retrieve the memory region associated with unknown memory space. More...
 
const CodeSpaceRegiongetCodeRegion ()
 
const AllocaRegiongetAllocaRegion (const Expr *Ex, unsigned Cnt, const LocationContext *LC)
 getAllocaRegion - Retrieve a region associated with a call to alloca(). More...
 
const CompoundLiteralRegiongetCompoundLiteralRegion (const CompoundLiteralExpr *CL, const LocationContext *LC)
 getCompoundLiteralRegion - Retrieve the region associated with a given CompoundLiteral. More...
 
const CXXThisRegiongetCXXThisRegion (QualType thisPointerTy, const LocationContext *LC)
 getCXXThisRegion - Retrieve the [artificial] region associated with the parameter 'this'. More...
 
const SymbolicRegiongetSymbolicRegion (SymbolRef Sym)
 Retrieve or create a "symbolic" memory region. More...
 
const SymbolicRegiongetSymbolicHeapRegion (SymbolRef sym)
 Return a unique symbolic region belonging to heap memory space. More...
 
const StringRegiongetStringRegion (const StringLiteral *Str)
 
const ObjCStringRegiongetObjCStringRegion (const ObjCStringLiteral *Str)
 
const VarRegiongetVarRegion (const VarDecl *D, const LocationContext *LC)
 getVarRegion - Retrieve or create the memory region associated with a specified VarDecl and LocationContext. More...
 
const VarRegiongetVarRegion (const VarDecl *D, const MemRegion *superR)
 getVarRegion - Retrieve or create the memory region associated with a specified VarDecl and super region. More...
 
const ElementRegiongetElementRegion (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 ElementRegiongetElementRegionWithSuper (const ElementRegion *ER, const SubRegion *superRegion)
 
const FieldRegiongetFieldRegion (const FieldDecl *fd, const SubRegion *superRegion)
 getFieldRegion - Retrieve or create the memory region associated with a specified FieldDecl. More...
 
const FieldRegiongetFieldRegionWithSuper (const FieldRegion *FR, const SubRegion *superRegion)
 
const ObjCIvarRegiongetObjCIvarRegion (const ObjCIvarDecl *ivd, const SubRegion *superRegion)
 getObjCIvarRegion - Retrieve or create the memory region associated with a specified Objective-c instance variable. More...
 
const CXXTempObjectRegiongetCXXTempObjectRegion (Expr const *Ex, LocationContext const *LC)
 
const CXXBaseObjectRegiongetCXXBaseObjectRegion (const CXXRecordDecl *BaseClass, const SubRegion *Super, bool IsVirtual)
 Create a CXXBaseObjectRegion with the given base class for region Super. More...
 
const CXXBaseObjectRegiongetCXXBaseObjectRegionWithSuper (const CXXBaseObjectRegion *baseReg, const SubRegion *superRegion)
 Create a CXXBaseObjectRegion with the same CXXRecordDecl but a different super region. More...
 
const FunctionCodeRegiongetFunctionCodeRegion (const NamedDecl *FD)
 
const BlockCodeRegiongetBlockCodeRegion (const BlockDecl *BD, CanQualType locTy, AnalysisDeclContext *AC)
 
const BlockDataRegiongetBlockDataRegion (const BlockCodeRegion *bc, const LocationContext *lc, unsigned blockCount)
 getBlockDataRegion - Get the memory region associated with an instance of a block. More...
 
const CXXTempObjectRegiongetCXXStaticTempObjectRegion (const Expr *Ex)
 Create a CXXTempObjectRegion for temporaries which are lifetime-extended by static references. More...
 

Detailed Description

Definition at line 1185 of file MemRegion.h.

Constructor & Destructor Documentation

◆ MemRegionManager()

clang::ento::MemRegionManager::MemRegionManager ( ASTContext c,
llvm::BumpPtrAllocator &  a 
)
inline

Definition at line 1207 of file MemRegion.h.

◆ ~MemRegionManager()

MemRegionManager::~MemRegionManager ( )

Definition at line 96 of file MemRegion.cpp.

Member Function Documentation

◆ getAllocaRegion()

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 1054 of file MemRegion.cpp.

◆ getAllocator()

llvm::BumpPtrAllocator& clang::ento::MemRegionManager::getAllocator ( )
inline

Definition at line 1216 of file MemRegion.h.

Referenced by clang::ento::MemRegion::getAsOffset().

◆ getBlockCodeRegion()

const BlockCodeRegion * MemRegionManager::getBlockCodeRegion ( const BlockDecl BD,
CanQualType  locTy,
AnalysisDeclContext AC 
)

Definition at line 952 of file MemRegion.cpp.

References getCodeRegion().

Referenced by clang::ento::SValBuilder::getBlockPointer(), and getVarRegion().

◆ getBlockDataRegion()

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 875 of file MemRegion.cpp.

References clang::LocationContext::getCurrentStackFrame(), clang::ento::BlockCodeRegion::getDecl(), getGlobalsRegion(), getStackLocalsRegion(), getUnknownRegion(), and clang::BlockDecl::hasCaptures().

Referenced by clang::ento::SValBuilder::getBlockPointer().

◆ getCodeRegion()

const CodeSpaceRegion * MemRegionManager::getCodeRegion ( )

◆ getCompoundLiteralRegion()

const CompoundLiteralRegion * MemRegionManager::getCompoundLiteralRegion ( const CompoundLiteralExpr CL,
const LocationContext LC 
)

getCompoundLiteralRegion - Retrieve the region associated with a given CompoundLiteral.

Definition at line 909 of file MemRegion.cpp.

References clang::LocationContext::getCurrentStackFrame(), getGlobalsRegion(), getStackLocalsRegion(), and clang::CompoundLiteralExpr::isFileScope().

Referenced by clang::ento::StoreManager::getLValueCompoundLiteral().

◆ getContext()

ASTContext& clang::ento::MemRegionManager::getContext ( )
inline

◆ getCXXBaseObjectRegion()

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 1010 of file MemRegion.cpp.

References isValidBaseClass().

Referenced by clang::ento::StoreManager::evalDerivedToBase().

◆ getCXXBaseObjectRegionWithSuper()

const CXXBaseObjectRegion* clang::ento::MemRegionManager::getCXXBaseObjectRegionWithSuper ( const CXXBaseObjectRegion baseReg,
const SubRegion superRegion 
)
inline

Create a CXXBaseObjectRegion with the same CXXRecordDecl but a different super region.

Definition at line 1322 of file MemRegion.h.

References clang::ento::CXXBaseObjectRegion::getDecl(), and clang::ento::CXXBaseObjectRegion::isVirtual().

◆ getCXXStaticTempObjectRegion()

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 903 of file MemRegion.cpp.

References getGlobalsRegion().

Referenced by clang::ento::ExprEngine::getInitialState().

◆ getCXXTempObjectRegion()

const CXXTempObjectRegion * MemRegionManager::getCXXTempObjectRegion ( Expr const *  Ex,
LocationContext const *  LC 
)

◆ getCXXThisRegion()

const CXXThisRegion * MemRegionManager::getCXXThisRegion ( QualType  thisPointerTy,
const LocationContext LC 
)

◆ getElementRegion()

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 925 of file MemRegion.cpp.

References clang::ASTContext::getCanonicalType(), clang::CanQual< T >::getUnqualifiedType(), and clang::T.

Referenced by clang::ento::mpi::MPIChecker::checkMissingWaits(), clang::ento::StoreManager::GetElementZeroRegion(), clang::ento::StoreManager::getLValueElement(), and clang::ento::StoreManager::MakeElementRegion().

◆ getElementRegionWithSuper()

const ElementRegion* clang::ento::MemRegionManager::getElementRegionWithSuper ( const ElementRegion ER,
const SubRegion superRegion 
)
inline

◆ getFieldRegion()

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 968 of file MemRegion.cpp.

Referenced by clang::ento::StoreManager::CastRetrievedVal().

◆ getFieldRegionWithSuper()

const FieldRegion* clang::ento::MemRegionManager::getFieldRegionWithSuper ( const FieldRegion FR,
const SubRegion superRegion 
)
inline

Definition at line 1296 of file MemRegion.h.

References clang::ento::FieldRegion::getDecl().

◆ getFunctionCodeRegion()

const FunctionCodeRegion * MemRegionManager::getFunctionCodeRegion ( const NamedDecl FD)

Definition at line 947 of file MemRegion.cpp.

References getCodeRegion().

Referenced by clang::ento::SValBuilder::getFunctionPointer(), and getVarRegion().

◆ getGlobalsRegion()

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 705 of file MemRegion.cpp.

Referenced by getBlockDataRegion(), getCompoundLiteralRegion(), getCXXStaticTempObjectRegion(), getObjCStringRegion(), getStringRegion(), getVarRegion(), and clang::ento::getWidenedLoopState().

◆ getHeapRegion()

const HeapSpaceRegion * MemRegionManager::getHeapRegion ( )

getHeapRegion - Retrieve the memory region associated with the generic "heap".

Definition at line 726 of file MemRegion.cpp.

Referenced by getSymbolicHeapRegion().

◆ getObjCIvarRegion()

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 974 of file MemRegion.cpp.

Referenced by clang::ento::StoreManager::CastRetrievedVal().

◆ getObjCStringRegion()

const ObjCStringRegion * MemRegionManager::getObjCStringRegion ( const ObjCStringLiteral Str)

Definition at line 747 of file MemRegion.cpp.

References getGlobalsRegion().

◆ getStackArgumentsRegion()

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 692 of file MemRegion.cpp.

Referenced by getCXXThisRegion(), getVarRegion(), and clang::ento::getWidenedLoopState().

◆ getStackLocalsRegion()

const StackLocalsSpaceRegion * MemRegionManager::getStackLocalsRegion ( const StackFrameContext STC)

getStackLocalsRegion - Retrieve the memory region associated with the specified stack frame.

Definition at line 679 of file MemRegion.cpp.

Referenced by getBlockDataRegion(), getCompoundLiteralRegion(), getVarRegion(), and clang::ento::getWidenedLoopState().

◆ getStringRegion()

const StringRegion * MemRegionManager::getStringRegion ( const StringLiteral Str)

Definition at line 741 of file MemRegion.cpp.

References getGlobalsRegion().

◆ getSymbolicHeapRegion()

const SymbolicRegion * MemRegionManager::getSymbolicHeapRegion ( SymbolRef  sym)

Return a unique symbolic region belonging to heap memory space.

Definition at line 963 of file MemRegion.cpp.

References getHeapRegion().

◆ getSymbolicRegion()

const SymbolicRegion * MemRegionManager::getSymbolicRegion ( SymbolRef  Sym)

Retrieve or create a "symbolic" memory region.

getSymbolicRegion - Retrieve or create a "symbolic" memory region.

Definition at line 959 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().

◆ getUnknownRegion()

const UnknownSpaceRegion * MemRegionManager::getUnknownRegion ( )

getUnknownRegion - Retrieve the memory region associated with unknown memory space.

Definition at line 730 of file MemRegion.cpp.

Referenced by clang::ento::MemRegion::getAsOffset(), getBlockDataRegion(), getSymbolicRegion(), and getVarRegion().

◆ getVarRegion() [1/2]

const VarRegion * MemRegionManager::getVarRegion ( const VarDecl D,
const LocationContext LC 
)

◆ getVarRegion() [2/2]

const VarRegion * MemRegionManager::getVarRegion ( const VarDecl D,
const MemRegion superR 
)

getVarRegion - Retrieve or create the memory region associated with a specified VarDecl and super region.

Definition at line 869 of file MemRegion.cpp.


The documentation for this class was generated from the following files: