[PATCH] D142236: [clang/driver] Add `-gno-modules` as the negative version of `-gmodules`
Argyrios Kyrtzidis via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 20 12:43:20 PST 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1ff8a687ae15: [clang/driver] Add `-gno-modules` as the negative version of `-gmodules` (authored by akyrtzi).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142236/new/
https://reviews.llvm.org/D142236
Files:
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/debug-options.c
Index: clang/test/Driver/debug-options.c
===================================================================
--- clang/test/Driver/debug-options.c
+++ clang/test/Driver/debug-options.c
@@ -300,6 +300,9 @@
// RUN: %clang -### -target %itanium_abi_triple -gmodules -gline-directives-only %s 2>&1 \
// RUN: | FileCheck -check-prefix=GLIO_ONLY %s
//
+// RUN: %clang -### -gmodules -gno-modules %s 2>&1 \
+// RUN: | FileCheck -check-prefix=NOGEXTREFS %s
+//
// NOG_PS: "-cc1"
// NOG_PS-NOT: "-dwarf-version=
// NOG_PS: "-generate-arange-section"
@@ -407,6 +410,7 @@
//
// GEXTREFS: "-dwarf-ext-refs" "-fmodule-format=obj"
// GEXTREFS: "-debug-info-kind={{standalone|constructor}}"
+// NOGEXTREFS-NOT: -dwarf-ext-refs
// RUN: not %clang -cc1 -debug-info-kind=watkind 2>&1 | FileCheck -check-prefix=BADSTRING1 %s
// BADSTRING1: error: invalid value 'watkind' in '-debug-info-kind=watkind'
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -4219,9 +4219,11 @@
CmdArgs.push_back("-gno-column-info");
// FIXME: Move backend command line options to the module.
- // If -gline-tables-only or -gline-directives-only is the last option it wins.
- if (const Arg *A = Args.getLastArg(options::OPT_gmodules))
- if (checkDebugInfoOption(A, Args, D, TC)) {
+ if (Args.hasFlag(options::OPT_gmodules, options::OPT_gno_modules, false)) {
+ // If -gline-tables-only or -gline-directives-only is the last option it
+ // wins.
+ if (checkDebugInfoOption(Args.getLastArg(options::OPT_gmodules), Args, D,
+ TC)) {
if (DebugInfoKind != codegenoptions::DebugLineTablesOnly &&
DebugInfoKind != codegenoptions::DebugDirectivesOnly) {
DebugInfoKind = codegenoptions::DebugInfoConstructor;
@@ -4229,6 +4231,7 @@
CmdArgs.push_back("-fmodule-format=obj");
}
}
+ }
if (T.isOSBinFormatELF() && SplitDWARFInlining)
CmdArgs.push_back("-fsplit-dwarf-inlining");
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -3292,6 +3292,7 @@
def gmodules : Flag <["-"], "gmodules">, Group<gN_Group>,
HelpText<"Generate debug info with external references to clang modules"
" or precompiled headers">;
+def gno_modules : Flag <["-"], "gno-modules">, Group<gN_Group>;
def gz_EQ : Joined<["-"], "gz=">, Group<g_flags_Group>,
HelpText<"DWARF debug sections compression type">;
def gz : Flag<["-"], "gz">, Alias<gz_EQ>, AliasArgs<["zlib"]>, Group<g_flags_Group>;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142236.490946.patch
Type: text/x-patch
Size: 2769 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230120/4fd06dd3/attachment-0001.bin>
More information about the cfe-commits
mailing list