clang 19.0.0git
Public Member Functions | Protected Attributes | List of all members
clang::ento::SValBuilder Class Referenceabstract

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

Public Member Functions

 SValBuilder (llvm::BumpPtrAllocator &alloc, ASTContext &context, ProgramStateManager &stateMgr)
 
virtual ~SValBuilder ()=default
 
SVal evalCast (SVal V, QualType CastTy, QualType OriginalTy)
 Cast a given SVal to another SVal using given QualType's.
 
SVal evalIntegralCast (ProgramStateRef state, SVal val, QualType castTy, QualType originalType)
 
SVal evalMinus (NonLoc val)
 
SVal evalComplement (NonLoc val)
 
virtual SVal evalBinOpNN (ProgramStateRef state, BinaryOperator::Opcode op, NonLoc lhs, NonLoc rhs, QualType resultTy)=0
 Create a new value which represents a binary expression with two non- location operands.
 
virtual SVal evalBinOpLL (ProgramStateRef state, BinaryOperator::Opcode op, Loc lhs, Loc rhs, QualType resultTy)=0
 Create a new value which represents a binary expression with two memory location operands.
 
virtual SVal evalBinOpLN (ProgramStateRef state, BinaryOperator::Opcode op, Loc lhs, NonLoc rhs, QualType resultTy)=0
 Create a new value which represents a binary expression with a memory location and non-location operands.
 
virtual const llvm::APSInt * getKnownValue (ProgramStateRef state, SVal val)=0
 Evaluates a given SVal.
 
virtual const llvm::APSInt * getMinValue (ProgramStateRef state, SVal val)=0
 Tries to get the minimal possible (integer) value of a given SVal.
 
virtual const llvm::APSInt * getMaxValue (ProgramStateRef state, SVal val)=0
 Tries to get the maximal possible (integer) value of a given SVal.
 
virtual SVal simplifySVal (ProgramStateRef State, SVal Val)=0
 Simplify symbolic expressions within a given SVal.
 
SVal makeSymExprValNN (BinaryOperator::Opcode op, NonLoc lhs, NonLoc rhs, QualType resultTy)
 Constructs a symbolic expression for two non-location values.
 
SVal evalUnaryOp (ProgramStateRef state, UnaryOperator::Opcode opc, SVal operand, QualType type)
 
SVal evalBinOp (ProgramStateRef state, BinaryOperator::Opcode op, SVal lhs, SVal rhs, QualType type)
 
ConditionTruthVal areEqual (ProgramStateRef state, SVal lhs, SVal rhs)
 
SVal evalEQ (ProgramStateRef state, SVal lhs, SVal rhs)
 
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 AnalyzerOptionsgetAnalyzerOptions () 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 getConjuredHeapSymbolVal (const Expr *E, const LocationContext *LCtx, QualType type, unsigned Count)
 Conjure a symbol representing heap allocated memory region.
 
loc::MemRegionVal getAllocaRegionVal (const Expr *E, const LocationContext *LCtx, unsigned Count)
 Create an SVal representing the result of an alloca()-like call, that is, an AllocaRegion on the stack.
 
DefinedOrUnknownSVal getDerivedRegionValueSymbolVal (SymbolRef parentSymbol, const TypedValueRegion *region)
 
DefinedSVal getMetadataSymbolVal (const void *symbolTag, const MemRegion *region, const Expr *expr, QualType type, const LocationContext *LCtx, unsigned count)
 
DefinedSVal getMemberPointer (const NamedDecl *ND)
 
DefinedSVal getFunctionPointer (const FunctionDecl *func)
 
DefinedSVal getBlockPointer (const BlockDecl *block, CanQualType locTy, const LocationContext *locContext, unsigned blockCount)
 
std::optional< SValgetConstantVal (const Expr *E)
 Returns the value of E, if it can be determined in a non-path-sensitive manner.
 
NonLoc makeCompoundVal (QualType type, llvm::ImmutableList< SVal > vals)
 
NonLoc makeLazyCompoundVal (const StoreRef &store, const TypedValueRegion *region)
 
NonLoc makePointerToMember (const DeclaratorDecl *DD)
 
NonLoc makePointerToMember (const PointerToMemberData *PTMD)
 
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 makeIntValWithWidth (QualType ptrType, uint64_t integer)
 
NonLoc makeLocAsInteger (Loc loc, unsigned bits)
 
nonloc::SymbolVal makeNonLoc (const SymExpr *lhs, BinaryOperator::Opcode op, const llvm::APSInt &rhs, QualType type)
 
nonloc::SymbolVal makeNonLoc (const llvm::APSInt &rhs, BinaryOperator::Opcode op, const SymExpr *lhs, QualType type)
 
nonloc::SymbolVal makeNonLoc (const SymExpr *lhs, BinaryOperator::Opcode op, const SymExpr *rhs, QualType type)
 
NonLoc makeNonLoc (const SymExpr *operand, UnaryOperator::Opcode op, QualType type)
 
nonloc::SymbolVal 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::ConcreteInt makeNullWithType (QualType type)
 Create NULL pointer, with proper pointer bit-width for given address space.
 
loc::MemRegionVal makeLoc (SymbolRef sym)
 
loc::MemRegionVal makeLoc (const MemRegion *region)
 
loc::GotoLabel makeLoc (const AddrLabelExpr *expr)
 
loc::ConcreteInt makeLoc (const llvm::APSInt &integer)
 
std::optional< loc::MemRegionValgetCastedMemRegionVal (const MemRegion *region, QualType type)
 Return MemRegionVal on success cast, otherwise return std::nullopt.
 
DefinedSVal makeSymbolVal (SymbolRef Sym)
 Make an SVal that represents the given symbol.
 
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 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 AnalyzerOptionsAnOpts
 
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 53 of file SValBuilder.h.

Constructor & Destructor Documentation

◆ SValBuilder()

SValBuilder::SValBuilder ( llvm::BumpPtrAllocator &  alloc,
ASTContext context,
ProgramStateManager stateMgr 
)

Definition at line 52 of file SValBuilder.cpp.

◆ ~SValBuilder()

virtual clang::ento::SValBuilder::~SValBuilder ( )
virtualdefault

Member Function Documentation

◆ areEqual()

ConditionTruthVal SValBuilder::areEqual ( ProgramStateRef  state,
SVal  lhs,
SVal  rhs 
)
Returns
Whether values in lhs and rhs are equal at state.

Definition at line 543 of file SValBuilder.cpp.

References evalEQ().

Referenced by clang::ento::ProgramState::areEqual(), and wasRegionOfInterestModifiedAt().

◆ conjureSymbol() [1/2]

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

◆ conjureSymbol() [2/2]

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

◆ conjureSymbolVal() [1/3]

DefinedOrUnknownSVal SValBuilder::conjureSymbolVal ( const Stmt stmt,
const LocationContext LCtx,
QualType  type,
unsigned  visitCount 
)

◆ conjureSymbolVal() [2/3]

DefinedOrUnknownSVal SValBuilder::conjureSymbolVal ( const void *  symbolTag,
const Expr expr,
const LocationContext LCtx,
QualType  type,
unsigned  count 
)

◆ conjureSymbolVal() [3/3]

DefinedOrUnknownSVal SValBuilder::conjureSymbolVal ( const void *  symbolTag,
const Expr expr,
const LocationContext LCtx,
unsigned  count 
)

◆ convertToArrayIndex()

SVal SValBuilder::convertToArrayIndex ( SVal  val)

◆ evalBinOp()

SVal SValBuilder::evalBinOp ( ProgramStateRef  state,
BinaryOperator::Opcode  op,
SVal  lhs,
SVal  rhs,
QualType  type 
)

◆ evalBinOpLL()

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

◆ evalBinOpLN()

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

◆ evalBinOpNN()

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

◆ evalCast()

SVal SValBuilder::evalCast ( SVal  V,
QualType  CastTy,
QualType  OriginalTy 
)

Cast a given SVal to another SVal using given QualType's.

Parameters
VSVal that should be casted.
CastTyQualType that V should be casted according to.
OriginalTyQualType which is associated to V. It provides additional information about what type the cast performs from.
Returns
the most appropriate casted SVal. Note: Many cases don't use an exact OriginalTy. It can be extracted from SVal or the cast can performs unconditionaly. Always pass OriginalTy! It can be crucial in certain cases and generates different results. FIXME: If OriginalTy.isNull() is true, then cast performs based on CastTy only. This behavior is uncertain and should be improved.

Definition at line 1104 of file SValBuilder.cpp.

References V.

Referenced by clang::ento::SimpleConstraintManager::assumeInternal(), castArgToParamTypeIfNeeded(), convertToArrayIndex(), evalIntegralCast(), getConstantVal(), clang::ento::CXXInstanceCall::getCXXThisVal(), clang::ento::CXXInstanceCall::getInitialStackFrameContents(), clang::ento::ExprEngine::handleLValueBitCast(), clang::ento::ExprEngine::processCallExit(), clang::ento::ExprEngine::VisitBinaryOperator(), clang::ento::ExprEngine::VisitCast(), clang::ento::ExprEngine::VisitCXXNewExpr(), and clang::ento::ExprEngine::VisitLogicalExpr().

◆ evalComplement()

SVal SValBuilder::evalComplement ( NonLoc  val)

◆ evalEQ() [1/2]

DefinedOrUnknownSVal SValBuilder::evalEQ ( ProgramStateRef  state,
DefinedOrUnknownSVal  lhs,
DefinedOrUnknownSVal  rhs 
)

Definition at line 552 of file SValBuilder.cpp.

References clang::ento::SVal::castAs(), and evalEQ().

◆ evalEQ() [2/2]

SVal SValBuilder::evalEQ ( ProgramStateRef  state,
SVal  lhs,
SVal  rhs 
)

◆ evalIntegralCast()

SVal SValBuilder::evalIntegralCast ( ProgramStateRef  state,
SVal  val,
QualType  castTy,
QualType  originalType 
)

◆ evalMinus()

SVal SValBuilder::evalMinus ( NonLoc  val)

◆ evalUnaryOp()

SVal SValBuilder::evalUnaryOp ( ProgramStateRef  state,
UnaryOperator::Opcode  opc,
SVal  operand,
QualType  type 
)

Definition at line 480 of file SValBuilder.cpp.

References evalComplement(), evalMinus(), and clang::ento::SVal::getAs().

◆ getAllocaRegionVal()

loc::MemRegionVal SValBuilder::getAllocaRegionVal ( const Expr E,
const LocationContext LCtx,
unsigned  Count 
)

Create an SVal representing the result of an alloca()-like call, that is, an AllocaRegion on the stack.

After calling this function, it's a good idea to set the extent of the returned AllocaRegion.

Definition at line 234 of file SValBuilder.cpp.

References clang::ento::MemRegionManager::getAllocaRegion(), getRegionManager(), and VisitCount.

◆ getAnalyzerOptions()

const AnalyzerOptions & clang::ento::SValBuilder::getAnalyzerOptions ( ) const
inline

Definition at line 170 of file SValBuilder.h.

References AnOpts.

Referenced by tryRearrange().

◆ getArrayIndexType()

QualType clang::ento::SValBuilder::getArrayIndexType ( ) const
inline

◆ getBasicValueFactory() [1/2]

BasicValueFactory & clang::ento::SValBuilder::getBasicValueFactory ( )
inline

◆ getBasicValueFactory() [2/2]

const BasicValueFactory & clang::ento::SValBuilder::getBasicValueFactory ( ) const
inline

Definition at line 162 of file SValBuilder.h.

References BasicVals.

◆ getBlockPointer()

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

◆ getCastedMemRegionVal()

std::optional< loc::MemRegionVal > SValBuilder::getCastedMemRegionVal ( const MemRegion region,
QualType  type 
)

Return MemRegionVal on success cast, otherwise return std::nullopt.

Definition at line 309 of file SValBuilder.cpp.

References clang::ento::StoreManager::castRegion(), clang::ento::ProgramStateManager::getStoreManager(), and StateMgr.

◆ getConditionType()

QualType clang::ento::SValBuilder::getConditionType ( ) const
inline

◆ getConjuredHeapSymbolVal() [1/2]

DefinedOrUnknownSVal SValBuilder::getConjuredHeapSymbolVal ( const Expr E,
const LocationContext LCtx,
QualType  type,
unsigned  Count 
)

Conjure a symbol representing heap allocated memory region.

Note, now, the expression doesn't need to represent a location. But the type need to!

Definition at line 222 of file SValBuilder.cpp.

References clang::ento::SymbolManager::canSymbolicate(), clang::ento::SymbolManager::conjureSymbol(), clang::ento::MemRegionManager::getSymbolicHeapRegion(), clang::ento::Loc::isLocType(), makeZeroVal(), MemMgr, SymMgr, clang::ast_matchers::type, and VisitCount.

◆ getConjuredHeapSymbolVal() [2/2]

DefinedOrUnknownSVal SValBuilder::getConjuredHeapSymbolVal ( const Expr E,
const LocationContext LCtx,
unsigned  Count 
)

Conjure a symbol representing heap allocated memory region.

Note, the expression should represent a location.

Definition at line 214 of file SValBuilder.cpp.

References getConjuredHeapSymbolVal(), clang::Expr::getType(), and VisitCount.

Referenced by clang::ento::ExprEngine::bindReturnValue(), getConjuredHeapSymbolVal(), and clang::ento::ExprEngine::VisitCXXNewExpr().

◆ getConstantVal()

std::optional< SVal > SValBuilder::getConstantVal ( const Expr E)

◆ getContext() [1/2]

ASTContext & clang::ento::SValBuilder::getContext ( )
inline

◆ getContext() [2/2]

const ASTContext & clang::ento::SValBuilder::getContext ( ) const
inline

Definition at line 149 of file SValBuilder.h.

References Context.

◆ getCXXThis() [1/2]

loc::MemRegionVal SValBuilder::getCXXThis ( const CXXMethodDecl D,
const StackFrameContext SFC 
)

◆ getCXXThis() [2/2]

loc::MemRegionVal SValBuilder::getCXXThis ( const CXXRecordDecl D,
const StackFrameContext SFC 
)

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

Definition at line 323 of file SValBuilder.cpp.

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

◆ getDerivedRegionValueSymbolVal()

DefinedOrUnknownSVal SValBuilder::getDerivedRegionValueSymbolVal ( SymbolRef  parentSymbol,
const TypedValueRegion region 
)

◆ getFunctionPointer()

DefinedSVal SValBuilder::getFunctionPointer ( const FunctionDecl func)

◆ getKnownValue()

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.

◆ getMaxValue()

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

Tries to get the maximal possible (integer) value of a given SVal.

This always returns the value of a ConcreteInt, but may return NULL if the value is symbolic and the constraint manager cannot provide a useful answer.

Referenced by isNegative().

◆ getMemberPointer()

DefinedSVal SValBuilder::getMemberPointer ( const NamedDecl ND)

◆ getMetadataSymbolVal()

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

◆ getMinValue()

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

Tries to get the minimal possible (integer) value of a given SVal.

This always returns the value of a ConcreteInt, but may return NULL if the value is symbolic and the constraint manager cannot provide a useful answer.

◆ getRegionManager() [1/2]

MemRegionManager & clang::ento::SValBuilder::getRegionManager ( )
inline

◆ getRegionManager() [2/2]

const MemRegionManager & clang::ento::SValBuilder::getRegionManager ( ) const
inline

Definition at line 168 of file SValBuilder.h.

References MemMgr.

◆ getRegionValueSymbolVal()

DefinedOrUnknownSVal SValBuilder::getRegionValueSymbolVal ( const TypedValueRegion region)

◆ getStateManager()

ProgramStateManager & clang::ento::SValBuilder::getStateManager ( )
inline

Definition at line 151 of file SValBuilder.h.

References StateMgr.

◆ getSymbolManager() [1/2]

SymbolManager & clang::ento::SValBuilder::getSymbolManager ( )
inline

◆ getSymbolManager() [2/2]

const SymbolManager & clang::ento::SValBuilder::getSymbolManager ( ) const
inline

Definition at line 165 of file SValBuilder.h.

References SymMgr.

◆ makeArrayIndex()

NonLoc clang::ento::SValBuilder::makeArrayIndex ( uint64_t  idx)
inline

◆ makeBoolVal() [1/2]

nonloc::ConcreteInt SValBuilder::makeBoolVal ( const CXXBoolLiteralExpr boolean)

Definition at line 136 of file SValBuilder.cpp.

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

◆ makeBoolVal() [2/2]

nonloc::ConcreteInt clang::ento::SValBuilder::makeBoolVal ( const ObjCBoolLiteralExpr boolean)
inline

◆ makeCompoundVal()

NonLoc clang::ento::SValBuilder::makeCompoundVal ( QualType  type,
llvm::ImmutableList< SVal vals 
)
inline

◆ makeIntLocVal()

loc::ConcreteInt clang::ento::SValBuilder::makeIntLocVal ( const llvm::APSInt &  integer)
inline

Definition at line 306 of file SValBuilder.h.

References BasicVals.

◆ makeIntVal() [1/5]

nonloc::ConcreteInt clang::ento::SValBuilder::makeIntVal ( const IntegerLiteral integer)
inline

◆ makeIntVal() [2/5]

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

Definition at line 310 of file SValBuilder.h.

References BasicVals, and isUnsigned().

◆ makeIntVal() [3/5]

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

Definition at line 302 of file SValBuilder.h.

References BasicVals.

◆ makeIntVal() [4/5]

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

◆ makeIntVal() [5/5]

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

◆ makeIntValWithWidth()

NonLoc clang::ento::SValBuilder::makeIntValWithWidth ( QualType  ptrType,
uint64_t  integer 
)
inline

Definition at line 325 of file SValBuilder.h.

References BasicVals.

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

◆ makeLazyCompoundVal()

NonLoc clang::ento::SValBuilder::makeLazyCompoundVal ( const StoreRef store,
const TypedValueRegion region 
)
inline

◆ makeLoc() [1/4]

loc::GotoLabel clang::ento::SValBuilder::makeLoc ( const AddrLabelExpr expr)
inline

Definition at line 385 of file SValBuilder.h.

References clang::ast_matchers::expr.

◆ makeLoc() [2/4]

loc::ConcreteInt clang::ento::SValBuilder::makeLoc ( const llvm::APSInt &  integer)
inline

Definition at line 389 of file SValBuilder.h.

References BasicVals.

◆ makeLoc() [3/4]

loc::MemRegionVal clang::ento::SValBuilder::makeLoc ( const MemRegion region)
inline

Definition at line 381 of file SValBuilder.h.

◆ makeLoc() [4/4]

loc::MemRegionVal clang::ento::SValBuilder::makeLoc ( SymbolRef  sym)
inline

◆ makeLocAsInteger()

NonLoc clang::ento::SValBuilder::makeLocAsInteger ( Loc  loc,
unsigned  bits 
)
inline

◆ makeNonLoc() [1/5]

nonloc::SymbolVal SValBuilder::makeNonLoc ( const llvm::APSInt &  rhs,
BinaryOperator::Opcode  op,
const SymExpr lhs,
QualType  type 
)

◆ makeNonLoc() [2/5]

nonloc::SymbolVal SValBuilder::makeNonLoc ( const SymExpr lhs,
BinaryOperator::Opcode  op,
const llvm::APSInt &  rhs,
QualType  type 
)

◆ makeNonLoc() [3/5]

nonloc::SymbolVal SValBuilder::makeNonLoc ( const SymExpr lhs,
BinaryOperator::Opcode  op,
const SymExpr rhs,
QualType  type 
)

◆ makeNonLoc() [4/5]

nonloc::SymbolVal SValBuilder::makeNonLoc ( const SymExpr operand,
QualType  fromTy,
QualType  toTy 
)

Create a NonLoc value for cast.

Definition at line 112 of file SValBuilder.cpp.

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

◆ makeNonLoc() [5/5]

NonLoc SValBuilder::makeNonLoc ( const SymExpr operand,
UnaryOperator::Opcode  op,
QualType  type 
)

◆ makeNullWithType()

loc::ConcreteInt clang::ento::SValBuilder::makeNullWithType ( QualType  type)
inline

Create NULL pointer, with proper pointer bit-width for given address space.

Parameters
typepointer type.

Definition at line 361 of file SValBuilder.h.

References BasicVals, Context, clang::ASTContext::getPointerType(), clang::ento::BasicValueFactory::getZeroWithTypeSize(), and clang::ast_matchers::type.

Referenced by getConstantVal(), makeZeroVal(), clang::ento::ExprEngine::VisitCast(), and clang::ento::ExprEngine::VisitUnaryOperator().

◆ makePointerToMember() [1/2]

NonLoc clang::ento::SValBuilder::makePointerToMember ( const DeclaratorDecl DD)
inline

Definition at line 272 of file SValBuilder.h.

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

◆ makePointerToMember() [2/2]

NonLoc clang::ento::SValBuilder::makePointerToMember ( const PointerToMemberData PTMD)
inline

Definition at line 276 of file SValBuilder.h.

◆ makeSymbolVal()

DefinedSVal clang::ento::SValBuilder::makeSymbolVal ( SymbolRef  Sym)
inline

Make an SVal that represents the given symbol.

This follows the convention of representing Loc-type symbols (symbolic pointers and references) as Loc values wrapping the symbol rather than as plain symbol values.

Definition at line 400 of file SValBuilder.h.

References clang::ento::SymExpr::getType(), clang::ento::Loc::isLocType(), and makeLoc().

Referenced by clang::ento::SMTConstraintManager::canReasonAbout(), and clang::ento::simplifyToSVal().

◆ makeSymExprValNN()

SVal SValBuilder::makeSymExprValNN ( BinaryOperator::Opcode  op,
NonLoc  lhs,
NonLoc  rhs,
QualType  resultTy 
)

Constructs a symbolic expression for two non-location values.

Definition at line 429 of file SValBuilder.cpp.

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

◆ makeTruthVal() [1/2]

nonloc::ConcreteInt clang::ento::SValBuilder::makeTruthVal ( bool  b)
inline

Definition at line 354 of file SValBuilder.h.

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

◆ makeTruthVal() [2/2]

nonloc::ConcreteInt clang::ento::SValBuilder::makeTruthVal ( bool  b,
QualType  type 
)
inline

◆ makeZeroArrayIndex()

NonLoc clang::ento::SValBuilder::makeZeroArrayIndex ( )
inline

Definition at line 280 of file SValBuilder.h.

References ArrayIndexTy, and BasicVals.

Referenced by computeOffset(), and clang::ento::StoreManager::GetElementZeroRegion().

◆ makeZeroVal()

DefinedOrUnknownSVal SValBuilder::makeZeroVal ( QualType  type)

◆ simplifySVal()

virtual SVal clang::ento::SValBuilder::simplifySVal ( ProgramStateRef  State,
SVal  Val 
)
pure virtual

Simplify symbolic expressions within a given SVal.

Return an SVal that represents the same value, but is hopefully easier to work with than the original SVal.

Referenced by clang::ento::ExprEngine::handleLValueBitCast(), and clang::ento::simplifyToSVal().

Member Data Documentation

◆ AnOpts

const AnalyzerOptions& clang::ento::SValBuilder::AnOpts
protected

Definition at line 70 of file SValBuilder.h.

Referenced by getAnalyzerOptions(), and makeSymExprValNN().

◆ ArrayIndexTy

const QualType clang::ento::SValBuilder::ArrayIndexTy
protected

The scalar type to use for array indices.

Definition at line 73 of file SValBuilder.h.

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

◆ ArrayIndexWidth

const unsigned clang::ento::SValBuilder::ArrayIndexWidth
protected

The width of the scalar type used for array indices.

Definition at line 76 of file SValBuilder.h.

Referenced by convertToArrayIndex().

◆ BasicVals

BasicValueFactory clang::ento::SValBuilder::BasicVals
protected

◆ Context

ASTContext& clang::ento::SValBuilder::Context
protected

◆ MemMgr

MemRegionManager clang::ento::SValBuilder::MemMgr
protected

◆ StateMgr

ProgramStateManager& clang::ento::SValBuilder::StateMgr
protected

Definition at line 68 of file SValBuilder.h.

Referenced by getCastedMemRegionVal(), and getStateManager().

◆ SymMgr

SymbolManager clang::ento::SValBuilder::SymMgr
protected

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