[flang] Rework when symbol table expressions are evaluated
It's not good enough to evaluate expressions in the symbol table after name resolution has completed. This is because we need the values of constant expressions for types, for example, we need to evaluate `k` in `integer(k) :: x` to know the type of `x`. So, eliminate `LazyExpr` and call `EvaluateExpr()` on expressions that we need in the symbol table. The latter evaluates and folds an expression in the current context. This is now possible because symbols are added to `parser::Name` as soon as possible rather than in a pass after name resolution. Along with `LazyExpr` we can eliminate the whole `ResolveSymbolExprs` pass that used to resolve them. In resolve-names.cc, many `Pre` functions are changed to `Post` so that names are resolved before doing the associated processing. For example, with intrinsic type specs, names in the kind expression must be resolved before attempting to evaluate that expression. In `GetSymbolType()` in type.cc, handle both `ObjectEntityDetails` and `EntityDetails` by using `Symbol::GetType()`. Add explicit declarations in label01.F90 because we can't handle implicitly typed array bounds yet. Original-commit: flang-compiler/f18@d67716640baeedca150205f9f3845ceb5d2f6402 Reviewed-on: https://github.com/flang-compiler/f18/pull/238
Loading
Please sign in to comment