[flang-commits] [flang] [flang][cuda] Propagate CUDA attrs from parent variable to component allocations (PR #206614)
Valentin Clement バレンタイン クレメン via flang-commits
flang-commits at lists.llvm.org
Mon Jun 29 16:50:16 PDT 2026
================
@@ -459,17 +459,41 @@ class AllocateStmtHelper {
fir::StoreOp::create(builder, loc, falseConv, pinned);
}
+ /// When the allocate object is a structure component
+ /// (e.g., managed_var(1)%component), check whether the base variable has
+ /// CUDA attributes. If so, update \p sym to the base symbol and return true
+ /// so allocations use the parent's memory space.
+ bool propagateCUDAAttrsFromParent(const Allocation &alloc,
+ const Fortran::semantics::Symbol *&sym) {
+ if (const auto *sc = std::get_if<Fortran::parser::StructureComponent>(
+ &alloc.getAllocObj().u)) {
+ const Fortran::parser::Name &baseName =
+ Fortran::parser::GetFirstName(*sc);
----------------
clementval wrote:
Will that work if there is several component like `a%b%c`. Should you check `a` or `b`?
https://github.com/llvm/llvm-project/pull/206614
More information about the flang-commits
mailing list