[flang] Fix bug determining function vs. subroutine
authorTim Keith <tkeith@nvidia.com>
Thu, 21 Feb 2019 23:01:39 +0000 (15:01 -0800)
committerGitHub <noreply@github.com>
Thu, 28 Feb 2019 18:38:17 +0000 (10:38 -0800)
commit41e5053ee6efcb3a7a6ddb3d8858084c94a0aa1b
treed3925c1bda5d2f97ca8b2424656aaaba6b78ed18
parentb1cfd23d6b4bcf2897b1e67bd39b3876d433aeea
[flang] Fix bug determining function vs. subroutine

We were setting `expectedProcFlag_` to indicate if a `ProcedureDesignator`
was used in a function or subroutine context. That didn't work if they
were nested, for example: `call f(g())`.

Instead, at the point we know function vs. subroutine (i.e. in the
`CallStmt` and `FunctionReference` nodes), explicitly walk the children,
passing in the flag.

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