[flang][driver] Add `-fno-analyzed-objects-for-unparse`
authorAndrzej Warzynski <andrzej.warzynski@arm.com>
Fri, 4 Jun 2021 14:25:58 +0000 (15:25 +0100)
committerAndrzej Warzynski <andrzej.warzynski@arm.com>
Fri, 25 Jun 2021 12:28:12 +0000 (13:28 +0100)
commit2a7bb8494e9c58b44ad7142d8d309455cd669603
tree14bb27bb09e1ce3f845d668fb088dccbe4ecd5fe
parentf7b1fa6f5ebec5780e626aa48d582f2519a01632
[flang][driver] Add `-fno-analyzed-objects-for-unparse`

This patch adds a new option for the new Flang driver:
`-fno-analyzed-objects-for-unparse`. The semantics are similar to
`-funparse-typed-exprs-to-f18-fc` from `f18`. For consistency, the
latter is replaced with `-fno-analyzed-objects-for-unparse`.

The new option controls the behaviour of the unparser (i.e. the action
corresponding to `-fdebug-unparse`). The default behaviour is to use the
analyzed objects when unparsing. The new flag can be used to turn this
off, so that the original parse-tree objects are used. The analyzed
objects are generated during the semantic checks [1].

This patch also updates the semantics of
`-fno-analyzed-objects-for-unparse`/`-funparse-typed-exprs-to-f18-fc`
in `f18`, so that this flag is always taken into account when `Unparse`
is used (this way the semantics in `f18` and `flang-new` are identical).

The added test file is based on example from Peter Steinfeld.

[1]
https://github.com/llvm/llvm-project/blob/main/flang/docs/Semantics.md

Differential Revision: https://reviews.llvm.org/D103612
clang/include/clang/Driver/Options.td
flang/include/flang/Frontend/CompilerInvocation.h
flang/lib/Frontend/CompilerInvocation.cpp
flang/lib/Frontend/FrontendActions.cpp
flang/lib/Frontend/FrontendOptions.cpp
flang/test/Driver/driver-help.f90
flang/test/Driver/unparse-use-analyzed.f95 [new file with mode: 0644]
flang/tools/f18/f18.cpp
flang/tools/f18/flang