[clang] [clang] [Static analyzer]: add initial support for builtin overflow (PR #102602)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 9 12:53:53 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);
----------------
steakhal wrote:

I'm okay having that assert. We are talking about a builtin here.
I would have a different opinion if it wasn't a builtin though.

https://github.com/llvm/llvm-project/pull/102602


More information about the cfe-commits mailing list