[clang] [clang] [Static analyzer]: add initial support for builtin overflow (PR #102602)
Pavel Skripkin via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 9 10:58:19 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);
----------------
pskrgag wrote:
Hm, I thought that CSA won't run on code with compile errors. Or there is a mode which will try to run even on invalid AST?
I've tried to catch this assert locally by calling `__builtin_*_overflow` with 2 arguments, but clang just rejects it.
https://github.com/llvm/llvm-project/pull/102602
More information about the cfe-commits
mailing list