[flang] Add top-level Semantics class
authorTim Keith <tkeith@nvidia.com>
Fri, 14 Sep 2018 22:04:50 +0000 (15:04 -0700)
committerTim Keith <tkeith@nvidia.com>
Fri, 14 Sep 2018 22:04:50 +0000 (15:04 -0700)
commit7edb7ec69bc9d23ea31e5629a10892f65f543bc9
treef5c482b55ee8240a1bd5ce65ddf042bddeb71aed
parentcd839623ecb4649beb67ebe1d098a2ffd8978a4d
[flang] Add top-level Semantics class

Refactor to create the Semantics class that is responsible for holding
state during semantics (the scope tree and messages) and managing the
logic of the various phases of semantic processing. Eliminate static
Scope::globalScope.

The messages generated during semantic processing are accumulated in a
Messages data member of Semantics so that individual phases don't need
to emit them to std::cerr. This is now done by the driver so that it has
control over where they go and eliminates other includes of iostream.
To do this, the messages object is passed in to the various semantics
operations.

Move DumpSymbols into semantics.cc: it doesn't belong in resolve-names.cc
and it depends on the global scope, so it's as good a place as any.
The call to RewriteParseTree is also moved to Semantics.

Original-commit: flang-compiler/f18@771d0e1293c460fe28946f20464587f9a993586d
Reviewed-on: https://github.com/flang-compiler/f18/pull/186
Tree-same-pre-rewrite: false
16 files changed:
flang/lib/semantics/CMakeLists.txt
flang/lib/semantics/attr.cc
flang/lib/semantics/attr.h
flang/lib/semantics/mod-file.cc
flang/lib/semantics/mod-file.h
flang/lib/semantics/resolve-labels.cc
flang/lib/semantics/resolve-labels.h
flang/lib/semantics/resolve-names.cc
flang/lib/semantics/resolve-names.h
flang/lib/semantics/rewrite-parse-tree.cc
flang/lib/semantics/rewrite-parse-tree.h
flang/lib/semantics/scope.cc
flang/lib/semantics/scope.h
flang/lib/semantics/semantics.cc [new file with mode: 0644]
flang/lib/semantics/semantics.h [new file with mode: 0644]
flang/tools/f18/f18.cc