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

Justin Stitt via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 19 12:26:43 PDT 2025


================
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -foverflow-behavior-types -std=c++11 -ast-print %s -o - | FileCheck %s
+
+extern int __attribute__((overflow_behavior(no_wrap))) a;
+extern int __attribute__((overflow_behavior(wrap))) b;
+
+// CHECK: extern __no_wrap int a;
+// CHECK: extern __wrap int b;
----------------
JustinStitt wrote:

@mizvekov 
Let me know what you think about https://github.com/llvm/llvm-project/pull/148914/commits/0042195b7c9f06b70ffb24c8d76d1aaed6ee3dee. I use the full attribute spelling for AST type printer and I use a shorthand in diagnostics. I had to make a method `TryConvertOverflowBehaviorTypeToDiagnosticString()` to drop into `ConvertTypeToDiagnosticString()` which sort of matches how `ext_vector` types are handled to be pretty printed.

round-trip test is all good.

Im happy to iterate further too. let me know what you think.

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


More information about the cfe-commits mailing list