clang  3.9.0svn
Public Types | Public Member Functions | Protected Member Functions | List of all members
clang::ento::MemRegion Class Referenceabstract

MemRegion - The root abstract class for all memory regions. More...

#include <MemRegion.h>

Inheritance diagram for clang::ento::MemRegion:
Inheritance graph
[legend]
Collaboration diagram for clang::ento::MemRegion:
Collaboration graph
[legend]

Public Types

enum  Kind
 

Public Member Functions

ASTContextgetContext () const
 
virtual void Profile (llvm::FoldingSetNodeID &ID) const =0
 
virtual MemRegionManagergetMemRegionManager () const =0
 
const MemSpaceRegiongetMemorySpace () const
 
const MemRegiongetBaseRegion () const
 
virtual bool isSubRegionOf (const MemRegion *R) const
 Check if the region is a subregion of the given region. More...
 
const MemRegionStripCasts (bool StripBaseCasts=true) const
 
const SymbolicRegiongetSymbolicBase () const
 If this is a symbolic region, returns the region. More...
 
bool hasGlobalsOrParametersStorage () const
 
bool hasStackStorage () const
 
bool hasStackNonParametersStorage () const
 
bool hasStackParametersStorage () const
 
RegionOffset getAsOffset () const
 Compute the offset within the top level memory object. More...
 
std::string getString () const
 Get a string representation of a region for debug use. More...
 
virtual void dumpToStream (raw_ostream &os) const
 
void dump () const
 
virtual bool canPrintPretty () const
 Returns true if this region can be printed in a user-friendly way. More...
 
virtual void printPretty (raw_ostream &os) const
 Print the region for use in diagnostics. More...
 
virtual bool canPrintPrettyAsExpr () const
 Returns true if this region's textual representation can be used as part of a larger expression. More...
 
virtual void printPrettyAsExpr (raw_ostream &os) const
 Print the region as expression. More...
 
Kind getKind () const
 
template<typename RegionTy >
const RegionTy * getAs () const
 
virtual bool isBoundable () const
 

Protected Member Functions

 MemRegion (Kind k)
 
virtual ~MemRegion ()
 

Detailed Description

MemRegion - The root abstract class for all memory regions.

Definition at line 79 of file MemRegion.h.

Member Enumeration Documentation

Definition at line 81 of file MemRegion.h.

Constructor & Destructor Documentation

clang::ento::MemRegion::MemRegion ( Kind  k)
inlineprotected

Definition at line 91 of file MemRegion.h.

References dump().

MemRegion::~MemRegion ( )
protectedvirtual

Definition at line 134 of file MemRegion.cpp.

Member Function Documentation

bool MemRegion::canPrintPretty ( ) const
virtual

Returns true if this region can be printed in a user-friendly way.

Reimplemented in clang::ento::FieldRegion.

Definition at line 568 of file MemRegion.cpp.

Referenced by didPreviousFreeFail(), and clang::ento::FindLastStoreBRVisitor::VisitNode().

bool MemRegion::canPrintPrettyAsExpr ( ) const
virtual

Returns true if this region's textual representation can be used as part of a larger expression.

Reimplemented in clang::ento::CXXBaseObjectRegion, clang::ento::ObjCIvarRegion, clang::ento::FieldRegion, and clang::ento::VarRegion.

Definition at line 572 of file MemRegion.cpp.

Referenced by clang::ento::FieldRegion::canPrintPrettyAsExpr(), and clang::ento::CXXBaseObjectRegion::canPrintPrettyAsExpr().

LLVM_DUMP_METHOD void MemRegion::dump ( ) const

Definition at line 437 of file MemRegion.cpp.

void MemRegion::dumpToStream ( raw_ostream &  os) const
virtual
template<typename RegionTy >
const RegionTy * clang::ento::MemRegion::getAs ( ) const
RegionOffset MemRegion::getAsOffset ( ) const

Compute the offset within the top level memory object.

Definition at line 1187 of file MemRegion.cpp.

References distance(), clang::RecordDecl::field_begin(), clang::RecordDecl::field_end(), clang::ento::MemRegionManager::getAllocator(), clang::ento::SVal::getAs(), clang::Type::getAsCXXRecordDecl(), clang::ASTContext::getASTRecordLayout(), clang::ASTRecordLayout::getBaseClassOffset(), clang::ASTContext::getCharWidth(), clang::ento::MemRegionManager::getCodeRegion(), clang::ento::MemRegionManager::getContext(), clang::ento::FieldRegion::getDecl(), clang::ento::CXXBaseObjectRegion::getDecl(), clang::ASTRecordLayout::getFieldOffset(), clang::ento::ElementRegion::getIndex(), getKind(), clang::FieldDecl::getParent(), clang::Type::getPointeeType(), clang::CharUnits::getQuantity(), clang::AnalysisDeclContext::getReferencedBlockVars(), clang::ento::SubRegion::getSuperRegion(), clang::ASTContext::getTypeSize(), clang::ento::MemRegionManager::getUnknownRegion(), clang::ento::ElementRegion::getValueType(), clang::ento::MemRegionManager::getVarRegion(), clang::ASTRecordLayout::getVBaseClassOffset(), clang::Decl::hasAttr(), clang::VarDecl::hasLocalStorage(), clang::TagDecl::isCompleteDefinition(), isImmediateBase(), clang::Type::isIncompleteType(), clang::TagDecl::isUnion(), clang::ento::CXXBaseObjectRegion::isVirtual(), clang::CXXRecordDecl::isVirtuallyDerivedFrom(), and clang::ento::RegionOffset::Symbolic.

Referenced by collectSubRegionBindings(), didPreviousFreeFail(), and evalBinOpFieldRegionFieldRegion().

const MemRegion * MemRegion::getBaseRegion ( ) const
ASTContext & clang::ento::MemRegion::getContext ( ) const
inline
Kind clang::ento::MemRegion::getKind ( ) const
inline

Definition at line 148 of file MemRegion.h.

Referenced by addValue(), clang::ento::StoreManager::castRegion(), clang::ento::MemSpaceRegion::classof(), clang::ento::CodeSpaceRegion::classof(), clang::ento::GlobalsSpaceRegion::classof(), clang::ento::StaticGlobalSpaceRegion::classof(), clang::ento::NonStaticGlobalSpaceRegion::classof(), clang::ento::GlobalSystemSpaceRegion::classof(), clang::ento::GlobalImmutableSpaceRegion::classof(), clang::ento::GlobalInternalSpaceRegion::classof(), clang::ento::HeapSpaceRegion::classof(), clang::ento::UnknownSpaceRegion::classof(), clang::ento::StackSpaceRegion::classof(), clang::ento::StackLocalsSpaceRegion::classof(), clang::ento::StackArgumentsSpaceRegion::classof(), clang::ento::SubRegion::classof(), clang::ento::AllocaRegion::classof(), clang::ento::TypedRegion::classof(), clang::ento::TypedValueRegion::classof(), clang::ento::CodeTextRegion::classof(), clang::ento::FunctionCodeRegion::classof(), clang::ento::BlockCodeRegion::classof(), clang::ento::BlockDataRegion::classof(), clang::ento::SymbolicRegion::classof(), clang::ento::StringRegion::classof(), clang::ento::ObjCStringRegion::classof(), clang::ento::CompoundLiteralRegion::classof(), clang::ento::DeclRegion::classof(), clang::ento::VarRegion::classof(), clang::ento::CXXThisRegion::classof(), clang::ento::FieldRegion::classof(), clang::ento::ObjCIvarRegion::classof(), clang::ento::ElementRegion::classof(), clang::ento::CXXTempObjectRegion::classof(), clang::ento::CXXBaseObjectRegion::classof(), computeExtentBegin(), didPreviousFreeFail(), getAsOffset(), getBaseRegion(), llvm::FoldingSetTrait< AllocKind >::Profile(), StripCasts(), and clang::ento::MemRegionVisitor< SValExplainer, std::string >::Visit().

const MemSpaceRegion * MemRegion::getMemorySpace ( ) const
virtual MemRegionManager* clang::ento::MemRegion::getMemRegionManager ( ) const
pure virtual
std::string MemRegion::getString ( ) const

Get a string representation of a region for debug use.

Definition at line 441 of file MemRegion.cpp.

Referenced by clang::ento::SValExplainer::VisitStringRegion().

const SymbolicRegion * MemRegion::getSymbolicBase ( ) const

If this is a symbolic region, returns the region.

Otherwise, goes up the base chain looking for the first symbolic base region.

Definition at line 1118 of file MemRegion.cpp.

References clang::ento::SubRegion::getSuperRegion().

Referenced by clang::ento::createSimpleSValBuilder(), clang::ento::ProgramStateTrait< SymbolSet >::GDMIndex(), and clang::ento::SVal::getAsLocSymbol().

bool MemRegion::hasGlobalsOrParametersStorage ( ) const

Definition at line 1062 of file MemRegion.cpp.

bool MemRegion::hasStackNonParametersStorage ( ) const

Definition at line 1054 of file MemRegion.cpp.

Referenced by collectSubRegionBindings(), and getExistingLazyBinding().

bool MemRegion::hasStackParametersStorage ( ) const

Definition at line 1058 of file MemRegion.cpp.

bool MemRegion::hasStackStorage ( ) const

Definition at line 1050 of file MemRegion.cpp.

virtual bool clang::ento::MemRegion::isBoundable ( ) const
inlinevirtual
bool MemRegion::isSubRegionOf ( const MemRegion R) const
virtual

Check if the region is a subregion of the given region.

Reimplemented in clang::ento::SubRegion.

Definition at line 1088 of file MemRegion.cpp.

Referenced by collectSubRegionBindings(), and clang::ento::UndefOrNullArgVisitor::VisitNode().

void MemRegion::printPretty ( raw_ostream &  os) const
virtual

Print the region for use in diagnostics.

Reimplemented in clang::ento::FieldRegion.

Definition at line 576 of file MemRegion.cpp.

Referenced by didPreviousFreeFail().

void MemRegion::printPrettyAsExpr ( raw_ostream &  os) const
virtual

Print the region as expression.

When this region represents a subexpression, the method is for printing an expression containing it.

Reimplemented in clang::ento::CXXBaseObjectRegion, clang::ento::ObjCIvarRegion, clang::ento::FieldRegion, and clang::ento::VarRegion.

Definition at line 583 of file MemRegion.cpp.

Referenced by clang::ento::FieldRegion::printPrettyAsExpr(), and clang::ento::CXXBaseObjectRegion::printPrettyAsExpr().

virtual void clang::ento::MemRegion::Profile ( llvm::FoldingSetNodeID &  ID) const
pure virtual
const MemRegion * MemRegion::StripCasts ( bool  StripBaseCasts = true) const

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