[flang] Fix implicit declarations in statement functions
authorTim Keith <tkeith@nvidia.com>
Sun, 26 Jul 2020 19:13:36 +0000 (12:13 -0700)
committerTim Keith <tkeith@nvidia.com>
Sun, 26 Jul 2020 19:13:39 +0000 (12:13 -0700)
commit7454acdf3b7d064ebbf6b8027296f42f504b285a
treeee1353302ebb7666a06a6b8fdbf69dce9c4cc96c
parent3bbf3e026d3c692966583075ae6d12c4575e9d72
[flang] Fix implicit declarations in statement functions

If a symbol (that is not a dummy argument) is implicitly declared inside
a statement function, don't create it in the statement function's scope.
Instead, treat statement functions like blocks when finding the inclusive
scope and create the symbol there.

Add a new flag, StmtFunction, to symbols that represent statement functions.

Differential Revision: https://reviews.llvm.org/D84588
flang/include/flang/Semantics/scope.h
flang/include/flang/Semantics/symbol.h
flang/lib/Semantics/resolve-names.cpp
flang/lib/Semantics/scope.cpp
flang/test/Semantics/symbol16.f90