summaryrefslogtreecommitdiff
path: root/test/SemaOpenCLCXX/method-overload-address-space.cl
diff options
context:
space:
mode:
authorAnastasia Stulova <anastasia.stulova@arm.com>2019-01-21 16:01:38 +0000
committerAnastasia Stulova <anastasia.stulova@arm.com>2019-01-21 16:01:38 +0000
commit710b2573329fdf3f6180e159812b4f4fc368fc79 (patch)
tree2222c94c9d4e3b27b2f22047274817a495f3f275 /test/SemaOpenCLCXX/method-overload-address-space.cl
parent352131fc8567e599b01e3cb56cd302ecd3d2791f (diff)
downloadclang-710b2573329fdf3f6180e159812b4f4fc368fc79.tar.gz
[OpenCL] Allow address spaces as method qualifiers.
Methods can now be qualified with address spaces to prevent undesirable conversions to generic or to provide custom implementation to be used if the object is located in certain memory segments. This commit extends parsing and standard C++ overloading to work for an address space of a method (i.e. implicit 'this' parameter). Differential Revision: https://reviews.llvm.org/D55850 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351747 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaOpenCLCXX/method-overload-address-space.cl')
-rw-r--r--test/SemaOpenCLCXX/method-overload-address-space.cl20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/SemaOpenCLCXX/method-overload-address-space.cl b/test/SemaOpenCLCXX/method-overload-address-space.cl
new file mode 100644
index 0000000000..64a279549c
--- /dev/null
+++ b/test/SemaOpenCLCXX/method-overload-address-space.cl
@@ -0,0 +1,20 @@
+//RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=c++ -pedantic -verify
+
+struct C {
+ void m1() __local __local; //expected-warning{{multiple identical address spaces specified for type}}
+ //expected-note@-1{{candidate function}}
+ void m1() __global;
+ //expected-note@-1{{candidate function}}
+ void m2() __global __local; //expected-error{{multiple address spaces specified for type}}
+};
+
+__global C c_glob;
+
+__kernel void bar() {
+ __local C c_loc;
+ C c_priv;
+
+ c_glob.m1();
+ c_loc.m1();
+ c_priv.m1(); //expected-error{{no matching member function for call to 'm1'}}
+}