[flang] Fix resolution of function prefix type
authorTim Keith <tkeith@nvidia.com>
Sun, 24 Feb 2019 18:05:43 +0000 (10:05 -0800)
committerGitHub <noreply@github.com>
Thu, 28 Feb 2019 18:38:17 +0000 (10:38 -0800)
commit9a497ddbadd6480eb4bdb0ce8e94b49c03bb0443
tree000c2c7b57be8f9583263ed2b07ba675836251c1
parent1ec4ec88bf8265fe15b93e9a074c70221f87c6a3
[flang] Fix resolution of function prefix type

When a function-stmt has a type in the prefix (`type(t) function f()`),
the type cannot be resolve until after processing the USE and IMPLICIT
statements. So save the parse-tree of the type and process it at the
end of the specification section.

Add `ProcessTypeSpec()` to handle the process of setting up to walk
a type spec, walking it, restoring the state, and returning the type
spec. We do this several other places too.

Original-commit: flang-compiler/f18@bcde294d0e62c6ef8506392f66816814ae976dff
Reviewed-on: https://github.com/flang-compiler/f18/pull/305
Tree-same-pre-rewrite: false
flang/lib/semantics/resolve-names.cc
flang/test/semantics/modfile04.f90