[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 17 11:36:10 PDT 2025
================
@@ -112,6 +112,25 @@ class LangOptionsBase {
SOB_Trapping
};
+ // Used by __attribute__((overflow_behavior())) to describe overflow behavior
+ // on a per-type basis.
+ enum OverflowBehaviorKind {
+ // Default C standard behavior (type dependent).
+ OB_Unset,
+
+ // __attribute__((overflow_behavior("wrap")))
+ OB_Wrap,
+
+ // __attribute__((overflow_behavior("no_wrap")))
+ OB_NoWrap,
+
+ // Signed types defined as wrapping via -fwrapv can still be instrumented
+ // by sanitizers (PR82432). This field is needed to disambiguate canonical
+ // wrapping type behaviors from -fwrapv behaviors.
+ // -fwrapv
+ OB_FWrapv
----------------
JustinStitt wrote:
I am using `getOverflowBehaviorConsideringType()` which considers the `SignedOverflowBehavior` as well as any overflow behavior types. As I am combining both into a common interface, I need to disambiguate between unmodified signed arithmetic and `-fwrapv` arithmetic.
I think perhaps renaming this field to `OB_SignedAndDefined` would better represent its meaning.
https://github.com/llvm/llvm-project/pull/148914
More information about the lldb-commits
mailing list