[flang-commits] [PATCH] D126436: [flang] Allow forward reference to ENTRY from generic interface
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Wed May 25 17:15:12 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rGddd692e9d572: [flang] Allow forward reference to ENTRY from generic interface (authored by klausler).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126436/new/
https://reviews.llvm.org/D126436
Files:
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
@@ -3411,10 +3411,21 @@
if (outer.IsModule() && !attrs.test(Attr::PRIVATE)) {
attrs.set(Attr::PUBLIC);
}
- Symbol &entrySymbol{MakeSymbol(outer, entryName.source, attrs)};
+ Symbol *entrySymbol{FindInScope(outer, entryName.source)};
+ if (entrySymbol) {
+ if (auto *generic{entrySymbol->detailsIf<GenericDetails>()}) {
+ if (auto *specific{generic->specific()}) {
+ // Forward reference to ENTRY from a generic interface
+ entrySymbol = specific;
+ entrySymbol->attrs() |= attrs;
+ }
+ }
+ } else {
+ entrySymbol = &MakeSymbol(outer, entryName.source, attrs);
+ }
SubprogramDetails entryDetails;
entryDetails.set_entryScope(currScope());
- entrySymbol.set(subpFlag);
+ entrySymbol->set(subpFlag);
if (subpFlag == Symbol::Flag::Function) {
Symbol *result{nullptr};
EntityDetails resultDetails;
@@ -3443,11 +3454,12 @@
if (subpFlag == Symbol::Flag::Subroutine ||
(distinctResultName && !badResultName)) {
Symbol &assoc{MakeSymbol(entryName.source)};
- assoc.set_details(HostAssocDetails{entrySymbol});
+ assoc.set_details(HostAssocDetails{*entrySymbol});
assoc.set(Symbol::Flag::Subroutine);
}
- Resolve(entryName, entrySymbol);
- entrySymbol.set_details(std::move(entryDetails));
+ Resolve(entryName, *entrySymbol);
+ Details details{std::move(entryDetails)};
+ entrySymbol->set_details(std::move(entryDetails));
}
void SubprogramVisitor::PostEntryStmt(const parser::EntryStmt &stmt) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126436.432157.patch
Type: text/x-patch
Size: 1697 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220526/71e84ed8/attachment.bin>
More information about the flang-commits
mailing list