Author: rsmith Date: Mon Apr 18 18:12:59 2016 New Revision: 266695 URL: http://llvm.org/viewvc/llvm-project?rev=266695&view=rev Log: Mark -Xclang as being a compilation-only option so that the clang driver doesn't warn if it's passed to a link action. This matches the behavior for most other compilation-only options (including things like -f flags), and is necessary to suppress warnings on systems like cmake that always pass all compile flags to the linker.
Modified: cfe/trunk/include/clang/Driver/Options.td cfe/trunk/test/Driver/linker-opts.c Modified: cfe/trunk/include/clang/Driver/Options.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=266695&r1=266694&r2=266695&view=diff ============================================================================== --- cfe/trunk/include/clang/Driver/Options.td (original) +++ cfe/trunk/include/clang/Driver/Options.td Mon Apr 18 18:12:59 2016 @@ -337,7 +337,7 @@ def Xassembler : Separate<["-"], "Xassem 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">, Modified: cfe/trunk/test/Driver/linker-opts.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/linker-opts.c?rev=266695&r1=266694&r2=266695&view=diff ============================================================================== --- cfe/trunk/test/Driver/linker-opts.c (original) +++ cfe/trunk/test/Driver/linker-opts.c Mon Apr 18 18:12:59 2016 @@ -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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits