[llvm-branch-commits] [flang] 166e5c3 - [flang] Do not create HostAssoc symbols in derived type scopes

peter klausler via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jan 13 11:07:24 PST 2021


Author: peter klausler
Date: 2021-01-13T11:01:27-08:00
New Revision: 166e5c335cbe9f8144a7822ca655dc3352ec9e56

URL: https://github.com/llvm/llvm-project/commit/166e5c335cbe9f8144a7822ca655dc3352ec9e56
DIFF: https://github.com/llvm/llvm-project/commit/166e5c335cbe9f8144a7822ca655dc3352ec9e56.diff

LOG: [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

Added: 
    

Modified: 
    flang/lib/Semantics/resolve-names.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp
index cee49175d7f4..d66f561fc3c5 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();


        


More information about the llvm-branch-commits mailing list