Author: adrian Date: Mon Oct 10 16:56:20 2016 New Revision: 283810 URL: http://llvm.org/viewvc/llvm-project?rev=283810&view=rev Log: [Driver] Let -gline-tables-only win when it comes after -gmodules. 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> Modified: cfe/trunk/include/clang/Driver/Options.td cfe/trunk/lib/Driver/Tools.cpp cfe/trunk/test/Driver/debug-options.c Modified: cfe/trunk/include/clang/Driver/Options.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=283810&r1=283809&r2=283810&view=diff ============================================================================== --- cfe/trunk/include/clang/Driver/Options.td (original) +++ cfe/trunk/include/clang/Driver/Options.td Mon Oct 10 16:56:20 2016 @@ -1344,7 +1344,7 @@ def gno_column_info : Flag<["-"], "gno-c 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">; Modified: cfe/trunk/lib/Driver/Tools.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=283810&r1=283809&r2=283810&view=diff ============================================================================== --- cfe/trunk/lib/Driver/Tools.cpp (original) +++ cfe/trunk/lib/Driver/Tools.cpp Mon Oct 10 16:56:20 2016 @@ -4703,7 +4703,9 @@ void Clang::ConstructJob(Compilation &C, 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"); Modified: cfe/trunk/test/Driver/debug-options.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/debug-options.c?rev=283810&r1=283809&r2=283810&view=diff ============================================================================== --- cfe/trunk/test/Driver/debug-options.c (original) +++ cfe/trunk/test/Driver/debug-options.c Mon Oct 10 16:56:20 2016 @@ -109,6 +109,15 @@ // 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" // @@ -131,7 +140,9 @@ // 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" _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits