[Lldb-commits] [clang] [lldb] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

Justin Stitt via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 24 12:45:20 PDT 2025


================
@@ -4043,6 +4043,33 @@ def note_cannot_use_trivial_abi_reason : Note<
   "it has a __weak field|it has a field of a non-trivial class type|"
   "it has an address-discriminated '__ptrauth' field}1">;
 
+// OverflowBehavior attribute
+def err_overflow_behavior_unknown_ident
+    : Error<"'%0' is not a valid argument to attribute %1, only 'wrap' and "
+            "'no_wrap' "
+            "are supported">;
+def warn_overflow_behavior_non_integer_type
+    : Warning<"%0 %select{attribute|specifier}2 cannot be applied to "
+              "non-integer type '%1'; %select{attribute|specifier}2 ignored">,
+      InGroup<OverflowBehaviorAttributeIgnored>;
+def warn_overflow_behavior_attribute_disabled
+    : Warning<"%0 attribute is ignored because it is not enabled; pass "
+              "-foverflow-behavior-types">,
+      InGroup<OverflowBehaviorAttributeIgnored>;
+def warn_conflicting_overflow_behavior_attributes
+    : Warning<"conflicting %select{'overflow_behavior' attributes|overflow "
+              "behavior specifiers}0 on the same type; 'no_wrap' takes "
+              "precedence over 'wrap'">,
+      InGroup<OverflowBehaviorAttributeIgnored>;
----------------
JustinStitt wrote:

I've changed this to an error and reworked the diagnostic slightly. We no longer have an enum to specify the spelling. Thanks for informing me of `enum_select`, though. I will try to use it in the future.

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


More information about the lldb-commits mailing list