summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCUDA/device-var-init.cu
diff options
context:
space:
mode:
authorJustin Lebar <jlebar@google.com>2016-10-19 00:06:49 +0000
committerJustin Lebar <jlebar@google.com>2016-10-19 00:06:49 +0000
commitd3fd70dedd75f9b27f7198840a1ada82d54b95ab (patch)
tree13643e417a8d8d574929e75251dfce4f61a47bf9 /clang/test/SemaCUDA/device-var-init.cu
parentb47711ab274e2de40e014dc72d9d87f884a893d7 (diff)
downloadbcm5719-llvm-d3fd70dedd75f9b27f7198840a1ada82d54b95ab.tar.gz
bcm5719-llvm-d3fd70dedd75f9b27f7198840a1ada82d54b95ab.zip
[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
Diffstat (limited to 'clang/test/SemaCUDA/device-var-init.cu')
-rw-r--r--clang/test/SemaCUDA/device-var-init.cu12
1 files changed, 12 insertions, 0 deletions
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(); }
OpenPOWER on IntegriCloud