r248912 - Alias "-ggdbN" to "-gN" options, fixing some incompatibilities.
Douglas Katzman via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 30 08:55:59 PDT 2015
Author: dougk
Date: Wed Sep 30 10:55:59 2015
New Revision: 248912
URL: http://llvm.org/viewvc/llvm-project?rev=248912&view=rev
Log:
Alias "-ggdbN" to "-gN" options, fixing some incompatibilities.
* assembling from a .s file mistook -ggdb0 for -g
* -ggdb1 is supposed to mean basically -g1, not -gN for N>1
Modified:
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/debug-options-as.c
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=248912&r1=248911&r2=248912&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Wed Sep 30 10:55:59 2015
@@ -1109,14 +1109,16 @@ def gline_tables_only : Flag<["-"], "gli
HelpText<"Emit debug line number tables only">, Flags<[CC1Option]>;
def gmlt : Flag<["-"], "gmlt">, Alias<gline_tables_only>;
def g0 : Flag<["-"], "g0">, Group<g_Group>;
-def g1 : Flag<["-"], "g1">, Group<g_Group>;
+def g1 : Flag<["-"], "g1">, Group<g_Group>, Alias<gline_tables_only>;
def g2 : Flag<["-"], "g2">, Group<g_Group>;
def g3 : Flag<["-"], "g3">, Group<g_Group>;
def ggdb : Flag<["-"], "ggdb">, Group<g_Group>;
-def ggdb0 : Flag<["-"], "ggdb0">, Group<g_Group>;
-def ggdb1 : Flag<["-"], "ggdb1">, Group<g_Group>;
-def ggdb2 : Flag<["-"], "ggdb2">, Group<g_Group>;
-def ggdb3 : Flag<["-"], "ggdb3">, Group<g_Group>;
+def ggdb0 : Flag<["-"], "ggdb0">, Alias<g0>;
+// Redirect ggdb1 to <gline_tables_only>, not <g1>,
+// because aliases of aliases aren't allowed.
+def ggdb1 : Flag<["-"], "ggdb1">, Alias<gline_tables_only>;
+def ggdb2 : Flag<["-"], "ggdb2">, Alias<g2>;
+def ggdb3 : Flag<["-"], "ggdb3">, Alias<g3>;
def gdwarf_2 : Flag<["-"], "gdwarf-2">, Group<g_Group>,
HelpText<"Generate source-level debug information with dwarf version 2">, Flags<[CC1Option,CC1AsOption]>;
def gdwarf_3 : Flag<["-"], "gdwarf-3">, Group<g_Group>,
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=248912&r1=248911&r2=248912&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Sep 30 10:55:59 2015
@@ -3802,8 +3802,7 @@ void Clang::ConstructJob(Compilation &C,
Args.ClaimAllArgs(options::OPT_g_Group);
Arg *SplitDwarfArg = Args.getLastArg(options::OPT_gsplit_dwarf);
if (Arg *A = Args.getLastArg(options::OPT_g_Group)) {
- if ((A->getOption().matches(options::OPT_gline_tables_only) ||
- A->getOption().matches(options::OPT_g1)) &&
+ if (A->getOption().matches(options::OPT_gline_tables_only) &&
(!SplitDwarfArg || A->getIndex() > SplitDwarfArg->getIndex())) {
// FIXME: we should support specifying dwarf version with
// -gline-tables-only.
@@ -3819,8 +3818,7 @@ void Clang::ConstructJob(Compilation &C,
A->getOption().matches(options::OPT_gdwarf_3) ||
A->getOption().matches(options::OPT_gdwarf_4)) {
A->render(Args, CmdArgs);
- } else if (!A->getOption().matches(options::OPT_g0) &&
- !A->getOption().matches(options::OPT_ggdb0)) {
+ } else if (!A->getOption().matches(options::OPT_g0)) {
// Default is dwarf-2 for Darwin, OpenBSD, FreeBSD and Solaris.
const llvm::Triple &Triple = getToolChain().getTriple();
if (Triple.isOSDarwin() || Triple.getOS() == llvm::Triple::OpenBSD ||
Modified: cfe/trunk/test/Driver/debug-options-as.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/debug-options-as.c?rev=248912&r1=248911&r2=248912&view=diff
==============================================================================
--- cfe/trunk/test/Driver/debug-options-as.c (original)
+++ cfe/trunk/test/Driver/debug-options-as.c Wed Sep 30 10:55:59 2015
@@ -7,10 +7,16 @@
// SAVE: "-cc1as"
// SAVE-NOT: "-g"
+// Make sure that '-ggdb0' is not accidentally mistaken for '-g'
+// RUN: %clang -### -ggdb0 -c -integrated-as -x assembler %s 2>&1 \
+// RUN: | FileCheck -check-prefix=GGDB0 %s
+//
+// GGDB0: "-cc1as"
+// GGDB0-NOT: "-g"
+
// Check to make sure clang with -g on a .s file gets passed.
// rdar://9275556
-// RUN: touch %t.s
-// RUN: %clang -### -c -integrated-as -g %t.s 2>&1 \
+// RUN: %clang -### -c -integrated-as -g -x assembler %s 2>&1 \
// RUN: | FileCheck %s
//
// CHECK: "-cc1as"
@@ -18,8 +24,7 @@
// Check to make sure clang with -g on a .s file gets passed -dwarf-debug-producer.
// rdar://12955296
-// RUN: touch %t.s
-// RUN: %clang -### -c -integrated-as -g %t.s 2>&1 \
+// RUN: %clang -### -c -integrated-as -g -x assembler %s 2>&1 \
// RUN: | FileCheck -check-prefix=P %s
//
// P: "-cc1as"
Modified: cfe/trunk/test/Driver/debug-options.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/debug-options.c?rev=248912&r1=248911&r2=248912&view=diff
==============================================================================
--- cfe/trunk/test/Driver/debug-options.c (original)
+++ cfe/trunk/test/Driver/debug-options.c Wed Sep 30 10:55:59 2015
@@ -10,7 +10,7 @@
// RUN: %clang -### -c -ggdb %s -target x86_64-linux-gnu 2>&1 \
// RUN: | FileCheck -check-prefix=G %s
// RUN: %clang -### -c -ggdb1 %s -target x86_64-linux-gnu 2>&1 \
-// RUN: | FileCheck -check-prefix=G %s
+// RUN: | FileCheck -check-prefix=GLTO_ONLY %s
// RUN: %clang -### -c -ggdb3 %s -target x86_64-linux-gnu 2>&1 \
// RUN: | FileCheck -check-prefix=G %s
@@ -23,7 +23,7 @@
// RUN: %clang -### -c -ggdb %s -target x86_64-apple-darwin 2>&1 \
// RUN: | FileCheck -check-prefix=G_DARWIN %s
// RUN: %clang -### -c -ggdb1 %s -target x86_64-apple-darwin 2>&1 \
-// RUN: | FileCheck -check-prefix=G_DARWIN %s
+// RUN: | FileCheck -check-prefix=GLTO_ONLY_DWARF2 %s
// RUN: %clang -### -c -ggdb3 %s -target x86_64-apple-darwin 2>&1 \
// RUN: | FileCheck -check-prefix=G_DARWIN %s
More information about the cfe-commits
mailing list