[clang] [lldb] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)
Justin Stitt via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 17 12:21:28 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:
But I am also using this interface for unsigned types for which `OB_Undefined` would be ill-suited.
Perhaps you're hinting that this interface should change entirely but I really don't have any better ideas. For now, I'll send a commit addressing your review and if you want further changes let me know.
https://github.com/llvm/llvm-project/pull/148914
More information about the cfe-commits
mailing list