[flang] Continue work on name resolution.
authorTim Keith <tkeith@nvidia.com>
Wed, 11 Apr 2018 20:11:42 +0000 (13:11 -0700)
committerTim Keith <tkeith@nvidia.com>
Wed, 11 Apr 2018 20:13:14 +0000 (13:13 -0700)
commitaf2940cfb66a48abef594513ed25b5029f4b3992
tree93e417af5f2926283147269a8734007205881b32
parent917da9145cf91129485221b102009248b74559f8
[flang] Continue work on name resolution.

In Symbol and Scope, use SourceName (== parser::CharBlock) in place of
Name (== std::string) so that names in the symtab have provenance. We
may ultimately have multiple source locations associated with a symbol.

ImplicitRules: Add isImplicitNoneType and isImplicitNoneExternal flags.

MessageHandler: Add methods to emit messages associated with source
locations.

Detect conflicting declarations of symbols (e.g. as subprogram and
variable).

Handle attribute statements like ASYNCHRONOUS statement: make sure the
symbol is present and set the attribute on it. Check that these all have
a type declared by the end of the specification part if IMPLICIT NONE.

Find variables named in Variable and Expr nodes and check they have
types declared if IMPLICIT NONE. Otherwise, make sure they are in the
symtab and apply the implicit type rules at the end of the scope.

Push a scope for MainProgram nodes and add a symbol for the name if it
has one.

Rename Scope::map_type to Scope::mapType

Add tests for errors currently being detected. There is no framework for
running them yet, just source files with the expected errors in
comments.

Original-commit: flang-compiler/f18@39e6fa4169644b2c2b94ee611949fbc0766599a2
Reviewed-on: https://github.com/flang-compiler/f18/pull/49
Tree-same-pre-rewrite: false
16 files changed:
flang/lib/semantics/resolve-names.cc
flang/lib/semantics/scope.h
flang/lib/semantics/symbol.cc
flang/lib/semantics/symbol.h
flang/test/semantics/implicit01.f90 [new file with mode: 0644]
flang/test/semantics/implicit02.f90 [new file with mode: 0644]
flang/test/semantics/implicit03.f90 [new file with mode: 0644]
flang/test/semantics/implicit04.f90 [new file with mode: 0644]
flang/test/semantics/implicit05.f90 [new file with mode: 0644]
flang/test/semantics/implicit06.f90 [new file with mode: 0644]
flang/test/semantics/resolve01.f90 [new file with mode: 0644]
flang/test/semantics/resolve02.f90 [new file with mode: 0644]
flang/test/semantics/resolve03.f90 [new file with mode: 0644]
flang/test/semantics/resolve04.f90 [new file with mode: 0644]
flang/test/semantics/resolve05.f90 [new file with mode: 0644]
flang/test/semantics/resolve06.f90 [new file with mode: 0644]