diff options
author | Andrzej Warzynski <andrzej.warzynski@arm.com> | 2021-02-04 11:14:57 +0000 |
---|---|---|
committer | Andrzej Warzynski <andrzej.warzynski@arm.com> | 2021-02-16 09:32:51 +0000 |
commit | 96d229c9abdfb2836e18a554bfb63b5d52aeebfa (patch) | |
tree | 1e93c2b2cea7fad1f112575fb2bcf825e2c35266 /flang/lib/FrontendTool | |
parent | 00fe10c6a65173c9c578babd19f8fee44d07a761 (diff) | |
download | llvm-96d229c9abdfb2836e18a554bfb63b5d52aeebfa.zip llvm-96d229c9abdfb2836e18a554bfb63b5d52aeebfa.tar.gz llvm-96d229c9abdfb2836e18a554bfb63b5d52aeebfa.tar.bz2 |
[flang][driver] Add options for unparsing
This patch adds the following compiler frontend driver options:
* -fdebug-unparse (f18 spelling: -funparse)
* -fdebug-unparse-with-symbols (f18 spelling: -funparse-with-symbols)
The new driver will only accept the new spelling. `f18` will accept both
the original and the new spelling.
A new base class for frontend actions is added: `PrescanAndSemaAction`.
This is added to reduce code duplication that otherwise these new
options would lead to. Implementation from
* `ParseSyntaxOnlyAction::ExecutionAction`
is moved to:
* `PrescanAndSemaAction::BeginSourceFileAction`
This implementation is now shared between:
* PrescanAndSemaAction
* ParseSyntaxOnlyAction
* DebugUnparseAction
* DebugUnparseWithSymbolsAction
All tests that don't require other yet unimplemented options are
updated. This way `flang-new -fc1` is used instead of `f18` when
`FLANG_BUILD_NEW_DRIVER` is set to `On`. In order to facilitate this,
`%flang_fc1` is added in the LIT configuration (lit.cfg.py).
`asFortran` from f18.cpp is duplicated as `getBasicAsFortran` in
FrontendOptions.cpp. At this stage it's hard to find a good place to
share this method. I suggest that we revisit this once a switch from
`f18` to `flang-new` is complete.
Differential Revision: https://reviews.llvm.org/D96483
Diffstat (limited to 'flang/lib/FrontendTool')
-rw-r--r-- | flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp b/flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp index 50c9fca..12f538c 100644 --- a/flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp +++ b/flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp @@ -37,6 +37,12 @@ static std::unique_ptr<FrontendAction> CreateFrontendBaseAction( case EmitObj: return std::make_unique<EmitObjAction>(); break; + case DebugUnparse: + return std::make_unique<DebugUnparseAction>(); + break; + case DebugUnparseWithSymbols: + return std::make_unique<DebugUnparseWithSymbolsAction>(); + break; default: break; // TODO: |