[PATCH] D127803: Generate the capture for field when the field is used in openmp region with implicit default in the member function.

Alexey Bataev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 23 04:08:41 PDT 2022


ABataev added inline comments.


================
Comment at: clang/lib/Sema/SemaExprMember.cpp:1873-1877
+    if (auto *PrivateCopy =
+            isOpenMPFDCaptureDecl(Field, Base.get(), IsArrow, OpLoc, &SS,
+                                  /*TemplateKWLoc=*/SourceLocation(), Field,
+                                  FoundDecl, /*HadMultipleCandidates=*/false,
+                                  MemberNameInfo, MemberType, VK, OK))
----------------
jyu2 wrote:
> ABataev wrote:
> > Why do we need this function? Implicit private rule should apply (if should) only to this-Юашдув kind of expressions, if something like parent.field expression is used, parent should be private, not private.field. Or I'm missing something?
> You are right for "parent.a" only privatize "parent".
> 
> But if 'a' is a field access in a member function then 'a' is privatized, not "this".  It is same with firstprivate(a).  But for the explicit firstprivate(a), the capture is build in ActOnOpenMPFirstprivateClause, so it can be mapped to reference in the omp region.  For Implicit, I need to build capture for the first reference in the omp region with defalut(first|private) is used.  And used that to generate firstprivate clause at end when the call to ActOnOpenMPFirstprivateClause when generating implicit clause.
> 
> Is this reasonable?
But you don't need all this info to build the capture. I think you can reuse existing isOpenMPCapturedDecl function without adding this extra isOpenMPFDCaptureDecl. Most probably, you don't need Base and all other stuff to build this->fd member expression.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127803/new/

https://reviews.llvm.org/D127803



More information about the cfe-commits mailing list