[clang] [HLSL] Implement HLSL intialization list support (PR #123141)
Ashley Coleman via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 14 12:54:14 PST 2025
================
@@ -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());
----------------
V-FEXrt wrote:
Unless there is some magic I'm missing, this is memory leak right? 3182 reassigns `E` without freeing?
Does `OpaqueValueExpr` take ownership of the old `E`?
https://github.com/llvm/llvm-project/pull/123141
More information about the cfe-commits
mailing list