Skip to content

Commit dc252d3

Browse files
committed
[Flang] Revert the fix of PR #80738 and re-implement it in a different way by adding a GenericDetails in GetTypeImpl.
1 parent 288072a commit dc252d3

File tree

2 files changed

+5
-18
lines changed

2 files changed

+5
-18
lines changed

flang/include/flang/Semantics/symbol.h

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -786,9 +786,6 @@ class Symbol {
786786
inline Symbol &GetUltimate();
787787
inline const Symbol &GetUltimate() const;
788788

789-
// Get the specific procedure from a potential generic symbol.
790-
inline const Symbol *GetUltimateGeneric() const;
791-
792789
inline DeclTypeSpec *GetType();
793790
inline const DeclTypeSpec *GetType() const;
794791
void SetType(const DeclTypeSpec &);
@@ -988,16 +985,6 @@ inline const Symbol &Symbol::GetUltimate() const {
988985
}
989986
}
990987

991-
inline const Symbol *Symbol::GetUltimateGeneric() const {
992-
if (this->has<GenericDetails>())
993-
return this;
994-
if (const auto *details{detailsIf<UseDetails>()})
995-
return details->symbol().GetUltimateGeneric();
996-
if (const auto *details{detailsIf<HostAssocDetails>()})
997-
return details->symbol().GetUltimateGeneric();
998-
return nullptr;
999-
}
1000-
1001988
inline DeclTypeSpec *Symbol::GetType() {
1002989
return const_cast<DeclTypeSpec *>(
1003990
const_cast<const Symbol *>(this)->GetType());
@@ -1027,6 +1014,10 @@ inline const DeclTypeSpec *Symbol::GetTypeImpl(int depth) const {
10271014
[&](const HostAssocDetails &x) {
10281015
return x.symbol().GetTypeImpl(depth);
10291016
},
1017+
[&](const GenericDetails &x) {
1018+
const Symbol *symbol{x.specific()};
1019+
return symbol ? symbol->GetTypeImpl(depth) : nullptr;
1020+
},
10301021
[](const auto &) -> const DeclTypeSpec * { return nullptr; },
10311022
},
10321023
details_);

flang/lib/Semantics/resolve-names.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5644,15 +5644,11 @@ void DeclarationVisitor::Post(const parser::ProcInterface &x) {
56445644
NoteInterfaceName(*name);
56455645
}
56465646
}
5647-
56485647
void DeclarationVisitor::Post(const parser::ProcDecl &x) {
56495648
const auto &name{std::get<parser::Name>(x.t)};
56505649
const Symbol *procInterface{nullptr};
56515650
if (interfaceName_) {
5652-
const Symbol *ultimateGeneric{interfaceName_->symbol->GetUltimateGeneric()};
5653-
procInterface = ultimateGeneric
5654-
? ultimateGeneric->get<GenericDetails>().specific()
5655-
: interfaceName_->symbol;
5651+
procInterface = interfaceName_->symbol;
56565652
}
56575653
auto attrs{HandleSaveName(name.source, GetAttrs())};
56585654
DerivedTypeDetails *dtDetails{nullptr};

0 commit comments

Comments
 (0)