[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
Fri Oct 27 14:00:22 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.");
+  }
----------------
DanielCChen wrote:

Thanks for the comments. This code is replaced by the suggested code at line 602 below.

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


More information about the flang-commits mailing list