[flang-commits] [flang] [Flang]: Lowering reference to functions that return a procedure pointer (PR #78194)

Daniel Chen via flang-commits flang-commits at lists.llvm.org
Mon Jan 29 09:23:31 PST 2024


================
@@ -1425,9 +1425,14 @@ class HlfirBuilder {
   }
 
   hlfir::EntityWithAttributes gen(const Fortran::evaluate::ProcedureRef &expr) {
-    TODO(
-        getLoc(),
-        "lowering function references that return procedure pointers to HLFIR");
+    fir::FirOpBuilder &builder = getBuilder();
+    Fortran::evaluate::ProcedureDesignator proc{expr.proc()};
+    auto procTy{Fortran::lower::translateSignature(proc, getConverter())};
+    mlir::Type resType = fir::BoxProcType::get(builder.getContext(), procTy);
----------------
DanielCChen wrote:

Actually, after further investigation, you are right. `procTy.getResult(0)` indeed gives the correct return type of the function that returns the procedure pointer.

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


More information about the flang-commits mailing list