[PATCH] D21904: [OpenMP] Initial implementation of parse+sema for clause use_device_ptr of 'target data'

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 30 19:56:03 PDT 2016


ABataev added inline comments.

================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:8318
@@ -8317,1 +8317,3 @@
+def  err_omp_usedeviceptr_not_a_pointer : Error<
+  "item used in 'use_device_pointer' clause is not a pointer">;
 } // end of OpenMP category
----------------
It's better to rephrase this message: "expected a variable of pointer type" or something like this. Also, it would be good to have a corresponding note, describing the provided item.

================
Comment at: lib/Sema/SemaOpenMP.cpp:11377
@@ +11376,3 @@
+    // item should be a pointer or array
+    if (!Type.getNonReferenceType()->isPointerType()) {
+      Diag(ELoc, diag::err_omp_usedeviceptr_not_a_pointer)
----------------
You should not skip the reference from the type, references are not allowed also

================
Comment at: lib/Sema/SemaOpenMP.cpp:11382-11394
@@ +11381,15 @@
+    }
+    Type = Type.getUnqualifiedType();
+    auto VDPrivate = buildVarDecl(*this, ELoc, Type, D->getName(),
+                                  D->hasAttrs() ? &D->getAttrs() : nullptr);
+    if (VDPrivate->isInvalidDecl())
+      continue;
+    auto VDPrivateRefExpr = buildDeclRefExpr(
+        *this, VDPrivate, RefExpr->getType().getUnqualifiedType(), ELoc);
+
+    DeclRefExpr *Ref = nullptr;
+    if (!VD)
+      Ref = buildCapture(*this, D, SimpleRefExpr, /*WithInit=*/false);
+    Vars.push_back(VD ? RefExpr->IgnoreParens() : Ref);
+    PrivateCopies.push_back(VDPrivateRefExpr);
+  }
----------------
I don't think that this patch requires some private copies right now. They will be required only during codegen. I think the private copies must be excluded from parsing/sema patch


Repository:
  rL LLVM

http://reviews.llvm.org/D21904





More information about the cfe-commits mailing list