aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorabidh <haqadeer@amd.com>2024-04-22 11:19:05 +0100
committerGitHub <noreply@github.com>2024-04-22 11:19:05 +0100
commit087b33bbff1ab966656a81f9dd8e136fbd966f58 (patch)
treef89b71109c416a417ebf8a8bd61e3b533731d2d0
parentfdc8c5440041ac53726d0b3587762ceeb8cbbb4f (diff)
downloadllvm-087b33bbff1ab966656a81f9dd8e136fbd966f58.zip
llvm-087b33bbff1ab966656a81f9dd8e136fbd966f58.tar.gz
llvm-087b33bbff1ab966656a81f9dd8e136fbd966f58.tar.bz2
[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.
-rw-r--r--clang/lib/Driver/ToolChains/Flang.cpp2
-rw-r--r--flang/lib/Frontend/CompilerInvocation.cpp1
-rw-r--r--flang/test/Driver/debug-level.f907
3 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/Driver/ToolChains/Flang.cpp b/clang/lib/Driver/ToolChains/Flang.cpp
index b46bac2..abe0b93 100644
--- a/clang/lib/Driver/ToolChains/Flang.cpp
+++ b/clang/lib/Driver/ToolChains/Flang.cpp
@@ -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;
}
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index e432c5a..f1b7b53 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -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");
diff --git a/flang/test/Driver/debug-level.f90 b/flang/test/Driver/debug-level.f90
new file mode 100644
index 0000000..bc0aee1
--- /dev/null
+++ b/flang/test/Driver/debug-level.f90
@@ -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
+