[flang] Rework how DeclTypeSpecs are stored
authorTim Keith <tkeith@nvidia.com>
Tue, 11 Dec 2018 22:51:08 +0000 (14:51 -0800)
committerTim Keith <tkeith@nvidia.com>
Fri, 14 Dec 2018 15:17:12 +0000 (07:17 -0800)
commit396b3fde60d07b61144978b5ddca512f0d8e72c5
tree9b37557d25205797630c56ed9f919caa9e9c7676
parent4cf72e2f25640fd5b0d6cfe7ac88ba820f013961
[flang] Rework how DeclTypeSpecs are stored

Now DeclTypeSpecs are stored in the scope so that they remain available
as long as the scope exists. DeclTypeSpecs for intrinsic types are
stored in the global scope; those for derived types are in the current
scope. They can contains type parameter values so they can't be reused.

Add `Semantics::MakeIntrinsicTypeSpec` to simplify creating
DeclTypeSpecs for intrinsic types.

Replace `std::optional<DeclTypeSpec>` with `DeclTypeSpec *` as they do
not need to be copied around.

Also fix a small bug with writing `class(t(...))` to the module file --
the type parameters were missing.

Original-commit: flang-compiler/f18@e4744418fc1cdc9728bba4b9ecde51cb5bdd2efa
Reviewed-on: https://github.com/flang-compiler/f18/pull/247
Tree-same-pre-rewrite: false
flang/lib/semantics/resolve-names.cc
flang/lib/semantics/scope.cc
flang/lib/semantics/scope.h
flang/lib/semantics/semantics.h
flang/lib/semantics/symbol.cc
flang/lib/semantics/symbol.h
flang/lib/semantics/type.cc
flang/lib/semantics/type.h
flang/test/semantics/modfile12.f90