20 using namespace clang;
25 class BuiltinFunctionChecker :
public Checker<eval::Call> {
32 bool BuiltinFunctionChecker::evalCall(
const CallExpr *CE,
44 case Builtin::BI__builtin_assume: {
47 if (ArgSVal.isUndef())
62 case Builtin::BI__builtin_unpredictable:
63 case Builtin::BI__builtin_expect:
64 case Builtin::BI__builtin_assume_aligned:
65 case Builtin::BI__builtin_addressof: {
76 case Builtin::BI__builtin_alloca_with_align:
77 case Builtin::BI__builtin_alloca: {
91 svalBuilder.evalEQ(state, Extent, Size);
92 state = state->assume(extentMatchesSizeArg,
true);
93 assert(state &&
"The region should not have any previous constraints");
99 case Builtin::BI__builtin_object_size:
100 case Builtin::BI__builtin_constant_p: {
Represents a function declaration or definition.
nonloc::ConcreteInt makeIntVal(const IntegerLiteral *integer)
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
ExplodedNode * addTransition(ProgramStateRef State=nullptr, const ProgramPointTag *Tag=nullptr)
Generates a new transition in the program state graph (ExplodedGraph).
Strictly evaluate the expression.
AllocaRegion - A region that represents an untyped blob of bytes created by a call to 'alloca'...
bool EvaluateAsInt(llvm::APSInt &Result, const ASTContext &Ctx, SideEffectsKind AllowSideEffects=SE_NoSideEffects) const
EvaluateAsInt - Return true if this is a constant which we can fold and convert to an integer...
const FunctionDecl * getCalleeDecl(const CallExpr *CE) const
Get the declaration of the called function (path-sensitive).
ExplodedNode * getPredecessor()
Returns the previous node in the exploded graph, which includes the state of the program before the c...
SVal getSVal(const Stmt *S) const
Get the value of arbitrary expressions at this point in the path.
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
const AllocaRegion * getAllocaRegion(const Expr *Ex, unsigned Cnt, const LocationContext *LC)
getAllocaRegion - Retrieve a region associated with a call to alloca().
DefinedOrUnknownSVal getExtent(SValBuilder &svalBuilder) const override
getExtent - Returns the size of the region in bytes.
CHECKER * registerChecker(AT... Args)
Used to register checkers.
StoreManager & getStoreManager()
ExplodedNode * generateSink(ProgramStateRef State, ExplodedNode *Pred, const ProgramPointTag *Tag=nullptr)
Generate a sink node.
SVal - This represents a symbolic expression, which can be either an L-value or an R-value...
unsigned blockCount() const
Returns the number of times the current block has been visited along the analyzed path...
Dataflow Directional Tag Classes.
ASTContext & getASTContext()
APSIntType getAPSIntType(QualType T) const
Returns the type of the APSInt used to store values of the given QualType.
MemRegionManager & getRegionManager()
getRegionManager - Returns the internal RegionManager object that is used to query and manipulate Mem...
T castAs() const
Convert to the specified SVal type, asserting that this SVal is of the desired type.
BasicValueFactory & getBasicValueFactory()
const ProgramStateRef & getState() const
X
Add a minimal nested name specifier fixit hint to allow lookup of a tag name from an outer enclosing ...
unsigned getBuiltinID() const
Returns a value indicating whether this function corresponds to a builtin function.
SValBuilder & getSValBuilder()
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
const LocationContext * getLocationContext() const
Defines enum values for all the target-independent builtin functions.