diff options
author | Guy Benyei <guy.benyei@intel.com> | 2013-02-07 10:55:47 +0000 |
---|---|---|
committer | Guy Benyei <guy.benyei@intel.com> | 2013-02-07 10:55:47 +0000 |
commit | 610541989a524be452a5674cd3fb78304ce3fa8a (patch) | |
tree | 531d41128c330184f827fe19a030d2f8387f35dd /clang/lib/Sema/SemaDecl.cpp | |
parent | 4ea6816247a211e731b7929ca08d682c781e3348 (diff) | |
download | bcm5719-llvm-610541989a524be452a5674cd3fb78304ce3fa8a.tar.gz bcm5719-llvm-610541989a524be452a5674cd3fb78304ce3fa8a.zip |
Add OpenCL samplers as Clang builtin types and check sampler related restrictions.
llvm-svn: 174601
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 45f7cae960a..7c31be6c13f 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -4483,6 +4483,14 @@ Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, SCAsWritten = SC_OpenCLWorkGroupLocal; } + // OpenCL v1.2 s6.9.b p4: + // The sampler type cannot be used with the __local and __global address + // space qualifiers. + if (R->isSamplerT() && (R.getAddressSpace() == LangAS::opencl_local || + R.getAddressSpace() == LangAS::opencl_global)) { + Diag(D.getIdentifierLoc(), diag::err_wrong_sampler_addressspace); + } + // OpenCL 1.2 spec, p6.9 r: // The event type cannot be used to declare a program scope variable. // The event type cannot be used with the __local, __constant and __global |