[clang] [flang] [flang] Implement -grecord-command-line for Flang (PR #181686)

Tarun Prabhu via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 23 12:03:27 PST 2026


================
@@ -0,0 +1,30 @@
+! This checks that -grecord-command-line is forwarded by the flang driver to
+! an FC1 -dwarf-debug-flags argument and that -gno-record-command-line
+! disables it, matching clang behavior.
+!
+! RUN: %flang -### -target x86_64-unknown-linux-gnu -c -grecord-command-line %s 2>&1 | FileCheck --check-prefix=GRECORD %s
+! RUN: %flang -### -target x86_64-unknown-linux-gnu -c -gno-record-command-line %s 2>&1 | FileCheck --check-prefix=GNO_RECORD %s
+! RUN: %flang -### -target x86_64-unknown-linux-gnu -c -grecord-command-line -gno-record-command-line %s 2>&1 | FileCheck --check-prefix=GNO_RECORD %s
+! RUN: %flang -### -target x86_64-unknown-linux-gnu -c -grecord-command-line -o - %s 2>&1 | FileCheck --check-prefix=GRECORD_O %s
+! RUN: %flang -target x86_64-unknown-linux-gnu -c -g -grecord-command-line %s -o %t.o
+! RUN: llvm-dwarfdump --debug-info %t.o | FileCheck --check-prefix=WITH_GRECORD %s
+! RUN: %flang -target x86_64-unknown-linux-gnu -c -g -gno-record-command-line %s -o %t.norecord.o
+! RUN: llvm-dwarfdump --debug-info %t.norecord.o | FileCheck --check-prefix=NO_GRECORD %s
+!
+! GRECORD: "-dwarf-debug-flags"
+! GRECORD: -grecord-command-line
----------------
tarunprabhu wrote:

I don't think you need to check for that here. It would be better to do this in a test that checks that the command-line arguments appear in the correct MLIR attribute.

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


More information about the cfe-commits mailing list