summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaOpenCL/nosvm.cl
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/SemaOpenCL/nosvm.cl')
-rw-r--r--clang/test/SemaOpenCL/nosvm.cl17
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/test/SemaOpenCL/nosvm.cl b/clang/test/SemaOpenCL/nosvm.cl
new file mode 100644
index 00000000000..658cb3aaf4d
--- /dev/null
+++ b/clang/test/SemaOpenCL/nosvm.cl
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -verify %s
+// RUN: %clang_cc1 -verify -cl-std=CL2.0 -D CL20 %s
+// RUN: %clang_cc1 -verify -x c -D NOCL %s
+
+#ifndef NOCL
+kernel void f(__attribute__((nosvm)) global int* a);
+#ifndef CL20
+// expected-error@-2 {{'nosvm' attribute requires OpenCL version 2.0}}
+#else
+// expected-warning@-4 {{'nosvm' attribute is deprecated and ignored in OpenCL version 2.0}}
+#endif
+
+__attribute__((nosvm)) void g(); // expected-warning {{'nosvm' attribute only applies to variables}}
+
+#else
+void f(__attribute__((nosvm)) int* a); // expected-warning {{'nosvm' attribute ignored}}
+#endif
OpenPOWER on IntegriCloud