[flang] Continue work on name resolution
authorTim Keith <tkeith@nvidia.com>
Fri, 30 Mar 2018 20:57:23 +0000 (13:57 -0700)
committerGitHub <noreply@github.com>
Mon, 2 Apr 2018 17:49:22 +0000 (10:49 -0700)
commit86726d8ee4574ad20de55bfec968187cc4defa8c
tree561513e02d10fa1c838f9b482db28dce99342e65
parent4ad322aa9d32a9bf4c8f9ab819fd7e1c75414c98
[flang] Continue work on name resolution

Enhance DeclTypeSpecVisitor to find derived-type-specs, including with
type parameter values.

Change DerivedTypeSpec so it only needs the name of the derived type,
not the definition, as that isn't necessarily known when we encounter
it.

Fix how memory is managed in DeclTypeSpec: Intrinsic type specs aren't a
problem -- they are one of a few types that live throughout the program.
Derived type specs are dynamically allocated and the memory is owned by
the DeclTypeSpec -- it allocates it when a DeclTypeSpec for a derived
type is created and deletes it when it is destroyed. Pass around
references to TypeSpecs rather than pointers as they can never be null.

In AttrsVisitor, DeclTypeSpecVisitor, ResolveNamesVisitor: make most
functions out-of-line to clean up the class declaration.

In AttrsVisitor, use preprocessor to simplify the simple case of
encountering a parse-tree class causing an attribute to be set.
Handle all such attributes.

Remove old testing code from type.cc.

Remove some of the declarations for IntExpr and IntConst -- they are
only placeholder classes anyway. Don't distinguish kind and length
parameter values.

Original-commit: flang-compiler/f18@e172b5121274a3cfc597f062da1ea32aa56039d9
Reviewed-on: https://github.com/flang-compiler/f18/pull/36
Tree-same-pre-rewrite: false
flang/lib/semantics/make-types.cc
flang/lib/semantics/resolve-names.cc
flang/lib/semantics/symbol.h
flang/lib/semantics/type.cc
flang/lib/semantics/type.h