clang 22.0.0git
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 (ConstCFGElementRef Elem, const LocationContext *LCtx, QualType type, 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, ConstCFGElementRef elem, const LocationContext *LCtx, unsigned count)
 Create a new symbol with a unique 'name'.
DefinedOrUnknownSVal conjureSymbolVal (const void *symbolTag, ConstCFGElementRef elem, const LocationContext *LCtx, QualType type, unsigned count)
DefinedOrUnknownSVal conjureSymbolVal (ConstCFGElementRef elem, const LocationContext *LCtx, QualType type, unsigned visitCount)
DefinedOrUnknownSVal conjureSymbolVal (const CallEvent &call, QualType type, unsigned visitCount, const void *symbolTag=nullptr)
DefinedOrUnknownSVal conjureSymbolVal (const CallEvent &call, unsigned visitCount, const void *symbolTag=nullptr)
DefinedSVal getConjuredHeapSymbolVal (ConstCFGElementRef elem, 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, APSIntPtr rhs, QualType type)
nonloc::SymbolVal makeNonLoc (APSIntPtr 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 54 of file SValBuilder.h.

Constructor & Destructor Documentation

◆ SValBuilder()

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

◆ ~SValBuilder()

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

References V.

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 544 of file SValBuilder.cpp.

References evalEQ().

Referenced by wasRegionOfInterestModifiedAt().

◆ conjureSymbol()

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

Definition at line 175 of file SValBuilder.h.

References SymMgr, and clang::ast_matchers::type.

◆ conjureSymbolVal() [1/5]

DefinedOrUnknownSVal SValBuilder::conjureSymbolVal ( const CallEvent & call,
QualType type,
unsigned visitCount,
const void * symbolTag = nullptr )

◆ conjureSymbolVal() [2/5]

DefinedOrUnknownSVal SValBuilder::conjureSymbolVal ( const CallEvent & call,
unsigned visitCount,
const void * symbolTag = nullptr )

◆ conjureSymbolVal() [3/5]

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

◆ conjureSymbolVal() [4/5]

DefinedOrUnknownSVal SValBuilder::conjureSymbolVal ( const void * symbolTag,
ConstCFGElementRef elem,
const LocationContext * LCtx,
unsigned count )

Create a new symbol with a unique 'name'.

We resort to conjured symbols when we cannot construct a derived symbol. The advantage of symbols derived/built from other symbols is that we preserve the relation between related(or even equivalent) expressions, so conjured symbols should be used sparingly.

Definition at line 154 of file SValBuilder.cpp.

References conjureSymbolVal(), clang::LocationContext::getAnalysisDeclContext(), clang::AnalysisDeclContext::getASTContext(), clang::ASTContext::getPointerType(), clang::CFGStmt::getStmt(), clang::Expr::getType(), clang::Expr::isGLValue(), makeZeroVal(), and clang::T.

Referenced by clang::ento::ExprEngine::computeObjectUnderConstruction(), conjureOffsetSymbolOnLocation(), conjureSymbolVal(), conjureSymbolVal(), conjureSymbolVal(), conjureSymbolVal(), clang::ento::retaincountchecker::RetainCountChecker::evalCall(), and clang::ento::ExprEngine::ProcessInitializer().

◆ conjureSymbolVal() [5/5]

DefinedOrUnknownSVal SValBuilder::conjureSymbolVal ( ConstCFGElementRef elem,
const LocationContext * LCtx,
QualType type,
unsigned visitCount )

Definition at line 193 of file SValBuilder.cpp.

References conjureSymbolVal(), and clang::ast_matchers::type.

◆ convertToArrayIndex()

SVal SValBuilder::convertToArrayIndex ( SVal val)

◆ evalBinOp()

◆ 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 1105 of file SValBuilder.cpp.

References V.

Referenced by castArgToParamTypeIfNeeded(), convertToArrayIndex(), evalIntegralCast(), getConstantVal(), clang::ento::CXXInstanceCall::getCXXThisVal(), and clang::ento::CXXInstanceCall::getInitialStackFrameContents().

◆ evalComplement()

SVal SValBuilder::evalComplement ( NonLoc val)

◆ evalEQ() [1/2]

Definition at line 553 of file SValBuilder.cpp.

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

◆ evalEQ() [2/2]

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

Definition at line 549 of file SValBuilder.cpp.

References evalBinOp(), and getConditionType().

Referenced by areEqual(), evalEQ(), and mayBeSuccess().

◆ evalIntegralCast()

◆ evalMinus()

◆ evalUnaryOp()

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

◆ 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 232 of file SValBuilder.cpp.

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

◆ getAnalyzerOptions()

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

Definition at line 171 of file SValBuilder.h.

References AnOpts.

Referenced by SValBuilder(), and tryRearrange().

◆ getArrayIndexType()

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

◆ getBasicValueFactory() [1/2]

◆ getBasicValueFactory() [2/2]

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

Definition at line 163 of file SValBuilder.h.

References BasicVals.

◆ getBlockPointer()

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

Definition at line 295 of file SValBuilder.cpp.

References clang::LocationContext::getAnalysisDeclContext(), and MemMgr.

◆ getCastedMemRegionVal()

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

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

Definition at line 307 of file SValBuilder.cpp.

References StateMgr.

◆ getConditionType()

◆ getConjuredHeapSymbolVal()

DefinedSVal SValBuilder::getConjuredHeapSymbolVal ( ConstCFGElementRef elem,
const LocationContext * LCtx,
QualType type,
unsigned Count )

Conjure a symbol representing heap allocated memory region.

Definition at line 216 of file SValBuilder.cpp.

References clang::ento::SymbolManager::canSymbolicate(), clang::ento::SVal::castAs(), clang::ento::Loc::isLocType(), makeZeroVal(), MemMgr, SymMgr, and clang::ast_matchers::type.

◆ getConstantVal()

◆ getContext() [1/2]

◆ getContext() [2/2]

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

Definition at line 150 of file SValBuilder.h.

References Context.

◆ getCXXThis() [1/2]

◆ 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 321 of file SValBuilder.cpp.

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

◆ getDerivedRegionValueSymbolVal()

◆ getFunctionPointer()

DefinedSVal SValBuilder::getFunctionPointer ( const FunctionDecl * func)

Definition at line 291 of file SValBuilder.cpp.

References MemMgr.

Referenced by getMemberPointer().

◆ 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.

Referenced by getKnownValue().

◆ 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)

Definition at line 275 of file SValBuilder.cpp.

References getFunctionPointer(), and clang::isa().

◆ 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]

◆ getRegionManager() [2/2]

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

Definition at line 169 of file SValBuilder.h.

References MemMgr.

◆ getRegionValueSymbolVal()

DefinedOrUnknownSVal SValBuilder::getRegionValueSymbolVal ( const TypedValueRegion * region)

◆ getStateManager()

◆ getSymbolManager() [1/2]

◆ getSymbolManager() [2/2]

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

Definition at line 166 of file SValBuilder.h.

References SymMgr.

◆ makeArrayIndex()

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

Definition at line 271 of file SValBuilder.h.

References ArrayIndexTy, and BasicVals.

Referenced by computeOffset(), and escapeByStartIndexAndCount().

◆ makeBoolVal() [1/2]

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

Definition at line 132 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

Definition at line 249 of file SValBuilder.h.

References BasicVals, and clang::ast_matchers::type.

Referenced by makeZeroVal(), and processArgument().

◆ makeIntLocVal()

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

Definition at line 293 of file SValBuilder.h.

References BasicVals.

◆ makeIntVal() [1/5]

◆ makeIntVal() [2/5]

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

Definition at line 297 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 289 of file SValBuilder.h.

References BasicVals.

◆ makeIntVal() [4/5]

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

Definition at line 308 of file SValBuilder.h.

References BasicVals, and isUnsigned().

◆ 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 312 of file SValBuilder.h.

References BasicVals.

◆ makeLazyCompoundVal()

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

Definition at line 253 of file SValBuilder.h.

References BasicVals.

◆ makeLoc() [1/4]

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

Definition at line 371 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 375 of file SValBuilder.h.

References BasicVals.

◆ makeLoc() [3/4]

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

Definition at line 367 of file SValBuilder.h.

◆ makeLoc() [4/4]

◆ makeLocAsInteger()

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

Definition at line 316 of file SValBuilder.h.

References BasicVals.

◆ makeNonLoc() [1/5]

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

Definition at line 85 of file SValBuilder.cpp.

References clang::ento::Loc::isLocType(), SymMgr, and clang::ast_matchers::type.

◆ makeNonLoc() [2/5]

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

◆ makeNonLoc() [3/5]

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

Definition at line 93 of file SValBuilder.cpp.

References clang::ento::Loc::isLocType(), SymMgr, and clang::ast_matchers::type.

◆ makeNonLoc() [4/5]

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

Create a NonLoc value for cast.

Definition at line 108 of file SValBuilder.cpp.

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

◆ makeNonLoc() [5/5]

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

Definition at line 101 of file SValBuilder.cpp.

References clang::ento::Loc::isLocType(), SymMgr, and clang::ast_matchers::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 347 of file SValBuilder.h.

References BasicVals, Context, and clang::ast_matchers::type.

Referenced by getConstantVal(), and makeZeroVal().

◆ makePointerToMember() [1/2]

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

Definition at line 259 of file SValBuilder.h.

◆ makePointerToMember() [2/2]

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

Definition at line 263 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 386 of file SValBuilder.h.

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

Referenced by 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 430 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 340 of file SValBuilder.h.

References b, and BasicVals.

◆ makeTruthVal() [2/2]

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

Definition at line 336 of file SValBuilder.h.

References b, BasicVals, and clang::ast_matchers::type.

Referenced by getConstantVal(), makeBoolVal(), and makeBoolVal().

◆ makeZeroArrayIndex()

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

Definition at line 267 of file SValBuilder.h.

References ArrayIndexTy, and BasicVals.

Referenced by computeOffset().

◆ makeZeroVal()

◆ 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.

References clang::ast_matchers::type.

Referenced by clang::ento::simplifyToSVal().

Member Data Documentation

◆ AnOpts

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

Definition at line 71 of file SValBuilder.h.

Referenced by getAnalyzerOptions(), makeSymExprValNN(), and SValBuilder().

◆ ArrayIndexTy

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

The scalar type to use for array indices.

Definition at line 74 of file SValBuilder.h.

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

◆ ArrayIndexWidth

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

The width of the scalar type used for array indices.

Definition at line 77 of file SValBuilder.h.

Referenced by convertToArrayIndex(), and SValBuilder().

◆ BasicVals

◆ Context

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

◆ MemMgr

◆ StateMgr

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

Definition at line 69 of file SValBuilder.h.

Referenced by getCastedMemRegionVal(), getStateManager(), and SValBuilder().

◆ SymMgr


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