[flang] Move SAVE attribute checks to declaration checking
authorPeter Klausler <pklausler@nvidia.com>
Wed, 15 Mar 2023 23:50:31 +0000 (16:50 -0700)
committerPeter Klausler <pklausler@nvidia.com>
Mon, 27 Mar 2023 22:53:44 +0000 (15:53 -0700)
commit3f6e0c24e6a7190f309bb44a9e61f8d8fd559d11
tree1876e9e2be2bd8cadf291c6c5130859b4eb3bd01
parent2e0873c75ef8016a10e2052a1ce21e4fa5974cf3
[flang] Move SAVE attribute checks to declaration checking

Constraint checking for explicit SAVE attributes is more
accurate when done along with other declaration checking, rather
than on the fly during name resolution.  This allows us to
catch attempts to attach explicit SAVE attributes to anything
that can't have one (constraints C859, C860).

Also delete `IsSave()`, whose few remaining uses were changed to the
more general `IsSaved()` predicate that seems more correct for
those uses, returning true for both explicit and implied SAVE
attributes.

Differential Revision: https://reviews.llvm.org/D146579
flang/include/flang/Semantics/tools.h
flang/lib/Semantics/check-declarations.cpp
flang/lib/Semantics/check-omp-structure.cpp
flang/lib/Semantics/resolve-names-utils.cpp
flang/lib/Semantics/resolve-names.cpp
flang/test/Lower/host-associated-globals.f90
flang/test/Semantics/resolve45.f90