summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/include/clang/Driver/Options.td2
-rw-r--r--clang/test/Driver/linker-opts.c12
2 files changed, 13 insertions, 1 deletions
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 1a8c7c606d1..a28518e8c66 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -337,7 +337,7 @@ def Xassembler : Separate<["-"], "Xassembler">,
HelpText<"Pass <arg> to the assembler">, MetaVarName<"<arg>">;
def Xclang : Separate<["-"], "Xclang">,
HelpText<"Pass <arg> to the clang compiler">, MetaVarName<"<arg>">,
- Flags<[DriverOption, CoreOption]>;
+ Flags<[DriverOption, CoreOption]>, Group<CompileOnly_Group>;
def Xcuda_fatbinary : Separate<["-"], "Xcuda-fatbinary">,
HelpText<"Pass <arg> to fatbinary invocation">, MetaVarName<"<arg>">;
def Xcuda_ptxas : Separate<["-"], "Xcuda-ptxas">,
diff --git a/clang/test/Driver/linker-opts.c b/clang/test/Driver/linker-opts.c
index 24866a63b1f..29ef136c8b7 100644
--- a/clang/test/Driver/linker-opts.c
+++ b/clang/test/Driver/linker-opts.c
@@ -1,3 +1,6 @@
+// RUN: rm -rf %t
+// RUN: mkdir %t
+//
// RUN: env LIBRARY_PATH=%T/test1 %clang -x c %s -### 2>&1 | FileCheck %s
// CHECK: "-L{{.*}}/test1"
@@ -9,3 +12,12 @@
// Make sure that LIBRARY_PATH works for both i386 and x86_64 on Darwin.
// RUN: env LIBRARY_PATH=%T/test1 %clang -target x86_64-apple-darwin %s -### 2>&1 | FileCheck %s
// RUN: env LIBRARY_PATH=%T/test1 %clang -target i386-apple-darwin %s -### 2>&1 | FileCheck %s
+//
+// Make sure that we don't warn on unused compiler arguments.
+// RUN: %clang -Xclang -I. -x c %s -c -o %t/tmp.o
+// RUN: %clang -Xclang -I. %t/tmp.o -o %t/tmp -### 2>&1 | FileCheck %s --check-prefix=NO-UNUSED
+// NO-UNUSED-NOT: warning:{{.*}}unused
+//
+// Make sure that we do warn in other cases.
+// RUN: %clang %s -lfoo -c -o %t/tmp2.o -### 2>&1 | FileCheck %s --check-prefix=UNUSED
+// UNUSED: warning:{{.*}}unused
OpenPOWER on IntegriCloud