]> granicus.if.org Git - clang/commitdiff
[OpenCL] reserve_id_t cannot be used as argument to kernel function
authorEgor Churaev <egor.churaev@intel.com>
Thu, 25 May 2017 07:18:37 +0000 (07:18 +0000)
committerEgor Churaev <egor.churaev@intel.com>
Thu, 25 May 2017 07:18:37 +0000 (07:18 +0000)
Reviewers: Anastasia

Reviewed By: Anastasia

Subscribers: yaxunl, cfe-commits, bader

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303846 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp
test/SemaOpenCL/invalid-pipes-cl2.0.cl

index fd33001f92182cb52140191499dc5cbb8e88ad97..96fd952c81c77e1c26545d9d78c8834a758e11cf 100644 (file)
@@ -7920,10 +7920,7 @@ static OpenCLParamType getOpenCLKernelParameterType(Sema &S, QualType PT) {
   if (PT->isImageType())
     return PtrKernelParam;
 
-  if (PT->isBooleanType())
-    return InvalidKernelParam;
-
-  if (PT->isEventT())
+  if (PT->isBooleanType() || PT->isEventT() || PT->isReserveIDT())
     return InvalidKernelParam;
 
   // OpenCL extension spec v1.2 s9.5:
index 5db953108bef624a4a8879b929f5d6c6a7a17091..a50811650d2c7dc9bce24b506fd99cdfad8dd9a2 100644 (file)
@@ -3,6 +3,11 @@
 global pipe int gp;            // expected-error {{type '__global read_only pipe int' can only be used as a function parameter in OpenCL}}
 global reserve_id_t rid;          // expected-error {{the '__global reserve_id_t' type cannot be used to declare a program scope variable}}
 
+extern pipe write_only int get_pipe(); // expected-error {{type '__global write_only pipe int ()' can only be used as a function parameter in OpenCL}}
+
+kernel void test_invalid_reserved_id(reserve_id_t ID) { // expected-error {{'reserve_id_t' cannot be used as the type of a kernel parameter}}
+}
+
 void test1(pipe int *p) {// expected-error {{pipes packet types cannot be of reference type}}
 }
 void test2(pipe p) {// expected-error {{missing actual type specifier for pipe}}