xref: /llvm-project/clang/test/SemaOpenCL/nosvm.cl (revision 22db4824b9e03fe8c2e9217d6832b71ac23c175f)
1// RUN: %clang_cc1 -verify %s
2// RUN: %clang_cc1 -verify -cl-std=CL2.0 %s
3// RUN: %clang_cc1 -verify -cl-std=clc++1.0 %s
4// RUN: %clang_cc1 -verify -x c -D NOCL %s
5
6#ifndef NOCL
7kernel void f(__attribute__((nosvm)) global int* a);
8#if (__OPENCL_C_VERSION__ == 200)
9// expected-warning@-2 {{'nosvm' attribute is deprecated and ignored in OpenCL C version 2.0}}
10#elif (__OPENCL_CPP_VERSION__ == 100)
11// expected-warning@-4 {{'nosvm' attribute is deprecated and ignored in C++ for OpenCL version 1.0}}
12#else
13// expected-error@-6 {{attribute 'nosvm' is supported in the OpenCL version 2.0 onwards}}
14#endif
15
16__attribute__((nosvm)) void g(void); // expected-warning {{'nosvm' attribute only applies to variables}}
17
18#else
19void f(__attribute__((nosvm)) int* a); // expected-warning {{'nosvm' attribute ignored}}
20#endif
21