https://github.com/arsenm updated 
https://github.com/llvm/llvm-project/pull/235050

>From d1c808ab93a2d564dd3d4472b0af96332188d1ba Mon Sep 17 00:00:00 2001
From: Matt Arsenault <[email protected]>
Date: Thu, 1 Oct 2026 01:03:16 +0200
Subject: [PATCH] clang: Emit the "debugger-tuning" module flag

Co-authored-by: Claude Sonnet 5 <[email protected]>
---
 clang/lib/CodeGen/CodeGenModule.cpp       |  3 +++
 clang/test/CodeGen/debugger-tuning-flag.c | 21 +++++++++++++++++++++
 2 files changed, 24 insertions(+)
 create mode 100644 clang/test/CodeGen/debugger-tuning-flag.c

diff --git a/clang/lib/CodeGen/CodeGenModule.cpp 
b/clang/lib/CodeGen/CodeGenModule.cpp
index eec4d9e714abe6..ce084487a69820 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -1508,6 +1508,9 @@ void CodeGenModule::Release() {
                             llvm::getExceptionModelName(ExceptionModel)));
   }
 
+  if (CodeGenOpts.getDebuggerTuning() != llvm::DebuggerKind::Default)
+    getModule().setDebuggerTuning(CodeGenOpts.getDebuggerTuning());
+
   if (getTriple().isOSzOS()) {
     getModule().addModuleFlag(llvm::Module::Warning,
                               "zos_product_major_version",
diff --git a/clang/test/CodeGen/debugger-tuning-flag.c 
b/clang/test/CodeGen/debugger-tuning-flag.c
new file mode 100644
index 00000000000000..64167a3b513bb6
--- /dev/null
+++ b/clang/test/CodeGen/debugger-tuning-flag.c
@@ -0,0 +1,21 @@
+// Verify clang emits the "debugger-tuning" module flag whenever a tuning is
+// specified.
+
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -debugger-tuning=gdb 
-emit-llvm %s -o - | FileCheck -check-prefix=GDB %s
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -debugger-tuning=lldb 
-emit-llvm %s -o - | FileCheck -check-prefix=LLDB %s
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -debugger-tuning=sce 
-emit-llvm %s -o - | FileCheck -check-prefix=SCE %s
+// RUN: %clang_cc1 -triple powerpc-ibm-aix-xcoff -debugger-tuning=dbx 
-emit-llvm %s -o - | FileCheck -check-prefix=DBX %s
+
+// A requested tuning that matches the target default is still recorded
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -debugger-tuning=lldb 
-emit-llvm %s -o - | FileCheck -check-prefix=LLDB %s
+
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o - | 
FileCheck -check-prefix=DEFAULT %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm %s -o - | FileCheck 
-check-prefix=DEFAULT %s
+
+void f(void) {}
+
+// GDB: !{i32 2, !"debugger-tuning", !"gdb"}
+// LLDB: !{i32 2, !"debugger-tuning", !"lldb"}
+// SCE: !{i32 2, !"debugger-tuning", !"sce"}
+// DBX: !{i32 2, !"debugger-tuning", !"dbx"}
+// DEFAULT-NOT: "debugger-tuning"

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to