diff options
author | Peter Klausler <pklausler@nvidia.com> | 2022-12-02 07:19:49 -0800 |
---|---|---|
committer | Peter Klausler <pklausler@nvidia.com> | 2022-12-05 07:33:57 -0800 |
commit | 9e855a6cb84a7c1f9f027474e9b881206df925e3 (patch) | |
tree | 18e67f74a989608875b8726882ac76454032e0d6 /flang/lib/Semantics/mod-file.cpp | |
parent | 6e08ac8dce919c7497876d36a04a05ffc52d0e93 (diff) | |
download | llvm-9e855a6cb84a7c1f9f027474e9b881206df925e3.zip llvm-9e855a6cb84a7c1f9f027474e9b881206df925e3.tar.gz llvm-9e855a6cb84a7c1f9f027474e9b881206df925e3.tar.bz2 |
[flang] Map symbols in expressions when copying interface symbols
Given a MODULE SUBROUTINE or MODULE FUNCTION interface followed
later by a corresponding separate module subprogram definition in a
MODULE PROCEDURE, the copies of the interface's dummy argument and
function result symbols that populate the initial scope of that
MODULE PROCEDURE need to have any symbol references in their types
or bounds adjusted to point to their new counterparts.
Differential Revision: https://reviews.llvm.org/D139200
Diffstat (limited to 'flang/lib/Semantics/mod-file.cpp')
-rw-r--r-- | flang/lib/Semantics/mod-file.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/flang/lib/Semantics/mod-file.cpp b/flang/lib/Semantics/mod-file.cpp index 9a5a34f..e635669 100644 --- a/flang/lib/Semantics/mod-file.cpp +++ b/flang/lib/Semantics/mod-file.cpp @@ -1256,11 +1256,14 @@ bool SubprogramSymbolCollector::NeedImport( const SourceName &name, const Symbol &symbol) { if (!isInterface_) { return false; + } else if (IsSeparateModuleProcedureInterface(&symbol_)) { + return false; // IMPORT needed only for external and dummy procedure + // interfaces } else if (&symbol == scope_.symbol()) { return false; } else if (symbol.owner().Contains(scope_)) { return true; - } else if (const Symbol * found{scope_.FindSymbol(name)}) { + } else if (const Symbol *found{scope_.FindSymbol(name)}) { // detect import from ancestor of use-associated symbol return found->has<UseDetails>() && found->owner() != scope_; } else { |