[PATCH] D27099: [OpenCL] Prohibit using reserve_id_t in program scope.

Anastasia Stulova via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 24 10:57:13 PST 2016

Anastasia added a comment.

Btw, Spec v2.0 s6.9.p seems to mention other types as well!

Comment at: lib/Sema/SemaDecl.cpp:5923
+  if (getLangOpts().OpenCL && (NULL == S->getParent())) {
+    if (R->isReserveIDT()) {
- Could we combine with the OpenCL check above?

I see that we already have many more scattered all over in this functions. Perhaps some cleanup would be nice at some point. :)

- Also not sure whether
  return nullptr;
is needed?

- Could you add a reference to the Spec section too.

Comment at: test/SemaOpenCL/invalid-pipes-cl2.0.cl:3
+global pipe int GlobalPipe;            // expected-error {{type '__global read_only pipe int' can only be used as a function parameter in OpenCL}}
+global reserve_id_t GlobalID;          // expected-error {{the '__global reserve_id_t' type cannot be used to declare a program scope variable}}
Variable names appear inconsistent with the rest. :)

Comment at: test/SemaOpenCL/invalid-pipes-cl2.0.cl:27
+void test7(read_write pipe int p) {    // expected-error {{access qualifier 'read_write' can not be used for 'read_only pipe int'}}
this seems to be tested in test/SemaOpenCL/access-qualifier.cl


More information about the cfe-commits mailing list