llvm/flang/lib
Tim Keith 14094c71c8 [flang] Process specification parts before execution parts
Change the order in which names are resolved. Before resolving names
in the execution part of a subprogram we need to know the interface
of contained subprograms. This is because the type of some construct
entities can depend on the return type of contained functions, e.g.
```
  associate(x => f())
  end associate
contains
  function f()...
```

To do this, we now build a tree rooted at each program unit with
child nodes corresponding to subprograms contained in the parent.
This provides flexibility in choosing an order to resolve names.
The current implementation processes all specification parts before
any execution parts. This ensures contained subprogram interfaces
are know before analyzing constructs like ASSOCIATE.

Resolving a specification part involves first adding
`SubprogramNameDetails` symbols for each contained subprogram, then
processing the statement that introduces the program unit (`ModuleStmt`,
`SubroutineStmt`, etc.), then visiting all of the statements in the
specification part.

If it proves necessary, we can add a phase to do implicit declarations
in the execution part before processing the specification part of
contained subprograms.

Original-commit: flang-compiler/f18@20e803fd92
Reviewed-on: https://github.com/flang-compiler/f18/pull/443
Tree-same-pre-rewrite: false
2019-05-06 07:26:43 -07:00
..
common [flang] Add DIE macro 2019-05-03 08:02:31 -07:00
evaluate [flang] Remove OwningPointer and ForwardReference 2019-05-06 07:51:07 -07:00
FIR [flang] Add DIE macro 2019-05-03 08:02:31 -07:00
parser [flang] Prevent unhandled special formatting 2019-05-03 16:53:45 -07:00
semantics [flang] Process specification parts before execution parts 2019-05-06 07:26:43 -07:00
CMakeLists.txt [flang] revert last pushes 2019-04-24 11:41:40 -07:00