[flang] Add support for common blocks
authorTim Keith <tkeith@nvidia.com>
Thu, 14 Feb 2019 15:59:20 +0000 (07:59 -0800)
committerTim Keith <tkeith@nvidia.com>
Thu, 14 Feb 2019 15:59:20 +0000 (07:59 -0800)
commit543b15bca424f5a16076800bfcfe12f7ae0517ad
tree329613174ca21e929af1a0134b423e6c89e83b8f
parent288bd165275a9cf3fa152cc8bfe26537241f0f60
[flang] Add support for common blocks

A symbol for a common block has `CommonBlockDetails` which contains
a list of the symbols that are in the common block.

The name of the symbol for the blank common block is the empty string.
That preserves the property that every symbol name is a substring of
the cooked source. We use the 0-length substring starting at the COMMON
statement so that when symbols are sorted by the location of the start
of the name it ends up in the right place.

Some of the checks on members of common blocks don't happen until the
end of the scope. They can't happen earlier because we don't necessarily
know the type and attributes.

Enhance `test_errors.sh` so that multiple errors can be expected for
a single line.

Original-commit: flang-compiler/f18@2c4ca6b5d3e5798ef7815a52739a3e642bebd1c9
Reviewed-on: https://github.com/flang-compiler/f18/pull/286
flang/lib/semantics/mod-file.cc
flang/lib/semantics/resolve-names.cc
flang/lib/semantics/symbol.cc
flang/lib/semantics/symbol.h
flang/lib/semantics/type.cc
flang/lib/semantics/type.h
flang/test/semantics/CMakeLists.txt
flang/test/semantics/modfile21.f90 [new file with mode: 0644]
flang/test/semantics/resolve42.f90 [new file with mode: 0644]
flang/test/semantics/test_errors.sh