[llvm] [ADT] Fix non-assertion build after 36c812f771 (PR #210511)

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 18 06:45:40 PDT 2026


https://github.com/kparzysz created https://github.com/llvm/llvm-project/pull/210511

https://lab.llvm.org/buildbot/#/builders/228/builds/5253

>From 303ca9ff3390ec93a1142e315b52132d751f571d Mon Sep 17 00:00:00 2001
From: Krzysztof Parzyszek <Krzysztof.Parzyszek at amd.com>
Date: Sat, 18 Jul 2026 08:43:56 -0500
Subject: [PATCH] [ADT] Fix non-assertion build after 36c812f771

https://lab.llvm.org/buildbot/#/builders/228/builds/5253
---
 llvm/include/llvm/ADT/Sequence.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/llvm/include/llvm/ADT/Sequence.h b/llvm/include/llvm/ADT/Sequence.h
index b79c794526a8e..6aea8d9e29a91 100644
--- a/llvm/include/llvm/ADT/Sequence.h
+++ b/llvm/include/llvm/ADT/Sequence.h
@@ -87,6 +87,7 @@
                        // std::enable_if
 
 #include "llvm/ADT/STLForwardCompat.h" // llvm::to_underlying
+#include "llvm/Support/Error.h" // llvm_unreachable
 #include "llvm/Support/MathExtras.h" // AddOverflow / SubOverflow
 
 namespace llvm {
@@ -185,9 +186,13 @@ struct CheckedInt {
   }
 
 private:
+#ifndef NDEBUG
   [[noreturn]] static void assertOutOfBounds() {
-    assert(false && "Out of bounds");
+    llvm_unreachable("Out of bounds");
   }
+#else
+  static constexpr void assertOutOfBounds() {}
+#endif
 
   intmax_t Value = 0;
 };



More information about the llvm-commits mailing list