clang API Documentation

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
clang::ento::SVal Class Reference

#include <SVals.h>

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

List of all members.

Public Types

enum  BaseKind { UndefinedKind = 0, UnknownKind = 1, LocKind = 2, NonLocKind = 3 }
enum  { BaseBits = 2, BaseMask = 0x3 }
typedef SmallVector< SVal, 5 > BufferTy
 BufferTy - A temporary buffer to hold a set of SVals.

Public Member Functions

 SVal ()
 ~SVal ()
unsigned getRawKind () const
BaseKind getBaseKind () const
unsigned getSubKind () const
void Profile (llvm::FoldingSetNodeID &ID) const
bool operator== (const SVal &R) const
bool operator!= (const SVal &R) const
bool isUnknown () const
bool isUndef () const
bool isUnknownOrUndef () const
bool isValid () const
bool isConstant () const
bool isConstant (int I) const
bool isZeroConstant () const
bool hasConjuredSymbol () const
 hasConjuredSymbol - If this SVal wraps a conjured symbol, return true;
const FunctionDeclgetAsFunctionDecl () const
SymbolRef getAsLocSymbol () const
SymbolRef getLocSymbolInBase () const
 Get the symbol in the SVal or its base region.
SymbolRef getAsSymbol () const
 If this SVal wraps a symbol return that SymbolRef. Otherwise return 0.
const SymExprgetAsSymbolicExpression () const
const SymExprgetAsSymExpr () const
const MemRegiongetAsRegion () const
void dumpToStream (raw_ostream &OS) const
void dump () const
SymExpr::symbol_iterator symbol_begin () const
SymExpr::symbol_iterator symbol_end () const

Static Public Member Functions

static bool classof (const SVal *)

Protected Member Functions

 SVal (const void *d, bool isLoc, unsigned ValKind)
 SVal (BaseKind k, const void *D=NULL)

Protected Attributes

const void * Data
unsigned Kind

Detailed Description

SVal - This represents a symbolic expression, which can be either an L-value or an R-value.

Definition at line 44 of file SVals.h.


Member Typedef Documentation

typedef SmallVector<SVal,5> clang::ento::SVal::BufferTy

BufferTy - A temporary buffer to hold a set of SVals.

Definition at line 74 of file SVals.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
BaseBits 
BaseMask 

Definition at line 54 of file SVals.h.

Enumerator:
UndefinedKind 
UnknownKind 
LocKind 
NonLocKind 

Definition at line 46 of file SVals.h.


Constructor & Destructor Documentation

clang::ento::SVal::SVal ( const void *  d,
bool  isLoc,
unsigned  ValKind 
) [inline, explicit, protected]

Definition at line 63 of file SVals.h.

clang::ento::SVal::SVal ( BaseKind  k,
const void *  D = NULL 
) [inline, explicit, protected]

Definition at line 66 of file SVals.h.

clang::ento::SVal::SVal ( ) [inline, explicit]

Definition at line 70 of file SVals.h.

clang::ento::SVal::~SVal ( ) [inline]

Definition at line 71 of file SVals.h.


Member Function Documentation

static bool clang::ento::SVal::classof ( const SVal ) [inline, static]
void clang::ento::SVal::dump ( ) const
void clang::ento::SVal::dumpToStream ( raw_ostream &  OS) const

Reimplemented in clang::ento::Loc, and clang::ento::NonLoc.

Referenced by llvm::operator<<().

const FunctionDecl * SVal::getAsFunctionDecl ( ) const

getAsFunctionDecl - If this SVal is a MemRegionVal and wraps a CodeTextRegion wrapping a FunctionDecl, return that FunctionDecl. Otherwise return 0.

Definition at line 50 of file SVals.cpp.

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

Referenced by clang::ento::CheckerContext::getCalleeDecl(), and clang::ento::ExprEngine::VisitCallExpr().

SymbolRef SVal::getAsLocSymbol ( ) const

If this SVal is a location (subclasses Loc) and wraps a symbol, return that SymbolRef. Otherwise return 0.

Implicit casts (ex: void* -> char*) can turn Symbolic region into Element region. If that is the case, gets the underlining region.

Definition at line 65 of file SVals.cpp.

Referenced by getAsSymbol(), clang::ento::StackHintGeneratorForSymbol::getMessage(), and clang::ento::StoreManager::FindUniqueBinding::HandleBinding().

const MemRegion * SVal::getAsRegion ( ) const
SymbolRef SVal::getAsSymbol ( ) const

If this SVal wraps a symbol return that SymbolRef. Otherwise return 0.

If this SVal wraps a symbol return that SymbolRef. Otherwise, return 0.

Definition at line 101 of file SVals.cpp.

References getAsLocSymbol().

Referenced by getAsSymbolicExpression(), getAsSymExpr(), clang::ento::BugReport::markInteresting(), and clang::ento::ScanReachableSymbols::scan().

const SymExpr * SVal::getAsSymbolicExpression ( ) const

getAsSymbolicExpression - If this Sval wraps a symbolic expression then return that expression. Otherwise return NULL.

Definition at line 111 of file SVals.cpp.

References getAsSymbol().

Referenced by getAsSymExpr(), clang::ento::ScanReachableSymbols::scan(), and symbol_begin().

const SymExpr * SVal::getAsSymExpr ( ) const
BaseKind clang::ento::SVal::getBaseKind ( ) const [inline]
SymbolRef SVal::getLocSymbolInBase ( ) const

Get the symbol in the SVal or its base region.

Definition at line 79 of file SVals.cpp.

References clang::ento::loc::MemRegionVal::getRegion().

unsigned clang::ento::SVal::getRawKind ( ) const [inline]

Definition at line 76 of file SVals.h.

References Kind.

Referenced by isUndef(), isUnknown(), isUnknownOrUndef(), isValid(), operator==(), and Profile().

unsigned clang::ento::SVal::getSubKind ( ) const [inline]
bool SVal::hasConjuredSymbol ( ) const

hasConjuredSymbol - If this SVal wraps a conjured symbol, return true;

Definition at line 31 of file SVals.cpp.

bool clang::ento::SVal::isConstant ( ) const
bool clang::ento::SVal::isConstant ( int  I) const
bool clang::ento::SVal::isUndef ( ) const [inline]
bool clang::ento::SVal::isUnknown ( ) const [inline]
bool clang::ento::SVal::isUnknownOrUndef ( ) const [inline]
bool clang::ento::SVal::isValid ( ) const [inline]
bool SVal::isZeroConstant ( ) const

Definition at line 178 of file SVals.cpp.

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

bool clang::ento::SVal::operator!= ( const SVal R) const [inline]

Definition at line 91 of file SVals.h.

bool clang::ento::SVal::operator== ( const SVal R) const [inline]

Definition at line 87 of file SVals.h.

References Data, and getRawKind().

void clang::ento::SVal::Profile ( llvm::FoldingSetNodeID &  ID) const [inline]
SymExpr::symbol_iterator clang::ento::SVal::symbol_begin ( ) const [inline]

Definition at line 147 of file SVals.h.

References getAsSymbolicExpression(), and clang::ento::SymExpr::symbol_begin().

SymExpr::symbol_iterator clang::ento::SVal::symbol_end ( ) const [inline]

Definition at line 155 of file SVals.h.


Member Data Documentation

const void* clang::ento::SVal::Data [protected]
unsigned clang::ento::SVal::Kind [protected]

The lowest 2 bits are a BaseKind (0 -- 3). The higher bits are an unsigned "kind" value.

Definition at line 61 of file SVals.h.

Referenced by getRawKind().


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