aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorAbid Qadeer <haqadeer@amd.com>2025-09-26 11:06:29 +0100
committerGitHub <noreply@github.com>2025-09-26 11:06:29 +0100
commit96675a467ef5811dc1e78b2bec3c90cf0c67ba1c (patch)
tree3386eac04f82d4554b65005a708c32119c2c71bd /flang/lib/Frontend/CompilerInvocation.cpp
parentc7312916b7e228460c1c21c1f5959dc3c1973c4c (diff)
downloadllvm-96675a467ef5811dc1e78b2bec3c90cf0c67ba1c.zip
llvm-96675a467ef5811dc1e78b2bec3c90cf0c67ba1c.tar.gz
llvm-96675a467ef5811dc1e78b2bec3c90cf0c67ba1c.tar.bz2
[flang][Driver] Support -gsplit-dwarf. (#160540)
This flags enables the compiler to generate most of the debug information in a separate file which can be useful for executable size and link times. Clang already supports this flag. I have tried to follow the logic of the clang implementation where possible. Some functions were moved where they could be used by both clang and flang. The `addOtherOptions` was renamed to `addDebugOptions` to better reflect its purpose. Clang also set the `splitDebugFilename` field of the `DICompileUnit` in the IR when this option is present. That part is currently missing from this patch and will come in a follow-up PR.
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--flang/lib/Frontend/CompilerInvocation.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index 09b5173..81610ed 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -160,6 +160,12 @@ static bool parseDebugArgs(Fortran::frontend::CodeGenOptions &opts,
opts.DwarfVersion =
getLastArgIntValue(args, clang::driver::options::OPT_dwarf_version_EQ,
/*Default=*/0, diags);
+ if (const llvm::opt::Arg *a =
+ args.getLastArg(clang::driver::options::OPT_split_dwarf_file))
+ opts.SplitDwarfFile = a->getValue();
+ if (const llvm::opt::Arg *a =
+ args.getLastArg(clang::driver::options::OPT_split_dwarf_output))
+ opts.SplitDwarfOutput = a->getValue();
}
return true;
}