[flang] Support interface blocks.
authorTim Keith <tkeith@nvidia.com>
Mon, 14 May 2018 20:51:13 +0000 (13:51 -0700)
committerTim Keith <tkeith@nvidia.com>
Mon, 14 May 2018 20:53:02 +0000 (13:53 -0700)
commit4c99dc2a94f2d1f81debd4efb6af6a7094fc92fc
treea72981a2c2be544a4b3d509c0b946db592ebc5da
parent19507b91ce164ac130be64665c27da987b28d3b7
[flang] Support interface blocks.

Add subprogram symbols for each interface-body and set isInterface on
them. Create a symbol with GenericDetails for each generic interface
block and add interface specifications to the specific procedures of
the generic. InterfaceVisitor takes care of this.

Before processing the specification part of modules and subprograms,
collect the names of module subprograms and internal subprograms and add
them to the symbol table with SubprogramNameDetails. This allows us to
reference them from interface blocks in the specification part.
SubprogramNameDetails is converted to SubprogramDetails when the real
subprogram is visited.

This is achieved by setting subpNamesOnly_ and then walking the
ModuleSubprogramPart or InternalSubprogramPart. Creating the symbol and
scope for a module or subprogram now happens when the Module,
SubroutineSubprogram, or FunctionSubprogram node is encountered so
this can happen in the right order.

Add BeginSubprogram and EndSubprogram to handle the parts in common
between subprograms and interface specifications.

Add GenericSpec to type.h to represent all possible generic specs.
Only generic names are resolved so far.

Add tests for new error messages. Change resolve02.f90 to reflect the
new errors reported.

Original-commit: flang-compiler/f18@03148b49dd0c58e36aca2660a56fcefadd97b99d
Reviewed-on: https://github.com/flang-compiler/f18/pull/88
Tree-same-pre-rewrite: false
flang/lib/semantics/resolve-names.cc
flang/lib/semantics/scope.cc
flang/lib/semantics/scope.h
flang/lib/semantics/symbol.cc
flang/lib/semantics/symbol.h
flang/lib/semantics/type.cc
flang/lib/semantics/type.h
flang/test/semantics/resolve02.f90
flang/test/semantics/resolve15.f90 [new file with mode: 0644]
flang/test/semantics/resolve16.f90 [new file with mode: 0644]