[flang] Remove ObjectName alternative from Designator
authorTim Keith <tkeith@nvidia.com>
Fri, 12 Apr 2019 23:30:03 +0000 (16:30 -0700)
committerTim Keith <tkeith@nvidia.com>
Fri, 12 Apr 2019 23:30:03 +0000 (16:30 -0700)
commitb69c2c6997b6c98fcfd89e86b1375eb4d554b6b4
tree347c734c73d5e9bf771d8e7ebfcc5e5c69bb9e25
parenta398c8cae13b37f9642d6e4e1c3b60276b25d590
[flang] Remove ObjectName alternative from Designator

A simple name in a `Designator` is always parsed as a `DataRef`, not
an `ObjectName`. So remove that alternative.

`StmtFunctionStmt::ConvertToAssignment` was creating a `Designator` with
that alternative: change it to do the same thing as the parser.

Add `GetSimpleName` utility functions to check if an `Expr` or `Variable`
represents a simple name. Many of the places that checked for `ObjectName`
in `Designator` are trying to do that.

Clean up includes and forward declarations in `tools.h`.

Original-commit: flang-compiler/f18@97d44de7b146aee601caa0bc529f7af8a6be001e
Reviewed-on: https://github.com/flang-compiler/f18/pull/410
flang/lib/parser/parse-tree.cc
flang/lib/parser/parse-tree.h
flang/lib/semantics/resolve-names.cc
flang/lib/semantics/rewrite-parse-tree.cc
flang/lib/semantics/tools.cc
flang/lib/semantics/tools.h