================ @@ -2589,6 +2589,59 @@ SemaOpenACC::ActOnOpenACCAsteriskSizeExpr(SourceLocation AsteriskLoc) { return BuildOpenACCAsteriskSizeExpr(AsteriskLoc); } +/// Loops through a type and generates an appropriate InitListExpr to generate +/// type initialization. +static Expr *GenerateReductionInitRecipeExpr(ASTContext &Context, + SourceRange ExprRange, + QualType Ty) { + Ty = Ty.getCanonicalType(); + llvm::SmallVector<Expr *> Exprs; + + if (const RecordDecl *RD = Ty->getAsRecordDecl()) { + for (auto *F : RD->fields()) { + if (Expr *NewExpr = + GenerateReductionInitRecipeExpr(Context, ExprRange, F->getType())) + Exprs.push_back(NewExpr); + else + return nullptr; + } + } else if (const ConstantArrayType *AT = Context.getAsConstantArrayType(Ty)) { ---------------- erichkeane wrote:
Ah, well... its more than that. The length of the VLA component is going to come in from a different place, via a variable in the recipe, so we have to figure out how to get that, what to loop over, etc. It is more than just emitting the alloca, we have to do a full alloca of the right sizes then do the init. But that is a good thing to know about for when I have to figure that out. https://github.com/llvm/llvm-project/pull/156122 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits