[PATCH] D32898: [OpenCL] Handle OpenCL specific subelement types

Egor Churaev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 10 01:45:31 PDT 2017


echuraev updated this revision to Diff 98416.

https://reviews.llvm.org/D32898

Files:
  lib/Sema/SemaInit.cpp
  test/SemaOpenCL/array-init.cl


Index: test/SemaOpenCL/array-init.cl
===================================================================
--- /dev/null
+++ test/SemaOpenCL/array-init.cl
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0
+// expected-no-diagnostics
+
+__kernel void k1(queue_t q1, queue_t q2) {
+  queue_t q[] = {q1, q2};
+}
+
+__kernel void k2(read_only pipe int p) {
+  reserve_id_t i1 = reserve_read_pipe(p, 1);
+  reserve_id_t i2 = reserve_read_pipe(p, 1);
+  reserve_id_t i[] = {i1, i2};
+}
+
+event_t create_event();
+__kernel void k3() {
+  event_t e1 = create_event();
+  event_t e2 = create_event();
+  event_t e[] = {e1, e2};
+}
+
Index: lib/Sema/SemaInit.cpp
===================================================================
--- lib/Sema/SemaInit.cpp
+++ lib/Sema/SemaInit.cpp
@@ -1209,7 +1209,7 @@
 
   } else {
     assert((ElemType->isRecordType() || ElemType->isVectorType() ||
-            ElemType->isClkEventT()) && "Unexpected type");
+            ElemType->isOpenCLSpecificType()) && "Unexpected type");
 
     // C99 6.7.8p13:
     //


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32898.98416.patch
Type: text/x-patch
Size: 1096 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170510/4cd5e10c/attachment.bin>


More information about the cfe-commits mailing list