[OpenCL] Fix access qualifiers handling for typedefs
OpenCL s6.6: "Access qualifier must be used with image object arguments
of kernels and of user-defined functions [...] If no qualifier is
provided, read_only is assumed".
This does not define the behavior for image types used in typedef
declaration, but following the spec logic, we should allow access
qualifiers specification in typedefs, e.g.:
typedef write_only image1d_t img1d_wo;
Unlike cv-qualifiers, user cannot add access qualifier to a typedef
type, i.e. this is not allowed:
typedef image1d_t img1d; // note: previously declared 'read_only' here
void foo(write_only img1d im) {} // error: multiple access qualifier
Patch by Andrew Savonichev.
Reviewers: Anastasia Stulova.
Differential revision: http://reviews.llvm.org/D20948
llvm-svn: 274858
diff --git a/clang/test/CodeGenOpenCL/kernel-arg-info.cl b/clang/test/CodeGenOpenCL/kernel-arg-info.cl
index 9f61f1c..5a5c8f9 100644
--- a/clang/test/CodeGenOpenCL/kernel-arg-info.cl
+++ b/clang/test/CodeGenOpenCL/kernel-arg-info.cl
@@ -49,7 +49,7 @@
// ARGINFO: !kernel_arg_name ![[MD46:[0-9]+]]
typedef image1d_t myImage;
-kernel void foo5(read_only myImage img1, write_only image1d_t img2) {
+kernel void foo5(myImage img1, write_only image1d_t img2) {
}
// CHECK: define spir_kernel void @foo5{{[^!]+}}
// CHECK: !kernel_arg_addr_space ![[MD41:[0-9]+]]