From f36d9bac47dac3df7a1eba47e60816eb4d76e42d Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Mon, 27 Jan 2014 18:52:43 +0000 Subject: [PATCH] Driver: support -fno-debug-types-section to override -fdebug-types-section llvm-svn: 200236 --- clang/include/clang/Driver/Options.td | 2 ++ clang/lib/Driver/Tools.cpp | 3 ++- clang/test/Driver/debug-options.c | 6 ++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 25a1d12848a1..6b7e198d0bf3 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -873,6 +873,8 @@ def fno_data_sections : Flag <["-"], "fno-data-sections">, Group, Flags<[CC1Option]>; def fdebug_types_section: Flag <["-"], "fdebug-types-section">, Group, Flags<[CC1Option]>, HelpText<"Place debug types in their own section (ELF Only)">; +def fno_debug_types_section: Flag<["-"], "fno-debug-types-section">, Group, + Flags<[CC1Option]>; def g_Flag : Flag<["-"], "g">, Group, HelpText<"Generate source level debug information">, Flags<[CC1Option]>; def gline_tables_only : Flag<["-"], "gline-tables-only">, Group, diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 3176f1f3c40b..615c3758d6df 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -2606,7 +2606,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-generate-gnu-dwarf-pub-sections"); } - if (Args.hasArg(options::OPT_fdebug_types_section)) { + if (Args.hasFlag(options::OPT_fdebug_types_section, + options::OPT_fno_debug_types_section, false)) { CmdArgs.push_back("-backend-option"); CmdArgs.push_back("-generate-type-units"); } diff --git a/clang/test/Driver/debug-options.c b/clang/test/Driver/debug-options.c index 65350a67f972..e17cc01d6001 100644 --- a/clang/test/Driver/debug-options.c +++ b/clang/test/Driver/debug-options.c @@ -53,6 +53,10 @@ // RUN: %clang -### -fdebug-types-section %s 2>&1 \ // RUN: | FileCheck -check-prefix=FDTS %s // +// RUN: %clang -### -fdebug-types-section -fno-debug-types-section %s 2>&1 \ +// RUN: | FileCheck -check-prefix=NOFDTS %s +// +// // G: "-cc1" // G: "-g" // @@ -94,3 +98,5 @@ // GOPT: -generate-gnu-dwarf-pub-sections // // FDTS: "-backend-option" "-generate-type-units" +// +// NOFDTS-NOT: "-backend-option" "-generate-type-units"