[flang-commits] [PATCH] D139132: [flang] Don't repeat module procedure interface from ancestor in *.mod file
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Sat Dec 3 13:39:59 PST 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbb7e31bccf4a: [flang] Don't repeat module procedure interface from ancestor in *.mod file (authored by klausler).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139132/new/
https://reviews.llvm.org/D139132
Files:
flang/lib/Semantics/mod-file.cpp
flang/lib/Semantics/resolve-names.cpp
Index: flang/lib/Semantics/resolve-names.cpp
===================================================================
--- flang/lib/Semantics/resolve-names.cpp
+++ flang/lib/Semantics/resolve-names.cpp
@@ -873,7 +873,7 @@
Symbol &PushSubprogramScope(const parser::Name &, Symbol::Flag,
const parser::LanguageBindingSpec * = nullptr);
Symbol *GetSpecificFromGeneric(const parser::Name &);
- SubprogramDetails &PostSubprogramStmt(const parser::Name &);
+ SubprogramDetails &PostSubprogramStmt();
void CreateEntry(const parser::EntryStmt &stmt, Symbol &subprogram);
void PostEntryStmt(const parser::EntryStmt &stmt);
void HandleLanguageBinding(Symbol *,
@@ -3422,8 +3422,7 @@
Walk(std::get<parser::Name>(stmt.t));
Walk(std::get<std::list<parser::DummyArg>>(stmt.t));
// Don't traverse the LanguageBindingSpec now; it's deferred to EndSubprogram.
- const auto &name{std::get<parser::Name>(stmt.t)};
- auto &details{PostSubprogramStmt(name)};
+ auto &details{PostSubprogramStmt()};
for (const auto &dummyArg : std::get<std::list<parser::DummyArg>>(stmt.t)) {
if (const auto *dummyName{std::get_if<parser::Name>(&dummyArg.u)}) {
Symbol &dummy{MakeSymbol(*dummyName, EntityDetails{true})};
@@ -3444,7 +3443,7 @@
void SubprogramVisitor::Post(const parser::FunctionStmt &stmt) {
const auto &name{std::get<parser::Name>(stmt.t)};
- auto &details{PostSubprogramStmt(name)};
+ auto &details{PostSubprogramStmt()};
for (const auto &dummyName : std::get<std::list<parser::Name>>(stmt.t)) {
Symbol &dummy{MakeSymbol(dummyName, EntityDetails{true})};
details.add_dummyArg(dummy);
@@ -3509,8 +3508,7 @@
info.resultName = nullptr;
}
-SubprogramDetails &SubprogramVisitor::PostSubprogramStmt(
- const parser::Name &name) {
+SubprogramDetails &SubprogramVisitor::PostSubprogramStmt() {
Symbol &symbol{*currScope().symbol()};
SetExplicitAttrs(symbol, EndAttrs());
if (symbol.attrs().test(Attr::MODULE)) {
@@ -3775,7 +3773,7 @@
if (moduleInterface && &moduleInterface->owner() == &currScope()) {
// Subprogram is MODULE FUNCTION or MODULE SUBROUTINE with an interface
// previously defined in the same scope.
- currScope().erase(moduleInterface->name());
+ EraseSymbol(name);
}
}
Symbol &newSymbol{PushSubprogramScope(name, subpFlag, bindingSpec)};
Index: flang/lib/Semantics/mod-file.cpp
===================================================================
--- flang/lib/Semantics/mod-file.cpp
+++ flang/lib/Semantics/mod-file.cpp
@@ -422,7 +422,12 @@
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{};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139132.479868.patch
Type: text/x-patch
Size: 3030 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20221203/77d80170/attachment.bin>
More information about the flang-commits
mailing list