diff options
| author | Artem Belevich <tra@google.com> | 2015-07-28 21:01:30 +0000 |
|---|---|---|
| committer | Artem Belevich <tra@google.com> | 2015-07-28 21:01:30 +0000 |
| commit | baae093e49aef8f7600f633f0367a91987b0c6e5 (patch) | |
| tree | d273570bea9cab4548ee8cfce5fbd9827f7b0e74 /clang | |
| parent | 4242f41d8ab4c1fdd8168b97cf3813a3bfd90dd9 (diff) | |
| download | bcm5719-llvm-baae093e49aef8f7600f633f0367a91987b0c6e5.tar.gz bcm5719-llvm-baae093e49aef8f7600f633f0367a91987b0c6e5.zip | |
Silence unused argument warning for --cuda-host-only.
Differential Revision: http://reviews.llvm.org/D11575
llvm-svn: 243479
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Driver/Driver.cpp | 4 | ||||
| -rw-r--r-- | clang/test/Driver/cuda-options.cu | 18 |
2 files changed, 22 insertions, 0 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 86cf8556ef2..a39f7fc678f 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -1490,6 +1490,10 @@ void Driver::BuildActions(const ToolChain &TC, DerivedArgList &Args, // Claim ignored clang-cl options. Args.ClaimAllArgs(options::OPT_cl_ignored_Group); + + // Claim --cuda-host-only arg which may be passed to non-CUDA + // compilations and should not trigger warnings there. + Args.ClaimAllArgs(options::OPT_cuda_host_only); } std::unique_ptr<Action> diff --git a/clang/test/Driver/cuda-options.cu b/clang/test/Driver/cuda-options.cu index 37411680b61..d1575db727b 100644 --- a/clang/test/Driver/cuda-options.cu +++ b/clang/test/Driver/cuda-options.cu @@ -69,6 +69,20 @@ // Make sure we don't link anything. // RUN: -check-prefix CUDA-NL %s +// --cuda-host-only should never trigger unused arg warning. +// RUN: %clang -### -target x86_64-linux-gnu --cuda-host-only -c %s 2>&1 | \ +// RUN: FileCheck -check-prefix CUDA-NO-UNUSED-CHO %s +// RUN: %clang -### -target x86_64-linux-gnu --cuda-host-only -x c -c %s 2>&1 | \ +// RUN: FileCheck -check-prefix CUDA-NO-UNUSED-CHO %s + +// --cuda-device-only should not produce warning compiling CUDA files +// RUN: %clang -### -target x86_64-linux-gnu --cuda-device-only -c %s 2>&1 | \ +// RUN: FileCheck -check-prefix CUDA-NO-UNUSED-CDO %s + +// --cuda-device-only should warn during non-CUDA compilation. +// RUN: %clang -### -target x86_64-linux-gnu --cuda-device-only -x c -c %s 2>&1 | \ +// RUN: FileCheck -check-prefix CUDA-UNUSED-CDO %s + // Match device-side compilation // CUDA-D1: "-cc1" "-triple" "nvptx{{(64)?}}-nvidia-cuda" // CUDA-D1-SAME: "-fcuda-is-device" @@ -109,3 +123,7 @@ // Match no linker // CUDA-NL-NOT: "{{.*}}{{ld|link}}{{(.exe)?}}" + +// CUDA-NO-UNUSED-CHO-NOT: warning: argument unused during compilation: '--cuda-host-only' +// CUDA-UNUSED-CDO: warning: argument unused during compilation: '--cuda-device-only' +// CUDA-NO-UNUSED-CDO-NOT: warning: argument unused during compilation: '--cuda-device-only' |

