[flang-commits] [flang] [Flang] Add partial support for lowering procedure pointer assignment. (PR #70461)

Daniel Chen via flang-commits flang-commits at lists.llvm.org
Tue Nov 7 08:59:00 PST 2023


================
@@ -248,8 +248,12 @@ struct TypeBuilderImpl {
     // links, the fir type is built based on the ultimate symbol. This relies
     // on the fact volatile and asynchronous are not reflected in fir types.
     const Fortran::semantics::Symbol &ultimate = symbol.GetUltimate();
-    if (Fortran::semantics::IsProcedurePointer(ultimate))
-      TODO(loc, "procedure pointers");
+
+    if (Fortran::semantics::IsProcedurePointer(ultimate)) {
+      Fortran::evaluate::ProcedureDesignator proc(ultimate);
+      return Fortran::lower::translateSignature(proc, converter);
----------------
DanielCChen wrote:

Also to add that it seems we actually need both `BoxProcType` and the `FunctionType` before box it in order to do `EmboxProcOp (FunctionType -> BoxProcType`.
So if the `genType` here returns `BoxProcType`, we need something like
```
if (auto boxTy = symTy.dyn_cast<fir::BoxProcType>())
      symTy = fir::unwrapRefType(boxTy.getEleTy());
```
to get the `FunctionType`. 

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


More information about the flang-commits mailing list