[PATCH] D20948: [OpenCL] Fix access qualifiers handling for typedefs

Anastasia Stulova via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 8 10:08:00 PDT 2016


Anastasia added inline comments.

================
Comment at: lib/Sema/SemaType.cpp:6494
@@ +6493,3 @@
+    default:
+      assert(0 && "unable to find corresponding image type");
+    }
----------------
Please start the assert message from the upper case and finish with .

================
Comment at: test/SemaOpenCL/images-typedef.cl:10
@@ +9,3 @@
+#if __OPENCL_C_VERSION__ >= 200
+  typedef read_write image1d_t img1d_rw;
+#endif
----------------
I think for OpenCL < 2.0 we should give an error that read_write can not be used in earlier than OpenCL version 2.0.

================
Comment at: test/SemaOpenCL/images-typedef.cl:21
@@ +20,3 @@
+#if __OPENCL_C_VERSION__ >= 200
+  void myReadWrite(read_write image1d_t);
+#endif
----------------
don't indent inside macro directives #if

================
Comment at: test/SemaOpenCL/images-typedef.cl:41
@@ +40,3 @@
+  }
+#endif
+
----------------
Yes, looks good!

================
Comment at: test/SemaOpenCL/images-typedef.cl:44
@@ +43,3 @@
+kernel void k5(img1d_ro_default img) {
+  myWrite(img); // expected-error {{passing 'img1d_ro_default' (aka '__read_only image1d_t') to parameter of incompatible type '__write_only image1d_t'}}
+}
----------------
Sure, makes sense!


http://reviews.llvm.org/D20948





More information about the cfe-commits mailing list