[flang] (NFC) Expose internal idiom as utility API
authorpeter klausler <pklausler@nvidia.com>
Wed, 12 May 2021 19:10:28 +0000 (12:10 -0700)
committerpeter klausler <pklausler@nvidia.com>
Thu, 13 May 2021 18:19:37 +0000 (11:19 -0700)
commit6829bd3ed0515e17c84c5e72fe1742bd20ee61e5
treeccbfd0cf0de677c10a3f14084d42127321d4e00c
parentecc4e9e8f4cb7581cbc447bc838943176715695c
[flang] (NFC) Expose internal idiom as utility API

Add overloads to AsGenericExpr() in Evaluate/tools.h to take care
of wrapping an untyped DataRef or bare Symbol in a typed Designator
wrapped up in a generic Expr<SomeType>.  Use the new overloads to
replace a few instances of code that was calling TypedWrapper<>()
with a dynamic type.

This new tool will be useful in lowering to drive some code that
works with typed expressions (viz., list-directed I/O list items)
when starting with only a bare Symbol (viz., NAMELIST).

Differential Revision: https://reviews.llvm.org/D102352
flang/include/flang/Evaluate/tools.h
flang/lib/Evaluate/fold-designator.cpp
flang/lib/Evaluate/tools.cpp
flang/lib/Semantics/check-declarations.cpp
flang/lib/Semantics/expression.cpp