diff options
author | Peter Klausler <pklausler@nvidia.com> | 2022-12-01 11:41:40 -0800 |
---|---|---|
committer | Peter Klausler <pklausler@nvidia.com> | 2022-12-03 13:39:33 -0800 |
commit | bb7e31bccf4a26fc29809370fbbf5079f79584b3 (patch) | |
tree | ad6d1b36407fdf91ca2fa59e99803d10d38ba530 /flang/lib/Semantics/mod-file.cpp | |
parent | cea616f847b7328825181e5e0acac0cacd9e5280 (diff) | |
download | llvm-bb7e31bccf4a26fc29809370fbbf5079f79584b3.zip llvm-bb7e31bccf4a26fc29809370fbbf5079f79584b3.tar.gz llvm-bb7e31bccf4a26fc29809370fbbf5079f79584b3.tar.bz2 |
[flang] Don't repeat module procedure interface from ancestor in *.mod file
When a submodule defines a module procedure whose interface was declared
in an ancestor (sub)module, don't repeat the definition of that interface
in the submodule's *.mod file output.
Differential Revision: https://reviews.llvm.org/D139132
Diffstat (limited to 'flang/lib/Semantics/mod-file.cpp')
-rw-r--r-- | flang/lib/Semantics/mod-file.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/flang/lib/Semantics/mod-file.cpp b/flang/lib/Semantics/mod-file.cpp index 0f6117b..36b2341 100644 --- a/flang/lib/Semantics/mod-file.cpp +++ b/flang/lib/Semantics/mod-file.cpp @@ -422,7 +422,12 @@ static const Attrs subprogramPrefixAttrs{Attr::ELEMENTAL, Attr::IMPURE, void ModFileWriter::PutSubprogram(const Symbol &symbol) { auto &details{symbol.get<SubprogramDetails>()}; if (const Symbol * interface{details.moduleInterface()}) { - PutSubprogram(*interface); + const Scope *module{FindModuleContaining(interface->owner())}; + if (module && module != &symbol.owner()) { + // Interface is in ancestor module + } else { + PutSubprogram(*interface); + } } auto attrs{symbol.attrs()}; Attrs bindAttrs{}; |