clang
15.0.0git
|
#include "clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h"
Protected Attributes | |
ASTContext & | Context |
BasicValueFactory | BasicVals |
Manager of APSInt values. More... | |
SymbolManager | SymMgr |
Manages the creation of symbols. More... | |
MemRegionManager | MemMgr |
Manages the creation of memory regions. More... | |
ProgramStateManager & | StateMgr |
const AnalyzerOptions & | AnOpts |
const QualType | ArrayIndexTy |
The scalar type to use for array indices. More... | |
const unsigned | ArrayIndexWidth |
The width of the scalar type used for array indices. More... | |
Definition at line 53 of file SValBuilder.h.
SValBuilder::SValBuilder | ( | llvm::BumpPtrAllocator & | alloc, |
ASTContext & | context, | ||
ProgramStateManager & | stateMgr | ||
) |
Definition at line 52 of file SValBuilder.cpp.
|
virtualdefault |
ConditionTruthVal SValBuilder::areEqual | ( | ProgramStateRef | state, |
SVal | lhs, | ||
SVal | rhs | ||
) |
lhs
and rhs
are equal at state
. Definition at line 488 of file SValBuilder.cpp.
References evalEQ(), and state.
Referenced by clang::ento::ProgramState::areEqual().
|
inline |
Definition at line 201 of file SValBuilder.h.
References clang::ento::SymbolManager::conjureSymbol(), clang::ast_matchers::expr, and SymMgr.
|
inline |
Definition at line 193 of file SValBuilder.h.
References clang::ento::SymbolManager::conjureSymbol(), clang::ast_matchers::stmt, and SymMgr.
DefinedOrUnknownSVal SValBuilder::conjureSymbolVal | ( | const Stmt * | stmt, |
const LocationContext * | LCtx, | ||
QualType | type, | ||
unsigned | visitCount | ||
) |
Definition at line 185 of file SValBuilder.cpp.
References clang::ento::SymbolManager::canSymbolicate(), clang::ento::SymbolManager::conjureSymbol(), clang::ento::MemRegionManager::getSymbolicRegion(), clang::ento::Loc::isLocType(), makeZeroVal(), MemMgr, clang::ast_matchers::stmt, and SymMgr.
DefinedOrUnknownSVal SValBuilder::conjureSymbolVal | ( | const void * | symbolTag, |
const Expr * | expr, | ||
const LocationContext * | LCtx, | ||
QualType | type, | ||
unsigned | count | ||
) |
Definition at line 166 of file SValBuilder.cpp.
References clang::ento::SymbolManager::canSymbolicate(), clang::ento::SymbolManager::conjureSymbol(), clang::ast_matchers::expr, clang::ento::MemRegionManager::getSymbolicRegion(), clang::ento::Loc::isLocType(), makeZeroVal(), MemMgr, and SymMgr.
DefinedOrUnknownSVal clang::ento::SValBuilder::conjureSymbolVal | ( | const void * | symbolTag, |
const Expr * | expr, | ||
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.
Referenced by clang::ento::ExprEngine::bindReturnValue(), clang::ento::ExprEngine::computeObjectUnderConstruction(), clang::ento::retaincountchecker::RetainCountChecker::evalCall(), clang::ento::ExprEngine::ProcessInitializer(), clang::ento::ExprEngine::VisitBinaryOperator(), clang::ento::ExprEngine::VisitCast(), clang::ento::ExprEngine::VisitCXXCatchStmt(), clang::ento::ExprEngine::VisitCXXNewExpr(), clang::ento::ExprEngine::VisitDeclStmt(), and clang::ento::ExprEngine::VisitGuardedExpr().
Definition at line 112 of file SValBuilder.cpp.
References ArrayIndexTy, ArrayIndexWidth, evalCast(), clang::ento::SVal::getAs(), and clang::ento::SVal::isUnknownOrUndef().
SVal SValBuilder::evalBinOp | ( | ProgramStateRef | state, |
BinaryOperator::Opcode | op, | ||
SVal | lhs, | ||
SVal | rhs, | ||
QualType | type | ||
) |
Definition at line 437 of file SValBuilder.cpp.
References clang::ento::SVal::castAs(), evalBinOpLL(), evalBinOpLN(), evalBinOpNN(), clang::ento::SVal::getAs(), clang::ento::SVal::isUndef(), clang::ento::SVal::isUnknown(), makeIntVal(), and state.
Referenced by clang::ento::ExprEngine::bindReturnValue(), clang::ento::ExprEngine::evalBinOp(), and evalEQ().
|
pure virtual |
Create a new value which represents a binary expression with two memory location operands.
Referenced by evalBinOp().
|
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().
|
pure virtual |
Create a new value which represents a binary expression with two non- location operands.
Referenced by clang::ento::ProgramState::assumeInBoundDual(), clang::ento::iterator::assumeNoOverflow(), evalBinOp(), clang::ento::ExprEngine::evalBinOp(), and evalIntegralCast().
Cast a given SVal to another SVal using given QualType's.
V | – SVal that should be casted. |
CastTy | – QualType that V should be casted according to. |
OriginalTy | – QualType which is associated to V. It provides additional information about what type the cast performs from. |
OriginalTy.isNull()
is true, then cast performs based on CastTy only. This behavior is uncertain and should be improved. Definition at line 591 of file SValBuilder.cpp.
References Context, evalCastKind(), clang::ASTContext::getCanonicalType(), clang::ASTContext::getPointerType(), clang::QualType::isNull(), clang::Type::isVariableArrayType(), shouldBeModeledWithNoOp(), and V.
Referenced by clang::ento::SimpleConstraintManager::assumeInternal(), convertToArrayIndex(), evalIntegralCast(), getConstantVal(), clang::ento::CXXInstanceCall::getInitialStackFrameContents(), clang::ento::ExprEngine::handleLValueBitCast(), clang::ento::ExprEngine::processCallExit(), clang::ento::ExprEngine::VisitCast(), clang::ento::ExprEngine::VisitCXXNewExpr(), and clang::ento::ExprEngine::VisitLogicalExpr().
Definition at line 638 of file SValBuilder.cpp.
References evalCastSubKind(), and V.
Definition at line 651 of file SValBuilder.cpp.
References evalCastSubKind(), and V.
|
protected |
Definition at line 628 of file SValBuilder.cpp.
References V.
Referenced by evalCast(), and evalCastSubKind().
|
protected |
Definition at line 633 of file SValBuilder.cpp.
References V.
|
protected |
Definition at line 673 of file SValBuilder.cpp.
References clang::ento::APSIntType::apply(), BasicVals, clang::ento::BasicValueFactory::getAPSIntType(), clang::Type::isBooleanType(), clang::Type::isIntegralOrEnumerationType(), clang::ento::Loc::isLocType(), makeIntVal(), makeTruthVal(), and V.
Referenced by evalCastKind(), and evalCastSubKind().
|
protected |
Definition at line 697 of file SValBuilder.cpp.
References Context, clang::ASTContext::getIntWidth(), clang::Type::isBooleanType(), clang::Type::isIntegralOrEnumerationType(), clang::ento::Loc::isLocType(), clang::QualType::isNull(), clang::Type::isPointerType(), clang::Type::isReferenceType(), makeLocAsInteger(), makeTruthVal(), and V.
|
protected |
Definition at line 731 of file SValBuilder.cpp.
References clang::ento::ProgramStateManager::ArrayToPointer(), BasicVals, clang::ento::SVal::castAs(), Context, clang::QualType::getCanonicalType(), getCastedMemRegionVal(), clang::ento::SymbolManager::getExtentSymbol(), clang::ASTContext::getIntWidth(), clang::ento::MemRegion::getSymbolicBase(), clang::ento::SymExpr::getType(), clang::ento::BasicValueFactory::getZeroWithTypeSize(), hasSameUnqualifiedPointeeType(), clang::Type::isBlockPointerType(), clang::Type::isBooleanType(), clang::Type::isFunctionPointerType(), clang::Type::isFunctionType(), clang::Type::isIntegralOrEnumerationType(), clang::ento::Loc::isLocType(), clang::QualType::isNull(), clang::Type::isPointerType(), clang::Type::isReferenceType(), clang::Type::isVoidPointerType(), makeLocAsInteger(), makeNonLoc(), makeTruthVal(), StateMgr, SymMgr, and V.
|
protected |
Definition at line 869 of file SValBuilder.cpp.
|
protected |
Definition at line 875 of file SValBuilder.cpp.
References clang::ento::APSIntType::apply(), BasicVals, clang::ento::BasicValueFactory::getAPSIntType(), clang::ento::Loc::isLocType(), makeIntLocVal(), makeIntVal(), makeTruthVal(), and V.
|
protected |
Definition at line 899 of file SValBuilder.cpp.
|
protected |
Definition at line 905 of file SValBuilder.cpp.
References Context, evalCastKind(), evalCastSubKind(), clang::ento::SVal::getAsRegion(), getCastedMemRegionVal(), clang::ASTContext::getIntWidth(), clang::ento::SymExpr::getType(), clang::Type::isBooleanType(), clang::Type::isFloatingType(), clang::Type::isFunctionType(), clang::Type::isIntegralOrEnumerationType(), clang::ento::Loc::isLocType(), clang::QualType::isNull(), clang::Type::isReferenceType(), makeLocAsInteger(), clang::ento::MemRegion::StripCasts(), and V.
|
protected |
Definition at line 1008 of file SValBuilder.cpp.
References V.
|
protected |
Definition at line 968 of file SValBuilder.cpp.
References Context, clang::ento::ExprEngine::getAnalysisManager(), clang::ento::AnalysisManager::getAnalyzerOptions(), getBasicValueFactory(), clang::ASTContext::getCanonicalType(), clang::ento::ProgramStateManager::getOwningEngine(), clang::ento::SymExpr::getType(), clang::Type::isBooleanType(), clang::Type::isFloatingType(), clang::Type::isIntegralOrEnumerationType(), clang::Type::isIntegralOrUnscopedEnumerationType(), clang::ento::Loc::isLocType(), clang::Type::isMemberPointerType(), clang::QualType::isNull(), makeNonLoc(), simplifySymbolCast(), StateMgr, and V.
Referenced by clang::ento::ExprEngine::evalComplement().
DefinedOrUnknownSVal SValBuilder::evalEQ | ( | ProgramStateRef | state, |
DefinedOrUnknownSVal | lhs, | ||
DefinedOrUnknownSVal | rhs | ||
) |
Definition at line 497 of file SValBuilder.cpp.
References clang::ento::SVal::castAs(), evalEQ(), and state.
SVal SValBuilder::evalEQ | ( | ProgramStateRef | state, |
SVal | lhs, | ||
SVal | rhs | ||
) |
Definition at line 493 of file SValBuilder.cpp.
References evalBinOp(), getConditionType(), and state.
Referenced by areEqual(), and evalEQ().
SVal SValBuilder::evalIntegralCast | ( | ProgramStateRef | state, |
SVal | val, | ||
QualType | castTy, | ||
QualType | originalType | ||
) |
Definition at line 540 of file SValBuilder.cpp.
References clang::ento::SVal::castAs(), evalBinOpNN(), evalCast(), clang::ento::SVal::getAsSymbol(), getConditionType(), getContext(), clang::ento::APSIntType::getMaxValue(), clang::Type::isUnsignedIntegerType(), makeIntVal(), makeNonLoc(), and state.
Referenced by clang::ento::ExprEngine::VisitCast().
Referenced by clang::ento::ExprEngine::evalMinus().
|
inline |
Definition at line 189 of file SValBuilder.h.
References AnOpts.
Referenced by clang::ento::MemRegionManager::getStaticSize().
|
inline |
Definition at line 176 of file SValBuilder.h.
References ArrayIndexTy.
Referenced by clang::ento::ProgramState::assumeInBoundDual(), clang::ento::ExprEngine::bindReturnValue(), and clang::ento::MemRegionManager::getStaticSize().
|
inline |
Definition at line 180 of file SValBuilder.h.
References BasicVals.
Referenced by clang::ento::ProgramState::assumeInBoundDual(), clang::ento::iterator::assumeNoOverflow(), clang::ento::nonloc::ConcreteInt::evalBinOp(), evalCastSubKind(), clang::ento::SimpleConstraintManager::getBasicVals(), getBVF(), and simplifySymbolCast().
|
inline |
Definition at line 181 of file SValBuilder.h.
References BasicVals.
DefinedSVal SValBuilder::getBlockPointer | ( | const BlockDecl * | block, |
CanQualType | locTy, | ||
const LocationContext * | locContext, | ||
unsigned | blockCount | ||
) |
Definition at line 279 of file SValBuilder.cpp.
References clang::LocationContext::getAnalysisDeclContext(), clang::ento::MemRegionManager::getBlockCodeRegion(), clang::ento::MemRegionManager::getBlockDataRegion(), and MemMgr.
Referenced by clang::ento::ExprEngine::VisitBlockExpr().
Optional< loc::MemRegionVal > SValBuilder::getCastedMemRegionVal | ( | const MemRegion * | region, |
QualType | type | ||
) |
Return MemRegionVal on success cast, otherwise return None.
Definition at line 291 of file SValBuilder.cpp.
References clang::ento::StoreManager::castRegion(), clang::ento::ProgramStateManager::getStoreManager(), and StateMgr.
Referenced by evalCastSubKind().
|
inline |
Definition at line 172 of file SValBuilder.h.
References clang::ASTContext::BoolTy, Context, clang::ASTContext::getLangOpts(), and clang::ASTContext::IntTy.
Referenced by clang::ento::iterator::assumeNoOverflow(), evalEQ(), evalIntegralCast(), and clang::ento::ExprEngine::getInitialState().
DefinedOrUnknownSVal clang::ento::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!
DefinedOrUnknownSVal clang::ento::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.
Referenced by clang::ento::ExprEngine::bindReturnValue(), and clang::ento::ExprEngine::VisitCXXNewExpr().
Returns the value of E
, if it can be determined in a non-path-sensitive manner.
If E
is not a constant or cannot be modeled, returns None
.
Definition at line 312 of file SValBuilder.cpp.
References evalCast(), clang::Expr::EvaluateAsInt(), getContext(), getRegionManager(), clang::Stmt::getStmtClass(), clang::Expr::getType(), clang::Expr::IgnoreParens(), clang::Expr::isGLValue(), clang::ento::Loc::isLocType(), clang::Expr::isNullPointerConstant(), makeBoolVal(), makeIntVal(), makeLoc(), makeNullWithType(), makeTruthVal(), makeZeroVal(), and clang::Expr::NPC_ValueDependentIsNotNull.
|
inline |
Definition at line 167 of file SValBuilder.h.
References Context.
Referenced by clang::ento::ProgramState::assumeInBoundDual(), clang::ento::SimpleConstraintManager::assumeInternal(), clang::ento::ExprEngine::computeObjectUnderConstruction(), evalIntegralCast(), getConstantVal(), getCXXThis(), clang::ento::CXXInstanceCall::getInitialStackFrameContents(), and clang::ento::StoreManager::MakeElementRegion().
|
inline |
Definition at line 168 of file SValBuilder.h.
References Context.
loc::MemRegionVal SValBuilder::getCXXThis | ( | const CXXMethodDecl * | D, |
const StackFrameContext * | SFC | ||
) |
Return a memory region for the 'this' object reference.
Definition at line 298 of file SValBuilder.cpp.
References getRegionManager(), and clang::CXXMethodDecl::getThisType().
Referenced by clang::ento::ExprEngine::computeObjectUnderConstruction(), clang::ento::BlockCall::getInitialStackFrameContents(), clang::ento::CXXInstanceCall::getInitialStackFrameContents(), clang::ento::AnyCXXConstructorCall::getInitialStackFrameContents(), clang::ento::ExprEngine::getInitialState(), clang::ento::ExprEngine::ProcessBaseDtor(), clang::ento::ExprEngine::processCallExit(), clang::ento::ExprEngine::ProcessInitializer(), clang::ento::ExprEngine::ProcessMemberDtor(), and clang::ento::ExprEngine::VisitCommonDeclRefExpr().
loc::MemRegionVal SValBuilder::getCXXThis | ( | const CXXRecordDecl * | D, |
const StackFrameContext * | SFC | ||
) |
Return a memory region for the 'this' object reference.
Definition at line 305 of file SValBuilder.cpp.
References getContext(), clang::ASTContext::getPointerType(), getRegionManager(), and clang::TypeDecl::getTypeForDecl().
DefinedOrUnknownSVal SValBuilder::getDerivedRegionValueSymbolVal | ( | SymbolRef | parentSymbol, |
const TypedValueRegion * | region | ||
) |
Definition at line 241 of file SValBuilder.cpp.
References clang::ento::SymbolManager::canSymbolicate(), clang::ento::SymbolManager::getDerivedSymbol(), clang::ento::MemRegionManager::getSymbolicRegion(), clang::ento::TypedValueRegion::getValueType(), clang::ento::Loc::isLocType(), clang::Type::isNullPtrType(), makeZeroVal(), MemMgr, and SymMgr.
DefinedSVal SValBuilder::getFunctionPointer | ( | const FunctionDecl * | func | ) |
Definition at line 275 of file SValBuilder.cpp.
References clang::ento::MemRegionManager::getFunctionCodeRegion(), and MemMgr.
Referenced by getMemberPointer(), clang::ento::ExprEngine::VisitCommonDeclRefExpr(), and clang::ento::ExprEngine::VisitMemberExpr().
|
pure virtual |
DefinedSVal SValBuilder::getMemberPointer | ( | const NamedDecl * | ND | ) |
Definition at line 259 of file SValBuilder.cpp.
References getFunctionPointer(), and clang::prec::PointerToMember.
Referenced by clang::ento::ExprEngine::VisitCast(), and clang::ento::ExprEngine::VisitUnaryOperator().
DefinedSVal SValBuilder::getMetadataSymbolVal | ( | const void * | symbolTag, |
const MemRegion * | region, | ||
const Expr * | expr, | ||
QualType | type, | ||
const LocationContext * | LCtx, | ||
unsigned | count | ||
) |
Definition at line 224 of file SValBuilder.cpp.
References clang::ento::SymbolManager::canSymbolicate(), clang::ast_matchers::expr, clang::ento::SymbolManager::getMetadataSymbol(), clang::ento::MemRegionManager::getSymbolicRegion(), clang::ento::Loc::isLocType(), MemMgr, and SymMgr.
|
inline |
Definition at line 186 of file SValBuilder.h.
References MemMgr.
Referenced by clang::ento::ExprEngine::computeObjectUnderConstruction(), getConstantVal(), getCXXThis(), clang::ento::ObjCMethodCall::getInitialStackFrameContents(), clang::ento::ExprEngine::VisitCXXThisExpr(), and clang::ento::ExprEngine::VisitLambdaExpr().
|
inline |
Definition at line 187 of file SValBuilder.h.
References MemMgr.
DefinedOrUnknownSVal SValBuilder::getRegionValueSymbolVal | ( | const TypedValueRegion * | region | ) |
Make a unique symbol for value of region.
Definition at line 131 of file SValBuilder.cpp.
References clang::ento::SymbolManager::canSymbolicate(), clang::ento::SymbolManager::getRegionValueSymbol(), clang::ento::MemRegionManager::getSymbolicRegion(), clang::ento::TypedValueRegion::getValueType(), clang::ento::Loc::isLocType(), clang::Type::isNullPtrType(), makeZeroVal(), MemMgr, and SymMgr.
|
inline |
Definition at line 170 of file SValBuilder.h.
References StateMgr.
|
inline |
Definition at line 183 of file SValBuilder.h.
References SymMgr.
Referenced by clang::ento::MemRegionManager::getStaticSize(), clang::ento::SimpleConstraintManager::getSymbolManager(), and clang::ento::CheckerContext::getSymbolManager().
|
inline |
Definition at line 184 of file SValBuilder.h.
References SymMgr.
|
inline |
Definition at line 294 of file SValBuilder.h.
References ArrayIndexTy, and BasicVals.
Referenced by clang::ento::StoreManager::MakeElementRegion().
nonloc::ConcreteInt SValBuilder::makeBoolVal | ( | const CXXBoolLiteralExpr * | boolean | ) |
Definition at line 126 of file SValBuilder.cpp.
References clang::CXXBoolLiteralExpr::getValue(), and makeTruthVal().
|
inline |
Definition at line 306 of file SValBuilder.h.
References clang::Expr::getType(), clang::ObjCBoolLiteralExpr::getValue(), and makeTruthVal().
Referenced by getConstantVal().
|
inline |
Definition at line 272 of file SValBuilder.h.
References BasicVals, and clang::ento::BasicValueFactory::getCompoundValData().
Referenced by makeZeroVal(), and clang::ento::ExprEngine::VisitInitListExpr().
|
inline |
Definition at line 316 of file SValBuilder.h.
References BasicVals.
Referenced by evalCastSubKind().
|
inline |
Definition at line 300 of file SValBuilder.h.
References BasicVals, clang::Expr::getType(), clang::APIntStorage::getValue(), and clang::Type::isUnsignedIntegerOrEnumerationType().
Referenced by clang::ento::ExprEngine::bindReturnValue(), evalBinOp(), evalCastSubKind(), clang::ento::nonloc::ConcreteInt::evalComplement(), clang::ento::ExprEngine::evalEagerlyAssumeBinOpBifurcation(), evalIntegralCast(), clang::ento::nonloc::ConcreteInt::evalMinus(), getConstantVal(), clang::ento::MemRegionManager::getStaticSize(), clang::ento::CheckerContext::isGreaterOrEqual(), clang::ento::CheckerContext::isNegative(), makeZeroVal(), clang::ento::ExprEngine::VisitCommonDeclRefExpr(), clang::ento::ExprEngine::VisitLogicalExpr(), and clang::ento::ExprEngine::VisitUnaryExprOrTypeTraitExpr().
Definition at line 320 of file SValBuilder.h.
References BasicVals.
|
inline |
Definition at line 312 of file SValBuilder.h.
References BasicVals.
Definition at line 331 of file SValBuilder.h.
References BasicVals, and clang::ento::BasicValueFactory::getIntValue().
|
inline |
Definition at line 324 of file SValBuilder.h.
References BasicVals, and clang::ento::Loc::isLocType().
Definition at line 335 of file SValBuilder.h.
References BasicVals.
|
inline |
Definition at line 276 of file SValBuilder.h.
References BasicVals, and clang::ento::BasicValueFactory::getLazyCompoundValData().
|
inline |
Definition at line 392 of file SValBuilder.h.
References clang::ast_matchers::expr.
|
inline |
Definition at line 396 of file SValBuilder.h.
References BasicVals.
|
inline |
Definition at line 388 of file SValBuilder.h.
|
inline |
Definition at line 384 of file SValBuilder.h.
References clang::ento::MemRegionManager::getSymbolicRegion(), and MemMgr.
Referenced by clang::ento::ExprEngine::computeObjectUnderConstruction(), getConstantVal(), clang::ento::ObjCMethodCall::getInitialStackFrameContents(), clang::ento::StoreManager::getLValueVar(), and makeSymbolVal().
Definition at line 339 of file SValBuilder.h.
References BasicVals, and clang::ento::BasicValueFactory::getPersistentSValWithData().
Referenced by evalCastSubKind().
nonloc::SymbolVal clang::ento::SValBuilder::makeNonLoc | ( | const llvm::APSInt & | rhs, |
BinaryOperator::Opcode | op, | ||
const SymExpr * | lhs, | ||
QualType | type | ||
) |
nonloc::SymbolVal SValBuilder::makeNonLoc | ( | const SymExpr * | lhs, |
BinaryOperator::Opcode | op, | ||
const llvm::APSInt & | rhs, | ||
QualType | type | ||
) |
Definition at line 77 of file SValBuilder.cpp.
References clang::ento::SymbolManager::getSymIntExpr(), clang::ento::Loc::isLocType(), and SymMgr.
Referenced by evalCastSubKind(), evalIntegralCast(), makeSymExprValNN(), and simplifySymbolCast().
nonloc::SymbolVal SValBuilder::makeNonLoc | ( | const SymExpr * | lhs, |
BinaryOperator::Opcode | op, | ||
const SymExpr * | rhs, | ||
QualType | type | ||
) |
Definition at line 97 of file SValBuilder.cpp.
References clang::ento::SymbolManager::getSymSymExpr(), clang::ento::Loc::isLocType(), and SymMgr.
nonloc::SymbolVal SValBuilder::makeNonLoc | ( | const SymExpr * | operand, |
QualType | fromTy, | ||
QualType | toTy | ||
) |
Create a NonLoc value for cast.
Definition at line 105 of file SValBuilder.cpp.
References clang::ento::SymbolManager::getCastSymbol(), clang::ento::Loc::isLocType(), and SymMgr.
|
inline |
Create NULL pointer, with proper pointer bit-width for given address space.
type | pointer type. |
Definition at line 368 of file SValBuilder.h.
References BasicVals, Context, clang::ASTContext::getPointerType(), clang::ento::BasicValueFactory::getZeroWithTypeSize(), and clang::ast_matchers::type.
Referenced by getConstantVal(), makeZeroVal(), and clang::ento::ExprEngine::VisitCast().
|
inline |
Definition at line 282 of file SValBuilder.h.
References clang::prec::PointerToMember.
Referenced by clang::ento::ExprEngine::VisitCast().
|
inline |
Definition at line 286 of file SValBuilder.h.
References clang::prec::PointerToMember.
|
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 407 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().
SVal SValBuilder::makeSymExprValNN | ( | BinaryOperator::Opcode | op, |
NonLoc | lhs, | ||
NonLoc | rhs, | ||
QualType | resultTy | ||
) |
Constructs a symbolic expression for two non-location values.
Definition at line 412 of file SValBuilder.cpp.
References AnOpts, clang::ento::SymExpr::computeComplexity(), clang::ento::SVal::getAs(), clang::ento::SVal::getAsSymbol(), and makeNonLoc().
|
inline |
Definition at line 361 of file SValBuilder.h.
References b, BasicVals, and clang::ento::BasicValueFactory::getTruthValue().
|
inline |
Definition at line 357 of file SValBuilder.h.
References b, BasicVals, and clang::ento::BasicValueFactory::getTruthValue().
Referenced by evalCastSubKind(), getConstantVal(), makeBoolVal(), and clang::ento::ExprEngine::VisitCast().
|
inline |
Definition at line 290 of file SValBuilder.h.
References ArrayIndexTy, and BasicVals.
Referenced by clang::ento::StoreManager::GetElementZeroRegion().
DefinedOrUnknownSVal SValBuilder::makeZeroVal | ( | QualType | type | ) |
Construct an SVal representing '0' for the specified type.
Definition at line 62 of file SValBuilder.cpp.
References BasicVals, clang::ento::BasicValueFactory::getEmptySValList(), clang::ento::Loc::isLocType(), makeCompoundVal(), makeIntVal(), and makeNullWithType().
Referenced by conjureSymbolVal(), getConstantVal(), getDerivedRegionValueSymbolVal(), clang::ento::ExprEngine::getInitialState(), getRegionValueSymbolVal(), and clang::ento::ExprEngine::VisitUnaryOperator().
|
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::simplifyToSVal().
|
protected |
Reduce cast expression by removing redundant intermediate casts.
E.g.
V | – SymbolVal, which pressumably contains SymbolCast or any symbol that is applicable for cast operation. |
CastTy | – QualType, which V shall be cast to. |
Definition at line 1014 of file SValBuilder.cpp.
References Context, clang::ento::BasicValueFactory::getAPSIntType(), getBasicValueFactory(), clang::ento::APSIntType::getBitWidth(), clang::QualType::getCanonicalType(), clang::ASTContext::getCanonicalType(), clang::ento::SymExpr::getType(), clang::ento::APSIntType::isUnsigned(), makeNonLoc(), and V.
Referenced by evalCastSubKind().
|
protected |
Definition at line 70 of file SValBuilder.h.
Referenced by getAnalyzerOptions(), and makeSymExprValNN().
|
protected |
The scalar type to use for array indices.
Definition at line 73 of file SValBuilder.h.
Referenced by convertToArrayIndex(), getArrayIndexType(), makeArrayIndex(), and makeZeroArrayIndex().
|
protected |
The width of the scalar type used for array indices.
Definition at line 76 of file SValBuilder.h.
Referenced by convertToArrayIndex().
|
protected |
Manager of APSInt values.
Definition at line 60 of file SValBuilder.h.
Referenced by evalCastSubKind(), getBasicValueFactory(), makeArrayIndex(), makeCompoundVal(), makeIntLocVal(), makeIntVal(), makeIntValWithWidth(), makeLazyCompoundVal(), makeLoc(), makeLocAsInteger(), makeNullWithType(), makeTruthVal(), makeZeroArrayIndex(), and makeZeroVal().
|
protected |
Definition at line 57 of file SValBuilder.h.
Referenced by evalCast(), evalCastSubKind(), getConditionType(), getContext(), makeNullWithType(), and simplifySymbolCast().
|
protected |
Manages the creation of memory regions.
Definition at line 66 of file SValBuilder.h.
Referenced by conjureSymbolVal(), getBlockPointer(), getDerivedRegionValueSymbolVal(), getFunctionPointer(), getMetadataSymbolVal(), getRegionManager(), getRegionValueSymbolVal(), and makeLoc().
|
protected |
Definition at line 68 of file SValBuilder.h.
Referenced by evalCastSubKind(), getCastedMemRegionVal(), and getStateManager().
|
protected |
Manages the creation of symbols.
Definition at line 63 of file SValBuilder.h.
Referenced by conjureSymbol(), conjureSymbolVal(), evalCastSubKind(), getDerivedRegionValueSymbolVal(), getMetadataSymbolVal(), getRegionValueSymbolVal(), getSymbolManager(), and makeNonLoc().