[clang] [analyzer] Model overflow builtins (PR #102602)
DonĂ¡t Nagy via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 12 01:40:23 PDT 2024
================
@@ -50,6 +101,44 @@ class BuiltinFunctionChecker : public Checker<eval::Call> {
} // namespace
+void BuiltinFunctionChecker::HandleOverflowBuiltin(const CallEvent &Call,
+ CheckerContext &C,
+ BinaryOperator::Opcode Op,
+ QualType ResultType) const {
+ // All __builtin_*_overflow functions take 3 argumets.
+ assert(Call.getNumArgs() == 3);
----------------
NagyDonat wrote:
> I've tried to catch this assert locally by calling __builtin_*_overflow with 2 arguments, but clang just rejects it.
Oh, I see. Perhaps add a comment saying that "Calling a builtin with an incorrect argument count produces compiler error (...)", because e.g. I didn't know that this is the case.
https://github.com/llvm/llvm-project/pull/102602
More information about the cfe-commits
mailing list