clang 22.0.0git
clang::ento::ElementRegion Class Reference

ElementRegion is used to represent both array elements and casts. More...

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

Inheritance diagram for clang::ento::ElementRegion:
[legend]

Public Member Functions

NonLoc getIndex () const
QualType getValueType () const override
QualType getElementType () const
RegionRawOffset getAsArrayOffset () const
 Compute the offset within the array. The array might also be a subobject.
void dumpToStream (raw_ostream &os) const override
void Profile (llvm::FoldingSetNodeID &ID) const override
Public Member Functions inherited from clang::ento::TypedValueRegion
QualType getLocationType () const override
QualType getDesugaredValueType (ASTContext &Context) const
Public Member Functions inherited from clang::ento::TypedRegion
QualType getDesugaredLocationType (ASTContext &Context) const
bool isBoundable () const override
Public Member Functions inherited from clang::ento::SubRegion
LLVM_ATTRIBUTE_RETURNS_NONNULL const MemRegiongetSuperRegion () const
MemRegionManagergetMemRegionManager () const override
bool isSubRegionOf (const MemRegion *R) const override
 Check if the region is a subregion of the given region.
Public Member Functions inherited from clang::ento::MemRegion
ASTContextgetContext () const
LLVM_ATTRIBUTE_RETURNS_NONNULL const MemSpaceRegiongetRawMemorySpace () const
 Deprecated.
template<class MemSpace>
const MemSpace * getRawMemorySpaceAs () const
 Deprecated. Use getMemorySpace(ProgramStateRef) instead.
LLVM_ATTRIBUTE_RETURNS_NONNULL const MemSpaceRegiongetMemorySpace (ProgramStateRef State) const
 Returns the most specific memory space for this memory region in the given ProgramStateRef.
template<class MemSpace>
const MemSpace * getMemorySpaceAs (ProgramStateRef State) const
template<typename... MemorySpaces>
bool hasMemorySpace (ProgramStateRef State) const
ProgramStateRef setMemorySpace (ProgramStateRef State, const MemSpaceRegion *Space) const
 Set the dynamically deduced memory space of a MemRegion that currently has UnknownSpaceRegion.
LLVM_ATTRIBUTE_RETURNS_NONNULL const MemRegiongetBaseRegion () const
LLVM_ATTRIBUTE_RETURNS_NONNULL const MemRegiongetMostDerivedObjectRegion () const
 Recursively retrieve the region of the most derived class instance of regions of C++ base class instances.
LLVM_ATTRIBUTE_RETURNS_NONNULL const MemRegionStripCasts (bool StripBaseAndDerivedCasts=true) const
const SymbolicRegiongetSymbolicBase () const
 If this is a symbolic region, returns the region.
RegionOffset getAsOffset () const
 Compute the offset within the top level memory object.
std::string getString () const
 Get a string representation of a region for debug use.
void dump () const
virtual bool canPrintPretty () const
 Returns true if this region can be printed in a user-friendly way.
virtual void printPretty (raw_ostream &os) const
 Print the region for use in diagnostics.
virtual bool canPrintPrettyAsExpr () const
 Returns true if this region's textual representation can be used as part of a larger expression.
virtual void printPrettyAsExpr (raw_ostream &os) const
 Print the region as expression.
Kind getKind () const
StringRef getKindStr () const
template<typename RegionTy>
const RegionTy * getAs () const
template<typename RegionTy>
LLVM_ATTRIBUTE_RETURNS_NONNULL const RegionTy * castAs () const
std::string getDescriptiveName (bool UseQuotes=true) const
 Get descriptive name for memory region.
SourceRange sourceRange () const
 Retrieve source range from memory region.

Static Public Member Functions

static bool classof (const MemRegion *R)
Static Public Member Functions inherited from clang::ento::TypedValueRegion
static bool classof (const MemRegion *R)
Static Public Member Functions inherited from clang::ento::TypedRegion
static bool classof (const MemRegion *R)
Static Public Member Functions inherited from clang::ento::SubRegion
static bool classof (const MemRegion *R)

Friends

class MemRegionManager

Additional Inherited Members

Public Types inherited from clang::ento::MemRegion
enum  Kind
Protected Member Functions inherited from clang::ento::TypedValueRegion
 TypedValueRegion (const MemRegion *sReg, Kind k)
Protected Member Functions inherited from clang::ento::TypedRegion
 TypedRegion (const MemRegion *sReg, Kind k)
Protected Member Functions inherited from clang::ento::SubRegion
 SubRegion (const MemRegion *sReg, Kind k)
Protected Member Functions inherited from clang::ento::MemRegion
 MemRegion (Kind k)
virtual ~MemRegion ()
Protected Attributes inherited from clang::ento::SubRegion
const MemRegionsuperRegion

Detailed Description

ElementRegion is used to represent both array elements and casts.

Definition at line 1227 of file MemRegion.h.

Member Function Documentation

◆ classof()

bool clang::ento::ElementRegion::classof ( const MemRegion * R)
inlinestatic

Definition at line 1260 of file MemRegion.h.

References clang::ento::MemRegion::getKind().

◆ dumpToStream()

void ElementRegion::dumpToStream ( raw_ostream & os) const
overridevirtual

Reimplemented from clang::ento::MemRegion.

Definition at line 542 of file MemRegion.cpp.

References getElementType(), and clang::ento::SubRegion::superRegion.

◆ getAsArrayOffset()

RegionRawOffset ElementRegion::getAsArrayOffset ( ) const

◆ getElementType()

QualType clang::ento::ElementRegion::getElementType ( ) const
inline

◆ getIndex()

◆ getValueType()

QualType clang::ento::ElementRegion::getValueType ( ) const
inlineoverridevirtual

Implements clang::ento::TypedValueRegion.

Definition at line 1249 of file MemRegion.h.

Referenced by getIndex(), and isArrayIndexOutOfBounds().

◆ Profile()

void ElementRegion::Profile ( llvm::FoldingSetNodeID & ID) const
overridevirtual

Implements clang::ento::MemRegion.

Definition at line 360 of file MemRegion.cpp.

References clang::ento::SubRegion::superRegion.

◆ MemRegionManager

friend class MemRegionManager
friend

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