Skip to content

Commit

Permalink
[flang] Default -g to full debug info. (#89418)
Browse files Browse the repository at this point in the history
Currently, -g defaults to line tables only. This PR changes that to full
debug information. This will allow us to test/use the upcoming debug
info changes.
  • Loading branch information
abidh committed Apr 22, 2024
1 parent fdc8c54 commit 087b33b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion clang/lib/Driver/ToolChains/Flang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void Flang::addOtherOptions(const ArgList &Args, ArgStringList &CmdArgs) const {
Arg *gNArg = Args.getLastArg(options::OPT_gN_Group);
DebugInfoKind = debugLevelToInfoKind(*gNArg);
} else if (Args.hasArg(options::OPT_g_Flag)) {
DebugInfoKind = llvm::codegenoptions::DebugLineTablesOnly;
DebugInfoKind = llvm::codegenoptions::FullDebugInfo;
} else {
DebugInfoKind = llvm::codegenoptions::NoDebugInfo;
}
Expand Down
1 change: 1 addition & 0 deletions flang/lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ static bool parseDebugArgs(Fortran::frontend::CodeGenOptions &opts,
}
opts.setDebugInfo(val.value());
if (val != llvm::codegenoptions::DebugLineTablesOnly &&
val != llvm::codegenoptions::FullDebugInfo &&
val != llvm::codegenoptions::NoDebugInfo) {
const auto debugWarning = diags.getCustomDiagID(
clang::DiagnosticsEngine::Warning, "Unsupported debug option: %0");
Expand Down
7 changes: 7 additions & 0 deletions flang/test/Driver/debug-level.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
! RUN: %flang %s -g -c -### 2>&1 | FileCheck %s --check-prefix=FULL
! RUN: %flang %s -g1 -c -### 2>&1 | FileCheck %s --check-prefix=LINE
! RUN: %flang %s -gline-tables-only -c -### 2>&1 | FileCheck %s --check-prefix=LINE

! LINE: -debug-info-kind=line-tables-only
! FULL: -debug-info-kind=standalone

0 comments on commit 087b33b

Please sign in to comment.