[flang] Resolve and check names in equivalence sets
authorTim Keith <tkeith@nvidia.com>
Wed, 12 Jun 2019 01:26:48 +0000 (18:26 -0700)
committerTim Keith <tkeith@nvidia.com>
Wed, 12 Jun 2019 01:26:48 +0000 (18:26 -0700)
commit9ef62dbb6a6a54e8603fa9e1b1bdd17e831cd932
treedcae84ce642a39f781e148dabaa1f0db678e05be
parentb387e7139d4f7569e017dd283c20d3d2cb6876bf
[flang] Resolve and check names in equivalence sets

Collect sets of `parser::EquivalenceObject` to process at the end of
the specification part. This is so that names mentioned in the
EQUIVALENCE statement don't trigger implicit declarations.

The `EquivalenceSets` class performs most of the numerous checks
on objects that can be in equivalence sets at all and objects that
can be in them together. It also merges sets when the same object
appears in more than one.

Once equivalence sets are checked they are added to the `Scope`.
Further checks will be necessary after the size and alignment of
variables are computed.

Add `FindUltimateComponent` to simplify checks on ultimate components
of derived types. Use it to implement `HasCoarrayUltimateComponent`
and checks on equivalence objects.

Make `ExpressionAnalyzer::Analyze(Designator)` public so that
`parser::EquivalenceObject` can be analyzed.

Add `GetDefaultKind`, `doublePrecisionKind`, and `quadPrecisionKind`
to `SemanticsContext` so that `defaultKinds_` does not need to be
accessed directly.

Original-commit: flang-compiler/f18@1cc898e5b8d5dbda19748d8bc2ee8cba5c7df4ec
Reviewed-on: https://github.com/flang-compiler/f18/pull/494
Tree-same-pre-rewrite: false
17 files changed:
flang/lib/semantics/assignment.cc
flang/lib/semantics/check-io.cc
flang/lib/semantics/expression.cc
flang/lib/semantics/expression.h
flang/lib/semantics/resolve-names-utils.cc
flang/lib/semantics/resolve-names-utils.h
flang/lib/semantics/resolve-names.cc
flang/lib/semantics/scope.cc
flang/lib/semantics/scope.h
flang/lib/semantics/semantics.cc
flang/lib/semantics/semantics.h
flang/lib/semantics/tools.cc
flang/lib/semantics/tools.h
flang/lib/semantics/type.h
flang/test/semantics/CMakeLists.txt
flang/test/semantics/equivalence01.f90 [new file with mode: 0644]
flang/test/semantics/symbol12.f90 [new file with mode: 0644]