[PATCH] D16040: [OpenCL] Refine OpenCLImageAccessAttr to OpenCLAccessAttr

Anastasia Stulova via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 9 10:02:23 PST 2016


Anastasia added a comment.

Adding a few final comments, otherwise, looks good!


================
Comment at: lib/Sema/SemaDeclAttr.cpp:5050
@@ +5049,3 @@
+
+  // Check if there only one access qualifier
+  if (D->hasAttr<OpenCLAccessAttr>()) {
----------------
there is only one

================
Comment at: lib/Sema/SemaDeclAttr.cpp:5058
@@ +5057,3 @@
+
+  // OpenCL v2.0 s6.6: read_write can be used for image types to specify that an
+  // image object can be read and written.
----------------
OpenCL v2.0 s6.6: -> OpenCL v2.0 s6.6 -

================
Comment at: lib/Sema/SemaDeclAttr.cpp:5060
@@ +5059,3 @@
+  // image object can be read and written.
+  // OpenCL v2.0 s6.13.6: A kernel cannot read from and write to the same pipe
+  // object. Using the read_write (or __read_write) qualifier with the pipe
----------------
OpenCL v2.0 s6.13.6: -> OpenCL v2.0 s6.13.6 -

================
Comment at: lib/Sema/SemaDeclAttr.cpp:5823
@@ -5788,8 +5822,3 @@
 
-  // Walk the declarator structure, applying decl attributes that were in a type
-  // position to the decl itself.  This handles cases like:
-  //   int *__attr__(x)** D;
-  // when X is a decl attribute.
-  for (unsigned i = 0, e = PD.getNumTypeObjects(); i != e; ++i)
-    if (const AttributeList *Attrs = PD.getTypeObject(i).getAttrs())
-      ProcessDeclAttributeList(S, D, Attrs, /*IncludeCXX11Attributes=*/false);
+  // Skip pipe type, it will be processed twice with its element type
+  const ParmVarDecl *PDecl = llvm::dyn_cast<ParmVarDecl>(D);
----------------
Did you mean to say:

"Skip pipe type, otherwise it will be processed twice with its element type"

================
Comment at: lib/Sema/SemaType.cpp:6224
@@ +6223,3 @@
+                                   Sema &S) {
+  // OpenCL v2.0 s6.6: Access Qualifier can used only for image and pipe type
+  if (!(CurType->isImageType() || CurType->isPipeType())) {
----------------
OpenCL v2.0 s6.6: -> OpenCL v2.0 s6.6 -

Qualifier -> qualifier

================
Comment at: test/Parser/opencl-image-access.cl:2
@@ -1,2 +1,3 @@
 // RUN: %clang_cc1 %s -fsyntax-only
+// RUN: %clang_cc1 %s -fsyntax-only -cl-std=CL2.0 -DCL20
 
----------------
ping


http://reviews.llvm.org/D16040





More information about the cfe-commits mailing list