Driver: Stub -Wa,-compress-debug-sections support for integrated-as with a suppressable warning
llvm-svn: 199454
diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index dc441cc..59805b5 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -152,6 +152,8 @@
"precompiled header '%0' was ignored because '%1' is not first '-include'">;
def warn_missing_sysroot : Warning<"no such sysroot directory: '%0'">,
InGroup<DiagGroup<"missing-sysroot">>;
+def warn_missing_debug_compression : Warning<"DWARF compression is not implemented">,
+ InGroup<DiagGroup<"missing-debug-compression">>;
def note_drv_command_failed_diag_msg : Note<
"diagnostic msg: %0">;
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index 16e3967..1f499cb 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -1699,6 +1699,8 @@
CmdArgs.push_back("-fatal-assembler-warnings");
} else if (Value == "--noexecstack") {
CmdArgs.push_back("-mnoexecstack");
+ } else if (Value == "-compress-debug-sections") {
+ D.Diag(diag::warn_missing_debug_compression);
} else if (Value.startswith("-I")) {
CmdArgs.push_back(Value.data());
// We need to consume the next argument if the current arg is a plain
@@ -4043,6 +4045,16 @@
// FIXME: Add -static support, once we have it.
+ // Consume all the warning flags. Usually this would be handled more
+ // gracefully by -cc1 (warning about unknown warning flags, etc) but -cc1as
+ // doesn't handle that so rather than warning about unused flags that are
+ // actually used, we'll lie by omission instead.
+ // FIXME: Stop lying and consume only the appropriate driver flags
+ for (arg_iterator it = Args.filtered_begin(options::OPT_W_Group),
+ ie = Args.filtered_end();
+ it != ie; ++it)
+ (*it)->claim();
+
CollectArgsForIntegratedAssembler(C, Args, CmdArgs,
getToolChain().getDriver());
diff --git a/clang/test/Driver/integrated-as.c b/clang/test/Driver/integrated-as.c
index e73174e..5bf1f84 100644
--- a/clang/test/Driver/integrated-as.c
+++ b/clang/test/Driver/integrated-as.c
@@ -2,3 +2,8 @@
// CHECK: cc1as
// CHECK: -mrelax-all
+
+// RUN: %clang -### -c -integrated-as -Wa,-compress-debug-sections -Wno-missing-debug-compression %s 2>&1 | FileCheck --check-prefix=COMPRESS_DEBUG_QUIET %s
+// COMPRESS_DEBUG_QUIET-NOT: warning: DWARF compression is not implemented
+// COMPRESS_DEBUG_QUIET-NOT: warning: argument unused during compilation
+// COMPRESS_DEBUG_QUIET: -cc1
diff --git a/clang/test/Driver/integrated-as.s b/clang/test/Driver/integrated-as.s
index a446f4a..c7f7fc7 100644
--- a/clang/test/Driver/integrated-as.s
+++ b/clang/test/Driver/integrated-as.s
@@ -31,3 +31,12 @@
// RUN: %clang -### -c -integrated-as %s -Xassembler -Ifoo_dir 2>&1 | FileCheck --check-prefix=XA_INCLUDE2 %s
// XA_INCLUDE2: cc1as
// XA_INCLUDE2: "-Ifoo_dir"
+
+// RUN: %clang -### -c -integrated-as -Wa,-compress-debug-sections %s 2>&1 | FileCheck --check-prefix=COMPRESS_DEBUG %s
+// COMPRESS_DEBUG: warning: DWARF compression is not implemented
+// COMPRESS_DEBUG: -cc1as
+
+// RUN: %clang -### -c -integrated-as -Wa,-compress-debug-sections -Wno-missing-debug-compression %s 2>&1 | FileCheck --check-prefix=COMPRESS_DEBUG_QUIET %s
+// COMPRESS_DEBUG_QUIET-NOT: warning: DWARF compression is not implemented
+// COMPRESS_DEBUG_QUIET-NOT: warning: argument unused during compilation
+// COMPRESS_DEBUG_QUIET: -cc1as