20 using namespace clang;
25 class BuiltinFunctionChecker :
public Checker<eval::Call> {
32 bool BuiltinFunctionChecker::evalCall(
const CallExpr *CE,
44 case Builtin::BI__builtin_expect:
45 case Builtin::BI__builtin_assume_aligned:
46 case Builtin::BI__builtin_addressof: {
57 case Builtin::BI__builtin_alloca: {
72 svalBuilder.evalEQ(state, Extent, Size);
73 state = state->assume(extentMatchesSizeArg,
true);
74 assert(state &&
"The region should not have any previous constraints");
80 case Builtin::BI__builtin_object_size: {
nonloc::ConcreteInt makeIntVal(const IntegerLiteral *integer)
ExplodedNode * addTransition(ProgramStateRef State=nullptr, const ProgramPointTag *Tag=nullptr)
Generates a new transition in the program state graph (ExplodedGraph). Uses the default CheckerContex...
const FunctionDecl * getCalleeDecl(const CallExpr *CE) const
Get the declaration of the called function (path-sensitive).
unsigned blockCount() const
Returns the number of times the current block has been visited along the analyzed path...
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.
const ProgramStateRef & getState() const
bool EvaluateAsInt(llvm::APSInt &Result, const ASTContext &Ctx, SideEffectsKind AllowSideEffects=SE_NoSideEffects) const
The result type of a method or function.
CHECKER * registerChecker()
Used to register checkers.
StoreManager & getStoreManager()
unsigned getBuiltinID() const
Returns a value indicating whether this function corresponds to a builtin function.
ASTContext & getASTContext()
MemRegionManager & getRegionManager()
BasicValueFactory & getBasicValueFactory()
SValBuilder & getSValBuilder()
APSIntType getAPSIntType(QualType T) const
Returns the type of the APSInt used to store values of the given QualType.
Defines enum values for all the target-independent builtin functions.
const LocationContext * getLocationContext() const