clang API Documentation

Public Member Functions | Protected Member Functions | Protected Attributes
clang::ento::SValBuilder Class Reference

#include <SValBuilder.h>

Collaboration diagram for clang::ento::SValBuilder:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual SVal dispatchCast (SVal val, QualType castTy)=0
 SValBuilder (llvm::BumpPtrAllocator &alloc, ASTContext &context, ProgramStateManager &stateMgr)
virtual ~SValBuilder ()
bool haveSameType (const SymExpr *Sym1, const SymExpr *Sym2)
bool haveSameType (QualType Ty1, QualType Ty2)
SVal evalCast (SVal val, QualType castTy, QualType originalType)
virtual SVal evalMinus (NonLoc val)=0
virtual SVal evalComplement (NonLoc val)=0
virtual SVal evalBinOpNN (ProgramStateRef state, BinaryOperator::Opcode op, NonLoc lhs, NonLoc rhs, QualType resultTy)=0
virtual SVal evalBinOpLL (ProgramStateRef state, BinaryOperator::Opcode op, Loc lhs, Loc rhs, QualType resultTy)=0
virtual SVal evalBinOpLN (ProgramStateRef state, BinaryOperator::Opcode op, Loc lhs, NonLoc rhs, QualType resultTy)=0
virtual const llvm::APSInt * getKnownValue (ProgramStateRef state, SVal val)=0
SVal makeSymExprValNN (ProgramStateRef state, BinaryOperator::Opcode op, NonLoc lhs, NonLoc rhs, QualType resultTy)
 Constructs a symbolic expression for two non-location values.
SVal evalBinOp (ProgramStateRef state, BinaryOperator::Opcode op, SVal lhs, SVal rhs, QualType type)
DefinedOrUnknownSVal evalEQ (ProgramStateRef state, DefinedOrUnknownSVal lhs, DefinedOrUnknownSVal rhs)
ASTContextgetContext ()
const ASTContextgetContext () const
ProgramStateManagergetStateManager ()
QualType getConditionType () const
QualType getArrayIndexType () const
BasicValueFactorygetBasicValueFactory ()
const BasicValueFactorygetBasicValueFactory () const
SymbolManagergetSymbolManager ()
const SymbolManagergetSymbolManager () const
MemRegionManagergetRegionManager ()
const MemRegionManagergetRegionManager () const
const SymbolConjuredconjureSymbol (const Stmt *stmt, const LocationContext *LCtx, QualType type, unsigned visitCount, const void *symbolTag=nullptr)
const SymbolConjuredconjureSymbol (const Expr *expr, const LocationContext *LCtx, unsigned visitCount, const void *symbolTag=nullptr)
DefinedOrUnknownSVal makeZeroVal (QualType type)
 Construct an SVal representing '0' for the specified type.
DefinedOrUnknownSVal getRegionValueSymbolVal (const TypedValueRegion *region)
 Make a unique symbol for value of region.
DefinedOrUnknownSVal conjureSymbolVal (const void *symbolTag, const Expr *expr, const LocationContext *LCtx, unsigned count)
 Create a new symbol with a unique 'name'.
DefinedOrUnknownSVal conjureSymbolVal (const void *symbolTag, const Expr *expr, const LocationContext *LCtx, QualType type, unsigned count)
DefinedOrUnknownSVal conjureSymbolVal (const Stmt *stmt, const LocationContext *LCtx, QualType type, unsigned visitCount)
DefinedOrUnknownSVal getConjuredHeapSymbolVal (const Expr *E, const LocationContext *LCtx, unsigned Count)
 Conjure a symbol representing heap allocated memory region.
DefinedOrUnknownSVal getDerivedRegionValueSymbolVal (SymbolRef parentSymbol, const TypedValueRegion *region)
DefinedSVal getMetadataSymbolVal (const void *symbolTag, const MemRegion *region, const Expr *expr, QualType type, unsigned count)
DefinedSVal getFunctionPointer (const FunctionDecl *func)
DefinedSVal getBlockPointer (const BlockDecl *block, CanQualType locTy, const LocationContext *locContext, unsigned blockCount)
Optional< SValgetConstantVal (const Expr *E)
NonLoc makeCompoundVal (QualType type, llvm::ImmutableList< SVal > vals)
NonLoc makeLazyCompoundVal (const StoreRef &store, const TypedValueRegion *region)
NonLoc makeZeroArrayIndex ()
NonLoc makeArrayIndex (uint64_t idx)
SVal convertToArrayIndex (SVal val)
nonloc::ConcreteInt makeIntVal (const IntegerLiteral *integer)
nonloc::ConcreteInt makeBoolVal (const ObjCBoolLiteralExpr *boolean)
nonloc::ConcreteInt makeBoolVal (const CXXBoolLiteralExpr *boolean)
nonloc::ConcreteInt makeIntVal (const llvm::APSInt &integer)
loc::ConcreteInt makeIntLocVal (const llvm::APSInt &integer)
NonLoc makeIntVal (const llvm::APInt &integer, bool isUnsigned)
DefinedSVal makeIntVal (uint64_t integer, QualType type)
NonLoc makeIntVal (uint64_t integer, bool isUnsigned)
NonLoc makeIntValWithPtrWidth (uint64_t integer, bool isUnsigned)
NonLoc makeLocAsInteger (Loc loc, unsigned bits)
NonLoc makeNonLoc (const SymExpr *lhs, BinaryOperator::Opcode op, const llvm::APSInt &rhs, QualType type)
NonLoc makeNonLoc (const llvm::APSInt &rhs, BinaryOperator::Opcode op, const SymExpr *lhs, QualType type)
NonLoc makeNonLoc (const SymExpr *lhs, BinaryOperator::Opcode op, const SymExpr *rhs, QualType type)
NonLoc makeNonLoc (const SymExpr *operand, QualType fromTy, QualType toTy)
 Create a NonLoc value for cast.
nonloc::ConcreteInt makeTruthVal (bool b, QualType type)
nonloc::ConcreteInt makeTruthVal (bool b)
Loc makeNull ()
Loc makeLoc (SymbolRef sym)
Loc makeLoc (const MemRegion *region)
Loc makeLoc (const AddrLabelExpr *expr)
Loc makeLoc (const llvm::APSInt &integer)
loc::MemRegionVal getCXXThis (const CXXMethodDecl *D, const StackFrameContext *SFC)
 Return a memory region for the 'this' object reference.
loc::MemRegionVal getCXXThis (const CXXRecordDecl *D, const StackFrameContext *SFC)
 Return a memory region for the 'this' object reference.

Protected Member Functions

virtual SVal evalCastFromNonLoc (NonLoc val, QualType castTy)=0
virtual SVal evalCastFromLoc (Loc val, QualType castTy)=0

Protected Attributes

ASTContextContext
BasicValueFactory BasicVals
 Manager of APSInt values.
SymbolManager SymMgr
 Manages the creation of symbols.
MemRegionManager MemMgr
 Manages the creation of memory regions.
ProgramStateManagerStateMgr
const QualType ArrayIndexTy
 The scalar type to use for array indices.
const unsigned ArrayIndexWidth
 The width of the scalar type used for array indices.

Detailed Description

Definition at line 31 of file SValBuilder.h.


Constructor & Destructor Documentation

clang::ento::SValBuilder::SValBuilder ( llvm::BumpPtrAllocator &  alloc,
ASTContext context,
ProgramStateManager stateMgr 
) [inline]

Definition at line 62 of file SValBuilder.h.

virtual clang::ento::SValBuilder::~SValBuilder ( ) [inline, virtual]

Definition at line 71 of file SValBuilder.h.


Member Function Documentation

const SymbolConjured* clang::ento::SValBuilder::conjureSymbol ( const Stmt stmt,
const LocationContext LCtx,
QualType  type,
unsigned  visitCount,
const void *  symbolTag = nullptr 
) [inline]

Definition at line 145 of file SValBuilder.h.

References clang::ento::SymbolManager::conjureSymbol(), and SymMgr.

const SymbolConjured* clang::ento::SValBuilder::conjureSymbol ( const Expr expr,
const LocationContext LCtx,
unsigned  visitCount,
const void *  symbolTag = nullptr 
) [inline]

Definition at line 153 of file SValBuilder.h.

References clang::ento::SymbolManager::conjureSymbol(), and SymMgr.

DefinedOrUnknownSVal SValBuilder::conjureSymbolVal ( const void *  symbolTag,
const Expr expr,
const LocationContext LCtx,
unsigned  count 
)
DefinedOrUnknownSVal SValBuilder::conjureSymbolVal ( const void *  symbolTag,
const Expr expr,
const LocationContext LCtx,
QualType  type,
unsigned  count 
)
DefinedOrUnknownSVal SValBuilder::conjureSymbolVal ( const Stmt stmt,
const LocationContext LCtx,
QualType  type,
unsigned  visitCount 
)
virtual SVal clang::ento::SValBuilder::dispatchCast ( SVal  val,
QualType  castTy 
) [pure virtual]
virtual SVal clang::ento::SValBuilder::evalBinOpLL ( ProgramStateRef  state,
BinaryOperator::Opcode  op,
Loc  lhs,
Loc  rhs,
QualType  resultTy 
) [pure virtual]

Create a new value which represents a binary expression with two memory location operands.

Referenced by evalBinOp().

virtual SVal clang::ento::SValBuilder::evalBinOpLN ( ProgramStateRef  state,
BinaryOperator::Opcode  op,
Loc  lhs,
NonLoc  rhs,
QualType  resultTy 
) [pure virtual]

Create a new value which represents a binary expression with a memory location and non-location operands. For example, this would be used to evaluate a pointer arithmetic operation.

Referenced by evalBinOp().

virtual SVal clang::ento::SValBuilder::evalBinOpNN ( ProgramStateRef  state,
BinaryOperator::Opcode  op,
NonLoc  lhs,
NonLoc  rhs,
QualType  resultTy 
) [pure virtual]

Create a new value which represents a binary expression with two non- location operands.

Referenced by addValue(), clang::ento::ProgramState::assumeInBound(), evalBinOp(), clang::ento::ExprEngine::evalBinOp(), and scaleValue().

SVal SValBuilder::evalCast ( SVal  val,
QualType  castTy,
QualType  originalType 
)
virtual SVal clang::ento::SValBuilder::evalCastFromLoc ( Loc  val,
QualType  castTy 
) [protected, pure virtual]

Referenced by evalCast().

virtual SVal clang::ento::SValBuilder::evalCastFromNonLoc ( NonLoc  val,
QualType  castTy 
) [protected, pure virtual]

Referenced by convertToArrayIndex().

virtual SVal clang::ento::SValBuilder::evalComplement ( NonLoc  val) [pure virtual]
virtual SVal clang::ento::SValBuilder::evalMinus ( NonLoc  val) [pure virtual]

Definition at line 135 of file SValBuilder.h.

References BasicVals.

DefinedSVal SValBuilder::getBlockPointer ( const BlockDecl block,
CanQualType  locTy,
const LocationContext locContext,
unsigned  blockCount 
)

Conjure a symbol representing heap allocated memory region.

Note, the expression should represent a location.

Definition at line 157 of file SValBuilder.cpp.

References clang::ento::SymbolManager::canSymbolicate(), clang::ento::SymbolManager::conjureSymbol(), clang::ento::MemRegionManager::getSymbolicHeapRegion(), clang::Expr::getType(), clang::ento::Loc::isLocType(), MemMgr, and SymMgr.

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

Optional< SVal > SValBuilder::getConstantVal ( const Expr E)

Definition at line 122 of file SValBuilder.h.

References Context.

Return a memory region for the 'this' object reference.

Definition at line 222 of file SValBuilder.cpp.

References getContext(), clang::ASTContext::getPointerType(), getRegionManager(), and clang::TypeDecl::getTypeForDecl().

virtual const llvm::APSInt* clang::ento::SValBuilder::getKnownValue ( ProgramStateRef  state,
SVal  val 
) [pure virtual]

Evaluates a given SVal. If the SVal has only one possible (integer) value, that value is returned. Otherwise, returns NULL.

DefinedSVal SValBuilder::getMetadataSymbolVal ( const void *  symbolTag,
const MemRegion region,
const Expr expr,
QualType  type,
unsigned  count 
)

Definition at line 141 of file SValBuilder.h.

References MemMgr.

Definition at line 138 of file SValBuilder.h.

References SymMgr.

bool clang::ento::SValBuilder::haveSameType ( const SymExpr Sym1,
const SymExpr Sym2 
) [inline]

Definition at line 73 of file SValBuilder.h.

References clang::ento::SymExpr::getType().

Definition at line 238 of file SValBuilder.h.

References clang::ObjCBoolLiteralExpr::getValue(), and makeTruthVal().

Referenced by getConstantVal().

Definition at line 90 of file SValBuilder.cpp.

References clang::CXXBoolLiteralExpr::getValue(), and makeTruthVal().

NonLoc clang::ento::SValBuilder::makeCompoundVal ( QualType  type,
llvm::ImmutableList< SVal vals 
) [inline]
loc::ConcreteInt clang::ento::SValBuilder::makeIntLocVal ( const llvm::APSInt &  integer) [inline]

Definition at line 248 of file SValBuilder.h.

References BasicVals.

nonloc::ConcreteInt clang::ento::SValBuilder::makeIntVal ( const llvm::APSInt &  integer) [inline]

Definition at line 244 of file SValBuilder.h.

References BasicVals.

NonLoc clang::ento::SValBuilder::makeIntVal ( const llvm::APInt &  integer,
bool  isUnsigned 
) [inline]

Definition at line 252 of file SValBuilder.h.

References BasicVals.

DefinedSVal clang::ento::SValBuilder::makeIntVal ( uint64_t  integer,
QualType  type 
) [inline]

Definition at line 256 of file SValBuilder.h.

References BasicVals, and clang::ento::Loc::isLocType().

NonLoc clang::ento::SValBuilder::makeIntVal ( uint64_t  integer,
bool  isUnsigned 
) [inline]

Definition at line 263 of file SValBuilder.h.

References BasicVals, and clang::ento::BasicValueFactory::getIntValue().

NonLoc clang::ento::SValBuilder::makeIntValWithPtrWidth ( uint64_t  integer,
bool  isUnsigned 
) [inline]
NonLoc clang::ento::SValBuilder::makeLazyCompoundVal ( const StoreRef store,
const TypedValueRegion region 
) [inline]
Loc clang::ento::SValBuilder::makeLoc ( const MemRegion region) [inline]

Definition at line 304 of file SValBuilder.h.

Definition at line 308 of file SValBuilder.h.

References clang::AddrLabelExpr::getLabel().

Loc clang::ento::SValBuilder::makeLoc ( const llvm::APSInt &  integer) [inline]

Definition at line 312 of file SValBuilder.h.

References BasicVals.

NonLoc SValBuilder::makeNonLoc ( const SymExpr lhs,
BinaryOperator::Opcode  op,
const llvm::APSInt &  rhs,
QualType  type 
)
NonLoc SValBuilder::makeNonLoc ( const llvm::APSInt &  rhs,
BinaryOperator::Opcode  op,
const SymExpr lhs,
QualType  type 
)
NonLoc SValBuilder::makeNonLoc ( const SymExpr lhs,
BinaryOperator::Opcode  op,
const SymExpr rhs,
QualType  type 
)
NonLoc SValBuilder::makeNonLoc ( const SymExpr operand,
QualType  fromTy,
QualType  toTy 
)

Create a NonLoc value for cast.

Definition at line 69 of file SValBuilder.cpp.

References clang::ento::SymbolManager::getCastSymbol(), clang::ento::Loc::isLocType(), and SymMgr.

Constructs a symbolic expression for two non-location values.

Definition at line 304 of file SValBuilder.cpp.

References clang::ento::SymExpr::computeComplexity(), clang::ento::SVal::getAs(), clang::ento::SVal::getAsSymExpr(), and makeNonLoc().

Definition at line 292 of file SValBuilder.h.

References BasicVals, and clang::ento::BasicValueFactory::getTruthValue().


Member Data Documentation

The scalar type to use for array indices.

Definition at line 48 of file SValBuilder.h.

Referenced by convertToArrayIndex(), getArrayIndexType(), makeArrayIndex(), and makeZeroArrayIndex().

The width of the scalar type used for array indices.

Definition at line 51 of file SValBuilder.h.

Referenced by convertToArrayIndex().

Definition at line 34 of file SValBuilder.h.

Referenced by evalCast(), getConditionType(), getContext(), and haveSameType().

Definition at line 45 of file SValBuilder.h.

Referenced by evalCast(), and getStateManager().


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