[flang] Correctly resolve generics with forward references
authorTim Keith <tkeith@nvidia.com>
Fri, 20 Jul 2018 17:46:11 +0000 (10:46 -0700)
committerTim Keith <tkeith@nvidia.com>
Fri, 20 Jul 2018 17:46:11 +0000 (10:46 -0700)
commitdded0e4bb25f3ea2c40a63e9af34ecfa4efdc57d
treefdb3600275e2205e1fe9e7403daec68279fdbf94
parent759a405a431437fe8f9c5ba7c3585d920106e18d
[flang] Correctly resolve generics with forward references

When a procedure is included by name in a generic (either with a
procedure statement in a generic interface or with a generic statement)
we can't immediately resolve it to a subprogram symbol. That is because
the subprogram may be defined later in the specification part. Instead,
collect the names (and whether they should be module procedures) and
resolve them to symbols at the end of the specification part. Also
detect duplicate names then.

This is needed for module file reading as these forward references can
occur there.

Write generics to module file using generic statements. This allows us to
include the access-spec.

Original-commit: flang-compiler/f18@d11d002084af4a25d0c9a63dbe6460530b56adc7
Reviewed-on: https://github.com/flang-compiler/f18/pull/132
flang/lib/semantics/mod-file.cc
flang/lib/semantics/resolve-names.cc
flang/lib/semantics/symbol.h
flang/test/semantics/CMakeLists.txt
flang/test/semantics/modfile07.f90
flang/test/semantics/resolve15.f90
flang/test/semantics/resolve25.f90 [new file with mode: 0644]