[PATCH] D34980: [OpenCL] Test on image access modifiers and image type can only be a type of a function argument.
Anastasia Stulova via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 4 11:37:10 PDT 2017
Anastasia added inline comments.
================
Comment at: test/SemaOpenCL/images.cl:14
+void myReadWrite (read_write image2d_t);
+void myIndifferent (image2d_t); // expected-note 2{{passing argument to parameter here}}
+
----------------
Would it be better to rename to make the purpose more clear:
myIndifferent -> myDefault
================
Comment at: test/SemaOpenCL/images.cl:17
+
+kernel void k1 (read_only image2d_t img) {
+ myWrite(img); // expected-error {{passing '__read_only image2d_t' to parameter of incompatible type '__write_only image2d_t'}}
----------------
Like above I would try to give the function some descriptive names...
================
Comment at: test/SemaOpenCL/images.cl:25
+
+// Should be all OK.
+kernel void k3 (read_write image2d_t img) {
----------------
I don't get this comment.
================
Comment at: test/SemaOpenCL/images.cl:32
+
+// Legal to path everything to an 'indifferent' function.
+kernel void k4(read_write image2d_t i1, read_only image2d_t i2,
----------------
I don't get this comment too?
================
Comment at: test/SemaOpenCL/images.cl:36
+ myIndifferent(i1); // expected-error {{passing '__read_write image2d_t' to parameter of incompatible type '__read_only image2d_t'}}
+ myIndifferent(i2);
+ myIndifferent(i3); // expected-error {{passing '__write_only image2d_t' to parameter of incompatible type '__read_only image2d_t'}}
----------------
For consistency we could add
//read_only = read_only
================
Comment at: test/SemaOpenCL/images.cl:40
+
+kernel void k5(read_only image2d_t srcimg)
+{
----------------
I think we test this in test/SemaOpenCL/invalid-image.cl
Feel free to combine in one file if you like.
https://reviews.llvm.org/D34980
More information about the cfe-commits
mailing list