[flang-commits] [flang] [Flang] Add partial support for lowering procedure pointer assignment. (PR #70461)
via flang-commits
flang-commits at lists.llvm.org
Fri Oct 27 09:00:38 PDT 2023
================
@@ -560,6 +578,35 @@ struct TypeBuilderImpl {
derivedTypeInConstruction.pop_back();
}
+ mlir::Type genProcType(const Fortran::semantics::Symbol *proc,
+ mlir::Location loc) {
+ if (auto procDetails{proc->detailsIf<SubprogramDetails>()})
+ return genFunctionType(*procDetails);
+
+ // Use association. Need to get to the ultimate definition.
+ if (auto procDetails{proc->detailsIf<UseDetails>()}) {
+ auto sym{procDetails->symbol()};
+ for (; sym.detailsIf<UseDetails>();)
+ sym = sym.detailsIf<UseDetails>()->symbol();
+ if (auto pd{sym.detailsIf<SubprogramDetails>()})
+ return genFunctionType(*pd);
+ }
+ fir::emitFatalError(loc, "Procedure pointer error.");
+ }
----------------
jeanPerier wrote:
You should be able to use `if (auto procDetails{proc->GetUltimate().detailsIf<SubprogramDetails>()})` and remove the manual handling of UseDetails. Then I think you can just get rids of genProcType and inline that above.
https://github.com/llvm/llvm-project/pull/70461
More information about the flang-commits
mailing list