From b3533a156da92262eb19429d8c12f53e87f5ccec Mon Sep 17 00:00:00 2001 From: Tarun Prabhu Date: Thu, 19 Sep 2024 18:28:50 -0600 Subject: [clang][flang][mlir] Support -frecord-command-line option (#102975) Add support for the -frecord-command-line option that will produce the llvm.commandline metadata which will eventually be saved in the object file. This behavior is also supported in clang. Some refactoring of the code in flang to handle these command line options was carried out. The corresponding -grecord-command-line option which saves the command line in the debug information has not yet been enabled for flang. --- flang/lib/Frontend/CompilerInvocation.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'flang/lib/Frontend/CompilerInvocation.cpp') diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp index 90c3275..8441c7d 100644 --- a/flang/lib/Frontend/CompilerInvocation.cpp +++ b/flang/lib/Frontend/CompilerInvocation.cpp @@ -348,6 +348,12 @@ static void parseCodeGenArgs(Fortran::frontend::CodeGenOptions &opts, if (auto *a = args.getLastArg(clang::driver::options::OPT_save_temps_EQ)) opts.SaveTempsDir = a->getValue(); + // -record-command-line option. + if (const llvm::opt::Arg *a = + args.getLastArg(clang::driver::options::OPT_record_command_line)) { + opts.RecordCommandLine = a->getValue(); + } + // -mlink-builtin-bitcode for (auto *a : args.filtered(clang::driver::options::OPT_mlink_builtin_bitcode)) -- cgit v1.1