15 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_SVALBUILDER_H 16 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_SVALBUILDER_H 28 class CXXBoolLiteralExpr;
33 virtual void anchor();
65 : Context(context), BasicVals(context, alloc),
66 SymMgr(context, BasicVals, alloc),
67 MemMgr(context, alloc),
69 ArrayIndexTy(context.LongLongTy),
70 ArrayIndexWidth(context.getTypeSize(ArrayIndexTy)) {}
159 const void *symbolTag =
nullptr) {
160 return SymMgr.
conjureSymbol(stmt, LCtx, type, visitCount, symbolTag);
166 const void *symbolTag =
nullptr) {
167 return SymMgr.
conjureSymbol(expr, LCtx, visitCount, symbolTag);
195 unsigned visitCount);
218 unsigned blockCount);
256 BasicVals.getValue(integer->
getValue(),
299 const llvm::APSInt& rhs,
QualType type);
Defines the clang::ASTContext interface.
An instance of this class is created to represent a function declaration or definition.
TypedValueRegion - An abstract class representing regions having a typed value.
nonloc::ConcreteInt makeIntVal(const IntegerLiteral *integer)
DefinedSVal getBlockPointer(const BlockDecl *block, CanQualType locTy, const LocationContext *locContext, unsigned blockCount)
SymbolManager & getSymbolManager()
QualType getArrayIndexType() const
A (possibly-)qualified type.
MemRegion - The root abstract class for all memory regions.
bool isUnsignedIntegerOrEnumerationType() const
Determines whether this is an integer type that is unsigned or an enumeration types whose underlying ...
const internal::VariadicAllOfMatcher< Stmt > stmt
Matches statements.
const CompoundValData * getCompoundValData(QualType T, llvm::ImmutableList< SVal > Vals)
SValBuilder * createSimpleSValBuilder(llvm::BumpPtrAllocator &alloc, ASTContext &context, ProgramStateManager &stateMgr)
Stmt - This represents one statement.
SVal makeSymExprValNN(ProgramStateRef state, BinaryOperator::Opcode op, NonLoc lhs, NonLoc rhs, QualType resultTy)
Constructs a symbolic expression for two non-location values.
ProgramStateManager & StateMgr
const llvm::APSInt & getZeroWithTypeSize(QualType T)
virtual SVal simplifySVal(ProgramStateRef State, SVal Val)=0
Simplify symbolic expressions within a given SVal.
SVal evalCast(SVal val, QualType castTy, QualType originalType)
Value representing integer constant.
MemRegionManager MemMgr
Manages the creation of memory regions.
const llvm::APSInt & getTruthValue(bool b, QualType T)
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
virtual SVal dispatchCast(SVal val, QualType castTy)=0
loc::MemRegionVal getCXXThis(const CXXMethodDecl *D, const StackFrameContext *SFC)
Return a memory region for the 'this' object reference.
NonLoc makeNonLoc(const SymExpr *lhs, BinaryOperator::Opcode op, const llvm::APSInt &rhs, QualType type)
NonLoc makeArrayIndex(uint64_t idx)
BasicValueFactory BasicVals
Manager of APSInt values.
virtual SVal evalCastFromNonLoc(NonLoc val, QualType castTy)=0
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 opera...
MemRegionManager & getRegionManager()
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
SVal evalIntegralCast(ProgramStateRef state, SVal val, QualType castTy, QualType originalType)
Loc makeNullWithType(QualType type)
Create NULL pointer, with proper pointer bit-width for given address space.
DefinedOrUnknownSVal getDerivedRegionValueSymbolVal(SymbolRef parentSymbol, const TypedValueRegion *region)
i32 captured_struct **param SharedsTy A type which contains references the shared variables *param Shareds Context with the list of shared variables from the p *TaskFunction *param Data Additional data for task generation like final * state
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
const SymbolicRegion * getSymbolicRegion(SymbolRef Sym)
Retrieve or create a "symbolic" memory region.
static bool isLocType(QualType T)
NonLoc makePointerToMember(const DeclaratorDecl *DD)
DefinedOrUnknownSVal getRegionValueSymbolVal(const TypedValueRegion *region)
Make a unique symbol for value of region.
Loc makeLoc(const MemRegion *region)
Loc makeLoc(const AddrLabelExpr *expr)
loc::ConcreteInt makeIntLocVal(const llvm::APSInt &integer)
NonLoc makeCompoundVal(QualType type, llvm::ImmutableList< SVal > vals)
DefinedSVal getFunctionPointer(const FunctionDecl *func)
NonLoc makeIntValWithPtrWidth(uint64_t integer, bool isUnsigned)
bool haveSameType(QualType Ty1, QualType Ty2)
const llvm::APSInt & getIntValue(uint64_t X, bool isUnsigned)
virtual QualType getType() const =0
Represents a ValueDecl that came out of a declarator.
nonloc::ConcreteInt makeBoolVal(const ObjCBoolLiteralExpr *boolean)
Loc makeLoc(SymbolRef sym)
DefinedOrUnknownSVal makeZeroVal(QualType type)
Construct an SVal representing '0' for the specified type.
BlockDecl - This represents a block literal declaration, which is like an unnamed FunctionDecl...
Expr - This represents one expression.
virtual SVal evalMinus(NonLoc val)=0
const llvm::APSInt & getIntWithPtrWidth(uint64_t X, bool isUnsigned)
nonloc::ConcreteInt makeTruthVal(bool b)
const QualType ArrayIndexTy
The scalar type to use for array indices.
QualType getConditionType() const
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.
SVal evalBinOp(ProgramStateRef state, BinaryOperator::Opcode op, SVal lhs, SVal rhs, QualType type)
const BasicValueFactory & getBasicValueFactory() const
nonloc::ConcreteInt makeIntVal(const llvm::APSInt &integer)
NonLoc makeZeroArrayIndex()
NonLoc makeIntVal(uint64_t integer, bool isUnsigned)
SymbolManager SymMgr
Manages the creation of symbols.
DefinedOrUnknownSVal conjureSymbolVal(const void *symbolTag, const Expr *expr, const LocationContext *LCtx, unsigned count)
Create a new symbol with a unique 'name'.
virtual SVal evalCastFromLoc(Loc val, QualType castTy)=0
Represents a static or instance method of a struct/union/class.
ASTContext & getContext()
SVal - This represents a symbolic expression, which can be either an L-value or an R-value...
const llvm::APSInt & getZeroWithPtrWidth(bool isUnsigned=true)
DefinedOrUnknownSVal getConjuredHeapSymbolVal(const Expr *E, const LocationContext *LCtx, unsigned Count)
Conjure a symbol representing heap allocated memory region.
A symbol representing the result of an expression in the case when we do not know anything about what...
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.
const unsigned ArrayIndexWidth
The width of the scalar type used for array indices.
const MemRegionManager & getRegionManager() const
AddrLabelExpr - The GNU address of label extension, representing &&label.
Dataflow Directional Tag Classes.
NonLoc makeIntVal(const llvm::APInt &integer, bool isUnsigned)
const SymbolConjured * conjureSymbol(const Stmt *stmt, const LocationContext *LCtx, QualType type, unsigned visitCount, const void *symbolTag=nullptr)
NonLoc makeLocAsInteger(Loc loc, unsigned bits)
ProgramStateManager & getStateManager()
SVal convertToArrayIndex(SVal val)
const SymbolConjured * conjureSymbol(const Stmt *E, const LocationContext *LCtx, QualType T, unsigned VisitCount, const void *SymbolTag=nullptr)
DefinedSVal getMetadataSymbolVal(const void *symbolTag, const MemRegion *region, const Expr *expr, QualType type, const LocationContext *LCtx, unsigned count)
llvm::APInt getValue() const
LabelDecl * getLabel() const
BasicValueFactory & getBasicValueFactory()
Loc makeLoc(const llvm::APSInt &integer)
DefinedSVal getMemberPointer(const DeclaratorDecl *DD)
SValBuilder(llvm::BumpPtrAllocator &alloc, ASTContext &context, ProgramStateManager &stateMgr)
const std::pair< SVal, uintptr_t > & getPersistentSValWithData(const SVal &V, uintptr_t Data)
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
bool haveSameType(const SymExpr *Sym1, const SymExpr *Sym2)
const LazyCompoundValData * getLazyCompoundValData(const StoreRef &store, const TypedValueRegion *region)
Represents a C++ struct/union/class.
DefinedOrUnknownSVal evalEQ(ProgramStateRef state, DefinedOrUnknownSVal lhs, DefinedOrUnknownSVal rhs)
virtual SVal evalComplement(NonLoc val)=0
Optional< SVal > getConstantVal(const Expr *E)
Returns the value of E, if it can be determined in a non-path-sensitive manner.
const SymbolConjured * conjureSymbol(const Expr *expr, const LocationContext *LCtx, unsigned visitCount, const void *symbolTag=nullptr)
virtual const llvm::APSInt * getKnownValue(ProgramStateRef state, SVal val)=0
Evaluates a given SVal.
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
NonLoc makePointerToMember(const PointerToMemberData *PTMD)
const ASTContext & getContext() const
nonloc::ConcreteInt makeTruthVal(bool b, QualType type)
DefinedSVal makeIntVal(uint64_t integer, QualType type)
NonLoc makeLazyCompoundVal(const StoreRef &store, const TypedValueRegion *region)
A boolean literal, per ([C++ lex.bool] Boolean literals).
const SymbolManager & getSymbolManager() const
const LangOptions & getLangOpts() const