[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
Wed Jun 29 11:59:38 PDT 2022


ABataev added inline comments.


================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:199
         UsesAllocatorsDecls;
+    struct ImplicitDefaultFDInfoTy {
+      const FieldDecl *FD = nullptr;
----------------
Add comments for the structure and all fields, please.


================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:2401
+        return VD;
+      Expr *ThisExpr = BuildCXXThisExpr(SourceLocation(), getCurrentThisType(),
+                                        /*IsImplicit=*/true);
----------------
Do we need to check if getCurrentThisType() returns nullptr?


================
Comment at: clang/lib/Sema/TreeTransform.h:11102
+    // for Openmp where the field need to be privatizized in the case.
+    if (!(getSema().getLangOpts().OpenMP && isa<CXXThisExpr>(E->getBase()))) {
+      // Mark it referenced in the new context regardless.
----------------
Can we also check if the field should be made private, i.e. avoid this short circuit if it is not in OpenMP region or is not supposed to be perivitized in the the context (no default private/firstprivate in the region)?


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