diff options
| author | Anastasia Stulova <anastasia.stulova@arm.com> | 2017-06-20 14:50:45 +0000 |
|---|---|---|
| committer | Anastasia Stulova <anastasia.stulova@arm.com> | 2017-06-20 14:50:45 +0000 |
| commit | e437b6a52b7def19dfc61f72f71d6c63b5f623cc (patch) | |
| tree | 5e46696a691c3d2aa78db8301d4bd48eb86ea4e3 /clang/test/SemaOpenCL/storageclass.cl | |
| parent | ad870f82858671c5089809bda1286780506f4c81 (diff) | |
| download | bcm5719-llvm-e437b6a52b7def19dfc61f72f71d6c63b5f623cc.tar.gz bcm5719-llvm-e437b6a52b7def19dfc61f72f71d6c63b5f623cc.zip | |
[OpenCL] Diagnose scoped address-space qualified variables
Produce an error if variables qualified with a local or
a constant address space are not declared in the outermost
scope of a kernel.
Patch by Simon Perretta.
Differential Revision: https://reviews.llvm.org/D34024
llvm-svn: 305798
Diffstat (limited to 'clang/test/SemaOpenCL/storageclass.cl')
| -rw-r--r-- | clang/test/SemaOpenCL/storageclass.cl | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/test/SemaOpenCL/storageclass.cl b/clang/test/SemaOpenCL/storageclass.cl index e611313b4a7..9a461068f23 100644 --- a/clang/test/SemaOpenCL/storageclass.cl +++ b/clang/test/SemaOpenCL/storageclass.cl @@ -13,6 +13,11 @@ void kernel foo(int x) { constant int L1 = 0; local int L2; + if (true) { + local int L1; // expected-error {{variables in the local address space can only be declared in the outermost scope of a kernel function}} + constant int L1 = 42; // expected-error {{variables in the constant address space can only be declared in the outermost scope of a kernel function}} + } + auto int L3 = 7; // expected-error{{OpenCL version 1.2 does not support the 'auto' storage class specifier}} global int L4; // expected-error{{function scope variable cannot be declared in global address space}} __attribute__((address_space(100))) int L5; // expected-error{{automatic variable qualified with an invalid address space}} |

