[flang][driver] Add support for `-fget-definition`
authorAndrzej Warzynski <andrzej.warzynski@arm.com>
Wed, 14 Apr 2021 10:43:14 +0000 (10:43 +0000)
committerAndrzej Warzynski <andrzej.warzynski@arm.com>
Wed, 21 Apr 2021 09:31:36 +0000 (09:31 +0000)
commitdc256a443a456a8e0e4d72736fee1c9442bcf4bd
treeb7b681db5ad7291ecf8b8fab9299c5fb5a4497e2
parentcd64273f5ed39ec697ff1e20a1fe25ebd3502629
[flang][driver] Add support for `-fget-definition`

This patch adds `-fget-definition` to `flang-new`. The semantics of this
option are identical in both drivers. The error message in the
"throwaway" driver is updated so that it matches the one from
`flang-new` (which is auto-generated and cannot be changed easily).

Tests are updated accordingly. A dedicated test for error handling was
added: get-definition.f90 (for the sake of simplicity,
getdefinition01.f90 no longer tests for errors).

The `ParseFrontendArgs` function is updated so that it can return
errors. This change is required in order to report invalid values
following `-fget-definition`.

The actual implementation of `GetDefinitionAction::ExecuteAction()` was
extracted from f18.cpp (i.e. the bit that deals with
`-fget-definition`).

Depends on: https://reviews.llvm.org/D100556

Differential Revision: https://reviews.llvm.org/D100558
14 files changed:
clang/include/clang/Driver/Options.td
flang/include/flang/Frontend/FrontendActions.h
flang/include/flang/Frontend/FrontendOptions.h
flang/lib/Frontend/CompilerInvocation.cpp
flang/lib/Frontend/FrontendActions.cpp
flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
flang/test/Driver/driver-help.f90
flang/test/Driver/get-definition.f90 [new file with mode: 0644]
flang/test/Semantics/getdefinition01.f90
flang/test/Semantics/getdefinition02.f
flang/test/Semantics/getdefinition03-a.f90
flang/test/Semantics/getdefinition04.f90
flang/test/Semantics/getdefinition05.f90
flang/tools/f18/f18.cpp