]> granicus.if.org Git - clang/commit
[OpenCL] Fix file-scope const sampler variable for 2.0
authorYaxun Liu <Yaxun.Liu@amd.com>
Mon, 27 May 2019 11:19:07 +0000 (11:19 +0000)
committerYaxun Liu <Yaxun.Liu@amd.com>
Mon, 27 May 2019 11:19:07 +0000 (11:19 +0000)
commitee93b01e3b44ae0130a6b31dce0f23d22a4249e2
treeacfa5f71ab53721a0642d652e63601cb20ef17e7
parent1078bd6094be2470fb7eb4f60ca47e0206f88ab5
[OpenCL] Fix file-scope const sampler variable for 2.0

OpenCL spec v2.0 s6.13.14:

Samplers can also be declared as global constants in the program
source using the following syntax.

   const sampler_t <sampler name> = <value>
This works fine for OpenCL 1.2 but fails for 2.0, because clang duduces
address space of file-scope const sampler variable to be in global address
space whereas spec v2.0 s6.9.b forbids file-scope sampler variable to be
in global address space.

The fix is not to deduce address space for file-scope sampler variables.

Differential Revision: https://reviews.llvm.org/D62197

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@361757 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/SemaType.cpp
test/CodeGenOpenCL/sampler.cl
test/SemaOpenCL/sampler_t.cl