From d3fd70dedd75f9b27f7198840a1ada82d54b95ab Mon Sep 17 00:00:00 2001 From: Justin Lebar Date: Wed, 19 Oct 2016 00:06:49 +0000 Subject: [CUDA] Rework tests now that we emit deferred diagnostics during sema. Test-only change. Summary: Previously we had to split out a lot of our tests into a test that checked only immediate errors and a test that checked only deferred errors. This was because, if you emitted any immediate errors, we wouldn't run codegen, where the deferred errors were emitted. We've fixed this, and now emit deferred errors during sema. This lets us merge a bunch of tests, and lets us convert some other tests to -fsyntax-only. Reviewers: tra Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25755 llvm-svn: 284553 --- clang/test/SemaCUDA/device-var-init.cu | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'clang/test/SemaCUDA/device-var-init.cu') diff --git a/clang/test/SemaCUDA/device-var-init.cu b/clang/test/SemaCUDA/device-var-init.cu index 122dfca4232..71f2352843b 100644 --- a/clang/test/SemaCUDA/device-var-init.cu +++ b/clang/test/SemaCUDA/device-var-init.cu @@ -213,3 +213,15 @@ __device__ void df_sema() { static int v; // expected-error@-1 {{within a __device__ function, only __shared__ variables may be marked 'static'}} } + +__host__ __device__ void hd_sema() { + static int x = 42; +#ifdef __CUDA_ARCH__ + // expected-error@-2 {{within a __host__ __device__ function, only __shared__ variables may be marked 'static'}} +#endif +} + +inline __host__ __device__ void hd_emitted_host_only() { + static int x = 42; // no error on device because this is never codegen'ed there. +} +void call_hd_emitted_host_only() { hd_emitted_host_only(); } -- cgit v1.2.3