Skip to content

Commit 087b33b

Browse files
authored
[flang] Default -g to full debug info. (#89418)
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.
1 parent fdc8c54 commit 087b33b

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

clang/lib/Driver/ToolChains/Flang.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ void Flang::addOtherOptions(const ArgList &Args, ArgStringList &CmdArgs) const {
118118
Arg *gNArg = Args.getLastArg(options::OPT_gN_Group);
119119
DebugInfoKind = debugLevelToInfoKind(*gNArg);
120120
} else if (Args.hasArg(options::OPT_g_Flag)) {
121-
DebugInfoKind = llvm::codegenoptions::DebugLineTablesOnly;
121+
DebugInfoKind = llvm::codegenoptions::FullDebugInfo;
122122
} else {
123123
DebugInfoKind = llvm::codegenoptions::NoDebugInfo;
124124
}

flang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ static bool parseDebugArgs(Fortran::frontend::CodeGenOptions &opts,
145145
}
146146
opts.setDebugInfo(val.value());
147147
if (val != llvm::codegenoptions::DebugLineTablesOnly &&
148+
val != llvm::codegenoptions::FullDebugInfo &&
148149
val != llvm::codegenoptions::NoDebugInfo) {
149150
const auto debugWarning = diags.getCustomDiagID(
150151
clang::DiagnosticsEngine::Warning, "Unsupported debug option: %0");

flang/test/Driver/debug-level.f90

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
! RUN: %flang %s -g -c -### 2>&1 | FileCheck %s --check-prefix=FULL
2+
! RUN: %flang %s -g1 -c -### 2>&1 | FileCheck %s --check-prefix=LINE
3+
! RUN: %flang %s -gline-tables-only -c -### 2>&1 | FileCheck %s --check-prefix=LINE
4+
5+
! LINE: -debug-info-kind=line-tables-only
6+
! FULL: -debug-info-kind=standalone
7+

0 commit comments

Comments
 (0)