aboutsummaryrefslogtreecommitdiff
path: root/flang
diff options
context:
space:
mode:
authorpeter klausler <pklausler@nvidia.com>2021-01-12 17:02:28 -0800
committerpeter klausler <pklausler@nvidia.com>2021-01-13 11:01:27 -0800
commit166e5c335cbe9f8144a7822ca655dc3352ec9e56 (patch)
treed6036ea817540e348b066116e4eb917b059b234c /flang
parent123674a816742254debdfcc978026b8107b502d8 (diff)
downloadllvm-166e5c335cbe9f8144a7822ca655dc3352ec9e56.zip
llvm-166e5c335cbe9f8144a7822ca655dc3352ec9e56.tar.gz
llvm-166e5c335cbe9f8144a7822ca655dc3352ec9e56.tar.bz2
[flang] Do not create HostAssoc symbols in derived type scopes
When needed due to a specification expression in a derived type, the host association symbols should be created in the surrounding subprogram's scope instead. Differential Revision: https://reviews.llvm.org/D94567
Diffstat (limited to 'flang')
-rw-r--r--flang/lib/Semantics/resolve-names.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp
index cee4917..d66f561 100644
--- a/flang/lib/Semantics/resolve-names.cpp
+++ b/flang/lib/Semantics/resolve-names.cpp
@@ -2050,7 +2050,9 @@ Symbol &ScopeHandler::MakeSymbol(const parser::Name &name, Attrs attrs) {
}
Symbol &ScopeHandler::MakeHostAssocSymbol(
const parser::Name &name, const Symbol &hostSymbol) {
- Symbol &symbol{MakeSymbol(name, HostAssocDetails{hostSymbol})};
+ Symbol &symbol{*NonDerivedTypeScope()
+ .try_emplace(name.source, HostAssocDetails{hostSymbol})
+ .first->second};
name.symbol = &symbol;
symbol.attrs() = hostSymbol.attrs(); // TODO: except PRIVATE, PUBLIC?
symbol.flags() = hostSymbol.flags();