[flang-commits] [PATCH] D127784: [flang] Handle module subprogram with interface in same (sub)module when writing module file

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Thu Jun 16 10:09:02 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rGb67984d35627: [flang] Handle module subprogram with interface in same (sub)module when… (authored by klausler).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127784/new/

https://reviews.llvm.org/D127784

Files:
  flang/lib/Semantics/mod-file.cpp


Index: flang/lib/Semantics/mod-file.cpp
===================================================================
--- flang/lib/Semantics/mod-file.cpp
+++ flang/lib/Semantics/mod-file.cpp
@@ -419,8 +419,11 @@
     Attr::MODULE, Attr::NON_RECURSIVE, Attr::PURE, Attr::RECURSIVE};
 
 void ModFileWriter::PutSubprogram(const Symbol &symbol) {
-  auto attrs{symbol.attrs()};
   auto &details{symbol.get<SubprogramDetails>()};
+  if (const Symbol * interface{details.moduleInterface()}) {
+    PutSubprogram(*interface);
+  }
+  auto attrs{symbol.attrs()};
   Attrs bindAttrs{};
   if (attrs.test(Attr::BIND_C)) {
     // bind(c) is a suffix, not prefix
@@ -1092,6 +1095,9 @@
         const Symbol *dt{generic->derivedType()};
         needed = needed || (spec && useSet_.count(*spec) > 0) ||
             (dt && useSet_.count(*dt) > 0);
+      } else if (const auto *subp{ultimate.detailsIf<SubprogramDetails>()}) {
+        const Symbol *interface { subp->moduleInterface() };
+        needed = needed || (interface && useSet_.count(*interface) > 0);
       }
       if (needed) {
         need_.push_back(symbol);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127784.437586.patch
Type: text/x-patch
Size: 1106 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220616/0e580443/attachment.bin>


More information about the flang-commits mailing list