r302633 - [OpenCL] Handle OpenCL specific subelement types

Egor Churaev via cfe-commits cfe-commits at lists.llvm.org
Wed May 10 03:28:35 PDT 2017


Author: echuraev
Date: Wed May 10 05:28:34 2017
New Revision: 302633

URL: http://llvm.org/viewvc/llvm-project?rev=302633&view=rev
Log:
[OpenCL] Handle OpenCL specific subelement types

Reviewers: Anastasia, cfe-commits

Reviewed By: Anastasia

Subscribers: bader, yaxunl

Differential Revision: https://reviews.llvm.org/D32898

Added:
    cfe/trunk/test/SemaOpenCL/array-init.cl
Modified:
    cfe/trunk/lib/Sema/SemaInit.cpp

Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=302633&r1=302632&r2=302633&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Wed May 10 05:28:34 2017
@@ -1209,7 +1209,7 @@ void InitListChecker::CheckSubElementTyp
 
   } else {
     assert((ElemType->isRecordType() || ElemType->isVectorType() ||
-            ElemType->isClkEventT()) && "Unexpected type");
+            ElemType->isOpenCLSpecificType()) && "Unexpected type");
 
     // C99 6.7.8p13:
     //

Added: cfe/trunk/test/SemaOpenCL/array-init.cl
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaOpenCL/array-init.cl?rev=302633&view=auto
==============================================================================
--- cfe/trunk/test/SemaOpenCL/array-init.cl (added)
+++ cfe/trunk/test/SemaOpenCL/array-init.cl Wed May 10 05:28:34 2017
@@ -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};
+}
+




More information about the cfe-commits mailing list