[flang-commits] [flang] [flang] Make adapt.valuebyref attribute work again (PR #73658)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Tue Nov 28 07:48:06 PST 2023


================
@@ -259,8 +260,11 @@ hlfir::AssociateOp hlfir::genAssociateExpr(mlir::Location loc,
   }
   llvm::SmallVector<mlir::Value> lenParams;
   genLengthParameters(loc, builder, value, lenParams);
-  return builder.create<hlfir::AssociateOp>(loc, source, name, shape, lenParams,
-                                            fir::FortranVariableFlagsAttr{});
+  auto res = builder.create<hlfir::AssociateOp>(
+      loc, source, name, shape, lenParams, fir::FortranVariableFlagsAttr{});
+  if (attr)
+    res->setAttrs({*attr});
----------------
tblah wrote:

I think it would be cleaner to add an op builder for AssociateOp which takes a NamedAttribute parameter (in the same way as this is done for fir::AllocaOp).

https://github.com/llvm/llvm-project/pull/73658


More information about the flang-commits mailing list