14 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_SVALBUILDER_H 15 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_SVALBUILDER_H 30 #include "llvm/ADT/ImmutableList.h" 31 #include "llvm/ADT/Optional.h" 37 class CXXBoolLiteralExpr;
42 class LocationContext;
43 class StackFrameContext;
48 class ConditionTruthVal;
49 class ProgramStateManager;
53 virtual void anchor();
86 : Context(context), BasicVals(context, alloc),
87 SymMgr(context, BasicVals, alloc), MemMgr(context, alloc),
88 StateMgr(stateMgr), ArrayIndexTy(context.LongLongTy),
89 ArrayIndexWidth(context.getTypeSize(ArrayIndexTy)) {}
183 const void *symbolTag =
nullptr) {
184 return SymMgr.
conjureSymbol(stmt, LCtx, type, visitCount, symbolTag);
190 const void *symbolTag =
nullptr) {
191 return SymMgr.
conjureSymbol(expr, LCtx, visitCount, symbolTag);
218 unsigned visitCount);
242 unsigned blockCount);
280 BasicVals.getValue(integer->
getValue(),
395 #endif // LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_SVALBUILDER_H
Defines the clang::ASTContext interface.
Represents a function declaration or definition.
const SymbolConjured * conjureSymbol(const Stmt *E, const LocationContext *LCtx, QualType T, unsigned VisitCount, const void *SymbolTag=nullptr)
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.
C Language Family Type Representation.
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()
SVal makeSymbolVal(SymbolRef Sym)
Make an SVal that represents the given symbol.
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)
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
SVal makeSymExprValNN(BinaryOperator::Opcode op, NonLoc lhs, NonLoc rhs, QualType resultTy)
Constructs a symbolic expression for two non-location values.
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)
ConditionTruthVal areEqual(ProgramStateRef state, SVal lhs, SVal rhs)
Loc makeLoc(SymbolRef sym)
DefinedOrUnknownSVal makeZeroVal(QualType type)
Construct an SVal representing '0' for the specified type.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
This represents one expression.
Defines the clang::LangOptions interface.
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)
DefinedOrUnknownSVal conjureSymbolVal(const void *symbolTag, const Expr *expr, const LocationContext *LCtx, unsigned count)
Create a new symbol with a unique 'name'.
SymbolManager SymMgr
Manages the creation of symbols.
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 evalEQ(ProgramStateRef state, SVal lhs, SVal rhs)
Represents symbolic expression that isn't a location.
SVal convertToArrayIndex(SVal val)
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.
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 ~SValBuilder()=default
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