The -gmodules option is all about putting debug type info into clang
modules and for line tables the type information is irrelevant, so
combining these two options makes no sense.
This commmit fixes the behavior to match the one documented on the
clang man page: the last -g... option wins.
<rdar://problem/
27059770>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@283810
91177308-0d34-0410-b5e6-
96231b3b80d8
def gsplit_dwarf : Flag<["-"], "gsplit-dwarf">, Group<g_flags_Group>;
def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, Group<g_flags_Group>;
def gdwarf_aranges : Flag<["-"], "gdwarf-aranges">, Group<g_flags_Group>;
-def gmodules : Flag <["-"], "gmodules">, Group<f_Group>,
+def gmodules : Flag <["-"], "gmodules">, Group<gN_Group>,
HelpText<"Generate debug info with external references to clang modules"
" or precompiled headers">;
def headerpad__max__install__names : Joined<["-"], "headerpad_max_install_names">;
CmdArgs.push_back("-dwarf-column-info");
// FIXME: Move backend command line options to the module.
- if (Args.hasArg(options::OPT_gmodules)) {
+ // If -gline-tables-only is the last option it wins.
+ if (DebugInfoKind != codegenoptions::DebugLineTablesOnly &&
+ Args.hasArg(options::OPT_gmodules)) {
DebugInfoKind = codegenoptions::LimitedDebugInfo;
CmdArgs.push_back("-dwarf-ext-refs");
CmdArgs.push_back("-fmodule-format=obj");
// RUN: %clang -### -gmodules %s 2>&1 \
// RUN: | FileCheck -check-prefix=GEXTREFS %s
//
+// RUN: %clang -### -gmodules -g %s 2>&1 \
+// RUN: | FileCheck -check-prefix=GEXTREFS %s
+//
+// RUN: %clang -### -gline-tables-only -gmodules %s 2>&1 \
+// RUN: | FileCheck -check-prefix=GEXTREFS %s
+//
+// RUN: %clang -### -gmodules -gline-tables-only %s 2>&1 \
+// RUN: | FileCheck -check-prefix=GLTO_ONLY %s
+//
// G: "-cc1"
// G: "-debug-info-kind=limited"
//
// G_NO-NOT: -debug-info-kind=
//
// GLTO_ONLY: "-cc1"
+// GLTO_ONLY-NOT: "-dwarf-ext-refs"
// GLTO_ONLY: "-debug-info-kind=line-tables-only"
+// GLTO_ONLY-NOT: "-dwarf-ext-refs"
//
// GLTO_ONLY_DWARF2: "-cc1"
// GLTO_ONLY_DWARF2: "-debug-info-kind=line-tables-only"