================
@@ -3173,9 +3173,18 @@ bool SemaHLSL::TransformInitList(const InitializedEntity
&Entity,
BuildFlattenedTypeList(InitTy, DestTypes);
llvm::SmallVector<Expr *, 16> ArgExprs;
- for (Expr *Arg : Init->inits())
- if (!BuildInitializerList(SemaRef, Ctx, Arg, ArgExprs, DestTypes))
+ for (unsigned I = 0; I < Init->getNumInits(); ++I) {
+ Expr *E = Init->getInit(I);
+ if (E->HasSideEffects(Ctx)) {
+ QualType Ty = E->getType();
+ if (auto *RTy = Ty->getAs<RecordType>())
+ E = new (Ctx) MaterializeTemporaryExpr(Ty, E, E->isLValue());
----------------
llvm-beanz wrote:
All AST node memory is owned by the ASTContext (hence the placement new-style
syntax).
`E` is always owned by the ASTContext, I'm just shifting where in the AST it
appears from being the top-level expression in the argument list to being a
child of the MaterializeTemporary or OpaqueValue expression, which (at the end
of the function) all gets rewritten over the original InitListExpr's Init
expressions.
https://github.com/llvm/llvm-project/pull/123141
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits