class MemRegionManager

Declaration

class MemRegionManager { /* full declaration omitted */ };

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1341

Member Variables

private clang::ASTContext& Ctx
private llvm::BumpPtrAllocator& A
private llvm::FoldingSet<MemRegion> Regions
private clang::ento::GlobalInternalSpaceRegion* InternalGlobals = nullptr
private clang::ento::GlobalSystemSpaceRegion* SystemGlobals = nullptr
private clang::ento::GlobalImmutableSpaceRegion* ImmutableGlobals = nullptr
private llvm::DenseMap<const StackFrameContext*, StackLocalsSpaceRegion*> StackLocalsSpaceRegions
private llvm::DenseMap<const StackFrameContext*, StackArgumentsSpaceRegion*> StackArgumentsSpaceRegions
private llvm::DenseMap<const CodeTextRegion*, StaticGlobalSpaceRegion*> StaticsGlobalSpaceRegions
private clang::ento::HeapSpaceRegion* heap = nullptr
private clang::ento::UnknownSpaceRegion* unknown = nullptr
private clang::ento::CodeSpaceRegion* code = nullptr

Method Overview

  • private template <typename REG, typename ARG>const REG * LazyAllocate(REG *& region, ARG a)
  • private template <typename REG>const REG * LazyAllocate(REG *& region)
  • public MemRegionManager(clang::ASTContext & c, llvm::BumpPtrAllocator & a)
  • public const clang::ento::AllocaRegion * getAllocaRegion(const clang::Expr * Ex, unsigned int Cnt, const clang::LocationContext * LC)
  • public llvm::BumpPtrAllocator & getAllocator()
  • public const clang::ento::BlockCodeRegion * getBlockCodeRegion(const clang::BlockDecl * BD, clang::CanQualType locTy, clang::AnalysisDeclContext * AC)
  • public const clang::ento::BlockDataRegion * getBlockDataRegion(const clang::ento::BlockCodeRegion * bc, const clang::LocationContext * lc, unsigned int blockCount)
  • public const clang::ento::CXXBaseObjectRegion * getCXXBaseObjectRegion(const clang::CXXRecordDecl * BaseClass, const clang::ento::SubRegion * Super, bool IsVirtual)
  • public const clang::ento::CXXBaseObjectRegion * getCXXBaseObjectRegionWithSuper(const clang::ento::CXXBaseObjectRegion * baseReg, const clang::ento::SubRegion * superRegion)
  • public const clang::ento::CXXDerivedObjectRegion * getCXXDerivedObjectRegion(const clang::CXXRecordDecl * BaseClass, const clang::ento::SubRegion * Super)
  • public const clang::ento::CXXTempObjectRegion * getCXXStaticTempObjectRegion(const clang::Expr * Ex)
  • public const clang::ento::CXXTempObjectRegion * getCXXTempObjectRegion(const clang::Expr * Ex, const clang::LocationContext * LC)
  • public const clang::ento::CXXThisRegion * getCXXThisRegion(clang::QualType thisPointerTy, const clang::LocationContext * LC)
  • public const clang::ento::CodeSpaceRegion * getCodeRegion()
  • public const clang::ento::CompoundLiteralRegion * getCompoundLiteralRegion(const clang::CompoundLiteralExpr * CL, const clang::LocationContext * LC)
  • public const clang::ASTContext & getContext() const
  • public clang::ASTContext & getContext()
  • public const clang::ento::ElementRegion * getElementRegion(clang::QualType elementType, clang::ento::NonLoc Idx, const clang::ento::SubRegion * superRegion, clang::ASTContext & Ctx)
  • public const clang::ento::ElementRegion * getElementRegionWithSuper(const clang::ento::ElementRegion * ER, const clang::ento::SubRegion * superRegion)
  • public const clang::ento::FieldRegion * getFieldRegion(const clang::FieldDecl * fd, const clang::ento::SubRegion * superRegion)
  • public const clang::ento::FieldRegion * getFieldRegionWithSuper(const clang::ento::FieldRegion * FR, const clang::ento::SubRegion * superRegion)
  • public const clang::ento::FunctionCodeRegion * getFunctionCodeRegion(const clang::NamedDecl * FD)
  • public const clang::ento::GlobalsSpaceRegion * getGlobalsRegion(MemRegion::Kind K = MemRegion::GlobalInternalSpaceRegionKind, const clang::ento::CodeTextRegion * R = nullptr)
  • public const clang::ento::HeapSpaceRegion * getHeapRegion()
  • public const clang::ento::NonParamVarRegion * getNonParamVarRegion(const clang::VarDecl * VD, const clang::ento::MemRegion * superR)
  • public const clang::ento::ObjCIvarRegion * getObjCIvarRegion(const clang::ObjCIvarDecl * ivd, const clang::ento::SubRegion * superRegion)
  • public const clang::ento::ObjCStringRegion * getObjCStringRegion(const clang::ObjCStringLiteral * Str)
  • public const clang::ento::ParamVarRegion * getParamVarRegion(const clang::Expr * OriginExpr, unsigned int Index, const clang::LocationContext * LC)
  • public const clang::ento::StackArgumentsSpaceRegion * getStackArgumentsRegion(const clang::StackFrameContext * STC)
  • public const clang::ento::StackLocalsSpaceRegion * getStackLocalsRegion(const clang::StackFrameContext * STC)
  • public clang::ento::DefinedOrUnknownSVal getStaticSize(const clang::ento::MemRegion * MR, clang::ento::SValBuilder & SVB) const
  • public const clang::ento::StringRegion * getStringRegion(const clang::StringLiteral * Str)
  • private template <typename RegionTy, typename SuperTy, typename Arg1Ty>RegionTy * getSubRegion(const Arg1Ty arg1, const SuperTy * superRegion)
  • private template <typename RegionTy, typename SuperTy, typename Arg1Ty, typename Arg2Ty>RegionTy * getSubRegion(const Arg1Ty arg1, const Arg2Ty arg2, const SuperTy * superRegion)
  • private 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)
  • public const clang::ento::SymbolicRegion * getSymbolicHeapRegion(clang::ento::SymbolRef sym)
  • public const clang::ento::SymbolicRegion * getSymbolicRegion(clang::ento::SymbolRef Sym, const clang::ento::MemSpaceRegion * MemSpace = nullptr)
  • public const clang::ento::UnknownSpaceRegion * getUnknownRegion()
  • public const clang::ento::VarRegion * getVarRegion(const clang::VarDecl * VD, const clang::LocationContext * LC)
  • public ~MemRegionManager()

Methods

template <typename REG, typename ARG>
const REG* LazyAllocate(REG*& region, ARG a)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1542

Templates

REG
ARG

Parameters

REG*& region
ARG a

template <typename REG>
const REG* LazyAllocate(REG*& region)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1539

Templates

REG

Parameters

REG*& region

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

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1363

Parameters

clang::ASTContext& c
llvm::BumpPtrAllocator& a

const clang::ento::AllocaRegion* getAllocaRegion(
    const clang::Expr* Ex,
    unsigned int Cnt,
    const clang::LocationContext* LC)

Description

getAllocaRegion - Retrieve a region associated with a call to alloca().

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1403

Parameters

const clang::Expr* Ex
unsigned int Cnt
const clang::LocationContext* LC

llvm::BumpPtrAllocator& getAllocator()

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1369

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

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1504

Parameters

const clang::BlockDecl* BD
clang::CanQualType locTy
clang::AnalysisDeclContext* AC

const clang::ento::BlockDataRegion*
getBlockDataRegion(
    const clang::ento::BlockCodeRegion* bc,
    const clang::LocationContext* lc,
    unsigned int blockCount)

Description

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.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1512

Parameters

const clang::ento::BlockCodeRegion* bc
const clang::LocationContext* lc
unsigned int blockCount

const clang::ento::CXXBaseObjectRegion*
getCXXBaseObjectRegion(
    const clang::CXXRecordDecl* BaseClass,
    const clang::ento::SubRegion* Super,
    bool IsVirtual)

Description

Create a CXXBaseObjectRegion with the given base class for region\p Super. The type of \p Super is assumed be a class deriving from \p BaseClass.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1483

Parameters

const clang::CXXRecordDecl* BaseClass
const clang::ento::SubRegion* Super
bool IsVirtual

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

Description

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

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1489

Parameters

const clang::ento::CXXBaseObjectRegion* baseReg
const clang::ento::SubRegion* superRegion

const clang::ento::CXXDerivedObjectRegion*
getCXXDerivedObjectRegion(
    const clang::CXXRecordDecl* BaseClass,
    const clang::ento::SubRegion* Super)

Description

Create a CXXDerivedObjectRegion with the given derived class for region\p Super. This should not be used for casting an existing CXXBaseObjectRegion back to the derived type; instead, CXXBaseObjectRegion should be removed.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1500

Parameters

const clang::CXXRecordDecl* BaseClass
const clang::ento::SubRegion* Super

const clang::ento::CXXTempObjectRegion*
getCXXStaticTempObjectRegion(
    const clang::Expr* Ex)

Description

Create a CXXTempObjectRegion for temporaries which are lifetime-extended by static references. This differs from getCXXTempObjectRegion in the super-region used.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1519

Parameters

const clang::Expr* Ex

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

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1475

Parameters

const clang::Expr* Ex
const clang::LocationContext* LC

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

Description

getCXXThisRegion - Retrieve the [artificial] region associated with the parameter 'this'.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1414

Parameters

clang::QualType thisPointerTy
const clang::LocationContext* LC

const clang::ento::CodeSpaceRegion*
getCodeRegion()

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1400

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

Description

getCompoundLiteralRegion - Retrieve the region associated with a given CompoundLiteral.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1409

Parameters

const clang::CompoundLiteralExpr* CL
const clang::LocationContext* LC

const clang::ASTContext& getContext() const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1367

clang::ASTContext& getContext()

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1366

const clang::ento::ElementRegion*
getElementRegion(
    clang::QualType elementType,
    clang::ento::NonLoc Idx,
    const clang::ento::SubRegion* superRegion,
    clang::ASTContext& Ctx)

Description

getElementRegion - Retrieve the memory region associated with the associated element type, index, and super region.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1446

Parameters

clang::QualType elementType
clang::ento::NonLoc Idx
const clang::ento::SubRegion* superRegion
clang::ASTContext& Ctx

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

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1450

Parameters

const clang::ento::ElementRegion* ER
const clang::ento::SubRegion* superRegion

const clang::ento::FieldRegion* getFieldRegion(
    const clang::FieldDecl* fd,
    const clang::ento::SubRegion* superRegion)

Description

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).

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1460

Parameters

const clang::FieldDecl* fd
const clang::ento::SubRegion* superRegion

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

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1463

Parameters

const clang::ento::FieldRegion* FR
const clang::ento::SubRegion* superRegion

const clang::ento::FunctionCodeRegion*
getFunctionCodeRegion(const clang::NamedDecl* FD)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1503

Parameters

const clang::NamedDecl* FD

const clang::ento::GlobalsSpaceRegion*
getGlobalsRegion(
    MemRegion::Kind K =
        MemRegion::GlobalInternalSpaceRegionKind,
    const clang::ento::CodeTextRegion* R =
        nullptr)

Description

getGlobalsRegion - Retrieve the memory region associated with global variables.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1388

Parameters

MemRegion::Kind K = MemRegion::GlobalInternalSpaceRegionKind
const clang::ento::CodeTextRegion* R = nullptr

const clang::ento::HeapSpaceRegion*
getHeapRegion()

Description

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

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1394

const clang::ento::NonParamVarRegion*
getNonParamVarRegion(
    const clang::VarDecl* VD,
    const clang::ento::MemRegion* superR)

Description

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

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1435

Parameters

const clang::VarDecl* VD
const clang::ento::MemRegion* superR

const clang::ento::ObjCIvarRegion*
getObjCIvarRegion(
    const clang::ObjCIvarDecl* ivd,
    const clang::ento::SubRegion* superRegion)

Description

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).

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1472

Parameters

const clang::ObjCIvarDecl* ivd
const clang::ento::SubRegion* superRegion

const clang::ento::ObjCStringRegion*
getObjCStringRegion(
    const clang::ObjCStringLiteral* Str)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1427

Parameters

const clang::ObjCStringLiteral* Str

const clang::ento::ParamVarRegion*
getParamVarRegion(
    const clang::Expr* OriginExpr,
    unsigned int Index,
    const clang::LocationContext* LC)

Description

getParamVarRegion - Retrieve or create the memory region associated with a specified CallExpr, Index and LocationContext.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1440

Parameters

const clang::Expr* OriginExpr
unsigned int Index
const clang::LocationContext* LC

const clang::ento::StackArgumentsSpaceRegion*
getStackArgumentsRegion(
    const clang::StackFrameContext* STC)

Description

getStackArgumentsRegion - Retrieve the memory region associated with function/method arguments of the specified stack frame.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1384

Parameters

const clang::StackFrameContext* STC

const clang::ento::StackLocalsSpaceRegion*
getStackLocalsRegion(
    const clang::StackFrameContext* STC)

Description

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

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1379

Parameters

const clang::StackFrameContext* STC

clang::ento::DefinedOrUnknownSVal getStaticSize(
    const clang::ento::MemRegion* MR,
    clang::ento::SValBuilder& SVB) const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1373

Parameters

const clang::ento::MemRegion* MR
clang::ento::SValBuilder& SVB

Returns

The static size in bytes of the region \p MR.

const clang::ento::StringRegion* getStringRegion(
    const clang::StringLiteral* Str)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1425

Parameters

const clang::StringLiteral* Str

template <typename RegionTy,
          typename SuperTy,
          typename Arg1Ty>
RegionTy* getSubRegion(const Arg1Ty arg1,
                       const SuperTy* superRegion)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1524

Templates

RegionTy
SuperTy
Arg1Ty

Parameters

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)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1529

Templates

RegionTy
SuperTy
Arg1Ty
Arg2Ty

Parameters

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)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1534

Templates

RegionTy
SuperTy
Arg1Ty
Arg2Ty
Arg3Ty

Parameters

const Arg1Ty arg1
const Arg2Ty arg2
const Arg3Ty arg3
const SuperTy* superRegion

const clang::ento::SymbolicRegion*
getSymbolicHeapRegion(clang::ento::SymbolRef sym)

Description

Return a unique symbolic region belonging to heap memory space.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1423

Parameters

clang::ento::SymbolRef sym

const clang::ento::SymbolicRegion*
getSymbolicRegion(
    clang::ento::SymbolRef Sym,
    const clang::ento::MemSpaceRegion* MemSpace =
        nullptr)

Description

Retrieve or create a "symbolic" memory region. If no memory space is specified, `UnknownSpaceRegion` will be used.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1420

Parameters

clang::ento::SymbolRef Sym
const clang::ento::MemSpaceRegion* MemSpace = nullptr

const clang::ento::UnknownSpaceRegion*
getUnknownRegion()

Description

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

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1398

const clang::ento::VarRegion* getVarRegion(
    const clang::VarDecl* VD,
    const clang::LocationContext* LC)

Description

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

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1431

Parameters

const clang::VarDecl* VD
const clang::LocationContext* LC

~MemRegionManager()

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1364