[llvm-branch-commits] [clang] [Clang][OBT] Add overflow handler diagnostics (PR #235047)

Ambrose Leeb via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Oct 23 11:46:28 PDT 2026


================
@@ -672,6 +673,131 @@ void Sema::NoteOverflowCheckedOps(Expr *E) {
     Handler->setReferenced();
 }
 
+namespace {
+/// Walks a function body, including nested lambda and block bodies, and
+/// diagnoses overflow-checked operations with no visible overflow handler.
+class OverflowHandlerDiagnoser {
+  Sema &S;
+  const IdentifierInfo *Name;
+  /// Handlers visible in the current function body, innermost last. The first
+  /// entry is the function-level handler and may be null.
+  SmallVector<LabelDecl *, 4> Handlers;
+  /// Matches the %select in warn_overflow_behavior_unreachable_handler.
+  enum NestedBodyKind { NB_Lambda, NB_Block };
----------------
Sirraide wrote:

Can you update that diagnostic to use `%enum_select` instead

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


More information about the llvm-branch-commits mailing list