[flang-commits] [flang] [flang] Rely on global initialization for simpler derived types (PR #114002)

via flang-commits flang-commits at lists.llvm.org
Mon Jan 27 06:22:00 PST 2025


================
@@ -67,7 +67,7 @@ bool hasDefaultInitialization(const Fortran::semantics::Symbol &sym);
 
 /// Call default initialization runtime routine to initialize \p var.
 void defaultInitializeAtRuntime(Fortran::lower::AbstractConverter &converter,
-                                const Fortran::semantics::Symbol &sym,
+                                const Fortran::lower::pft::Variable &var,
----------------
jeanPerier wrote:

You can switch to Symbol here now and have the caller do the `var.getSymbol()`.

`converter.genType()` accepts Symbol too, and `var.isTarget` can be replaced by `symbol.getUltimate().attrs().test(Fortran::semantics::Attr::TARGET)`

Using Symbol for helpers is better when that is sufficient because that enables using them in places where pft::Variable not accessible (in general, one should not create a "pft::Variable" by simply wrapping a Symbol, some analysis/invariants are needed to rule out it is an alias for instance).

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


More information about the flang-commits mailing list