summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Driver/Tools.cpp5
-rw-r--r--clang/test/Driver/debug-options.c8
2 files changed, 10 insertions, 3 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index cb65fc88063..92f35f3538c 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -2599,7 +2599,10 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("-generate-gnu-dwarf-pub-sections");
}
- Args.AddAllArgs(CmdArgs, options::OPT_fdebug_types_section);
+ if (Args.hasArg(options::OPT_fdebug_types_section)) {
+ CmdArgs.push_back("-backend-option");
+ CmdArgs.push_back("-generate-type-units");
+ }
Args.AddAllArgs(CmdArgs, options::OPT_ffunction_sections);
Args.AddAllArgs(CmdArgs, options::OPT_fdata_sections);
diff --git a/clang/test/Driver/debug-options.c b/clang/test/Driver/debug-options.c
index 526083719d8..65350a67f97 100644
--- a/clang/test/Driver/debug-options.c
+++ b/clang/test/Driver/debug-options.c
@@ -45,12 +45,14 @@
// RUN: | FileCheck -check-prefix=GLTO_NO %s
//
// RUN: %clang -### -c -grecord-gcc-switches -gno-record-gcc-switches \
-// RUN: -gstrict-dwarf -gno-strict-dwarf -fdebug-types-section \
-// RUN: -fno-debug-types-section %s 2>&1 \
+// RUN: -gstrict-dwarf -gno-strict-dwarf %s 2>&1 \
// RUN: | FileCheck -check-prefix=GIGNORE %s
//
// RUN: %clang -### -c -ggnu-pubnames %s 2>&1 | FileCheck -check-prefix=GOPT %s
//
+// RUN: %clang -### -fdebug-types-section %s 2>&1 \
+// RUN: | FileCheck -check-prefix=FDTS %s
+//
// G: "-cc1"
// G: "-g"
//
@@ -90,3 +92,5 @@
// GIGNORE-NOT: "argument unused during compilation"
//
// GOPT: -generate-gnu-dwarf-pub-sections
+//
+// FDTS: "-backend-option" "-generate-type-units"
OpenPOWER on IntegriCloud