diff options
| author | Sven van Haastregt <sven.vanhaastregt@arm.com> | 2017-05-08 09:29:06 +0000 |
|---|---|---|
| committer | Sven van Haastregt <sven.vanhaastregt@arm.com> | 2017-05-08 09:29:06 +0000 |
| commit | 511f0b8d02ae14d243aeb81cb9e3621ba25076d4 (patch) | |
| tree | 78841be850daddd623e7bcde15ef9b11d15e0af2 /clang/test | |
| parent | 605b965ae5068f62dc49ae61d1bb89ef8b61b0dc (diff) | |
| download | bcm5719-llvm-511f0b8d02ae14d243aeb81cb9e3621ba25076d4.tar.gz bcm5719-llvm-511f0b8d02ae14d243aeb81cb9e3621ba25076d4.zip | |
[OpenCL] Check that global samplers are const
Patch by Simon Perretta.
Differential Revision: https://reviews.llvm.org/D32856
llvm-svn: 302411
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/SemaOpenCL/sampler_t.cl | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/test/SemaOpenCL/sampler_t.cl b/clang/test/SemaOpenCL/sampler_t.cl index 0dddeeb3901..4d68dd20a17 100644 --- a/clang/test/SemaOpenCL/sampler_t.cl +++ b/clang/test/SemaOpenCL/sampler_t.cl @@ -9,7 +9,8 @@ constant sampler_t glb_smp = CLK_ADDRESS_CLAMP_TO_EDGE | CLK_NORMALIZED_COORDS_TRUE | CLK_FILTER_LINEAR; constant sampler_t glb_smp2; // expected-error{{variable in constant address space must be initialized}} -global sampler_t glb_smp3 = CLK_ADDRESS_CLAMP_TO_EDGE | CLK_NORMALIZED_COORDS_TRUE | CLK_FILTER_NEAREST; // expected-error{{sampler type cannot be used with the __local and __global address space qualifiers}} +global sampler_t glb_smp3 = CLK_ADDRESS_CLAMP_TO_EDGE | CLK_NORMALIZED_COORDS_TRUE | CLK_FILTER_NEAREST; // expected-error{{sampler type cannot be used with the __local and __global address space qualifiers}} expected-error {{global sampler requires a const or constant address space qualifier}} +const global sampler_t glb_smp3_const = CLK_ADDRESS_CLAMP_TO_EDGE | CLK_NORMALIZED_COORDS_TRUE | CLK_FILTER_LINEAR; // expected-error{{sampler type cannot be used with the __local and __global address space qualifiers}} constant sampler_t glb_smp4 = 0; #ifdef CHECK_SAMPLER_VALUE @@ -38,6 +39,11 @@ constant struct sampler_s { sampler_t bad(void); //expected-error{{declaring function return value of type 'sampler_t' is not allowed}} +sampler_t global_nonconst_smp = 0; // expected-error {{global sampler requires a const or constant address space qualifier}} + +const sampler_t glb_smp10 = CLK_ADDRESS_CLAMP_TO_EDGE | CLK_NORMALIZED_COORDS_TRUE | CLK_FILTER_LINEAR; +const constant sampler_t glb_smp11 = CLK_ADDRESS_CLAMP_TO_EDGE | CLK_NORMALIZED_COORDS_TRUE | CLK_FILTER_LINEAR; + void kernel ker(sampler_t argsmp) { local sampler_t smp; // expected-error{{sampler type cannot be used with the __local and __global address space qualifiers}} const sampler_t const_smp = CLK_ADDRESS_CLAMP_TO_EDGE | CLK_NORMALIZED_COORDS_TRUE | CLK_FILTER_LINEAR; |

