https://github.com/OCHyams updated 
https://github.com/llvm/llvm-project/pull/148244

>From 8c3d449f4398c9dbc40c4be3f19f51bb2eadfc6d Mon Sep 17 00:00:00 2001
From: Orlando Cazalet-Hyams <orlando.hy...@sony.com>
Date: Fri, 11 Jul 2025 14:35:12 +0100
Subject: [PATCH 1/3] notes and helptext

---
 clang/docs/ReleaseNotes.rst           | 2 ++
 clang/include/clang/Driver/Options.td | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 6996066826cbc..9f745e8e0dca3 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -376,6 +376,8 @@ New Compiler Flags
 
 - New option ``-ignore-pch`` added to disable precompiled headers. It 
overrides ``-emit-pch`` and ``-include-pch``. (#GH142409, `PCHDocs 
<https://clang.llvm.org/docs/UsersManual.html#ignoring-a-pch-file>`_).
 
+- New options ``-g[no-]key-instructions`` added, disabled by default. Reduces 
jumpiness of debug stepping for optimized code in some debuggers (not LLDB at 
this time). Not recommended for use without optimizations. DWARF only. Note 
both the positive and negative flags imply ``-g``.
+
 Deprecated Compiler Flags
 -------------------------
 
diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index b1314f2c53a79..6cc68615fd105 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -4721,8 +4721,8 @@ defm key_instructions : BoolGOption<"key-instructions",
     CodeGenOpts<"DebugKeyInstructions">, DefaultFalse,
     NegFlag<SetFalse>, PosFlag<SetTrue, [], [],
         "Enable Key Instructions, which reduces the jumpiness of optimized 
code stepping (DWARF only)."
-        " Requires LLVM built with LLVM_EXPERIMENTAL_KEY_INSTRUCTIONS.">,
-    BothFlags<[HelpHidden], [ClangOption, CLOption, CC1Option]>>;
+        " Implies -g.">,
+    BothFlags<[], [ClangOption, CLOption, CC1Option]>>;
 def headerpad__max__install__names : Joined<["-"], 
"headerpad_max_install_names">;
 def help : Flag<["-", "--"], "help">,
     Visibility<[ClangOption, CC1Option, CC1AsOption,

>From 14409b6a69a7a146487eb4ffd9b1469d57af47af Mon Sep 17 00:00:00 2001
From: Orlando Cazalet-Hyams <orlando.hy...@sony.com>
Date: Fri, 11 Jul 2025 14:39:19 +0100
Subject: [PATCH 2/3] better help text

---
 clang/include/clang/Driver/Options.td | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 6cc68615fd105..2e070d6d64508 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -4720,8 +4720,8 @@ def gno_embed_source : Flag<["-"], "gno-embed-source">, 
Group<g_flags_Group>,
 defm key_instructions : BoolGOption<"key-instructions",
     CodeGenOpts<"DebugKeyInstructions">, DefaultFalse,
     NegFlag<SetFalse>, PosFlag<SetTrue, [], [],
-        "Enable Key Instructions, which reduces the jumpiness of optimized 
code stepping (DWARF only)."
-        " Implies -g.">,
+        "Enable Key Instructions, which reduces the jumpiness of debug 
stepping in optimized C/C++ code"
+        " in some debuggers. DWARF only. Implies -g.">,
     BothFlags<[], [ClangOption, CLOption, CC1Option]>>;
 def headerpad__max__install__names : Joined<["-"], 
"headerpad_max_install_names">;
 def help : Flag<["-", "--"], "help">,

>From 6dbedfd87a5fbe25a307c16c30edcb85135b8e3b Mon Sep 17 00:00:00 2001
From: Orlando Cazalet-Hyams <orlando.hy...@sony.com>
Date: Mon, 14 Jul 2025 09:57:05 +0100
Subject: [PATCH 3/3] check help is visible

---
 clang/test/DebugInfo/KeyInstructions/flag.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/clang/test/DebugInfo/KeyInstructions/flag.cpp 
b/clang/test/DebugInfo/KeyInstructions/flag.cpp
index 813f7e908011c..e34faa6cbb347 100644
--- a/clang/test/DebugInfo/KeyInstructions/flag.cpp
+++ b/clang/test/DebugInfo/KeyInstructions/flag.cpp
@@ -3,6 +3,10 @@
 //// Default: Off.
 // RUN: %clang -### -target x86_64 -c -gdwarf %s 2>&1 | FileCheck %s 
--check-prefixes=NO-KEY-INSTRUCTIONS
 
+//// Help.
+// RUN %clang --help | FileCheck %s --check-prefix=HELP
+// HELP: -gkey-instructions  Enable Key Instructions, which reduces the 
jumpiness of debug stepping in optimized C/C++ code in some debuggers. DWARF 
only. Implies -g.
+
 // KEY-INSTRUCTIONS: "-gkey-instructions"
 // NO-KEY-INSTRUCTIONS-NOT: key-instructions
 

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to