================ @@ -20796,6 +20796,150 @@ struct MappableVarListInfo { }; } // namespace +static std::pair<DeclRefExpr *, VarDecl *> +buildImplicitMap(Sema &S, QualType BaseType, DSAStackTy *Stack, + SmallVectorImpl<OMPClause *> &Maps) { + + const RecordDecl *RD = BaseType->getAsRecordDecl(); + // AST context is RD's ParentASTContext(). + ASTContext &Ctx = RD->getParentASTContext(); + // DeclContext is RD's DeclContext. + DeclContext *DCT = const_cast<DeclContext *>(RD->getDeclContext()); + SourceRange Range = RD->getSourceRange(); + DeclarationNameInfo ImplicitName; + // Dummy variable _s for Mapper. + ImplicitName.setName( + Ctx.DeclarationNames.getIdentifier(&Ctx.Idents.get("_s"))); + DeclarationName VN = ImplicitName.getName(); + TypeSourceInfo *TInfo = + Ctx.getTrivialTypeSourceInfo(BaseType, Range.getEnd()); + VarDecl *VD = + VarDecl::Create(Ctx, DCT, Range.getEnd(), Range.getEnd(), + VN.getAsIdentifierInfo(), BaseType, TInfo, SC_None); + DeclRefExpr *MapperVarRef = + buildDeclRefExpr(S, VD, BaseType, SourceLocation()); + + // Create implicit map clause for mapper. + SmallVector<Expr *, 4> SExprs; + for (auto *FD : RD->fields()) { + Expr *BE = S.BuildMemberExpr( + MapperVarRef, /*IsArrow=*/false, Range.getBegin(), + NestedNameSpecifierLoc(), Range.getBegin(), FD, + DeclAccessPair::make(FD, FD->getAccess()), + /*HadMultipleCandidates=*/false, + DeclarationNameInfo(FD->getDeclName(), FD->getSourceRange().getBegin()), + FD->getType(), VK_LValue, OK_Ordinary); + SExprs.push_back(BE); + } + CXXScopeSpec MapperIdScopeSpec; + DeclarationNameInfo MapperId; + OpenMPDirectiveKind DKind = Stack->getCurrentDirective(); + + OMPClause *MapClasue = S.OpenMP().ActOnOpenMPMapClause( ---------------- alexey-bataev wrote:
```suggestion OMPClause *MapClause = S.OpenMP().ActOnOpenMPMapClause( ``` https://github.com/llvm/llvm-project/pull/101101 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits