[flang][driver] Disallow non-existent input files in the frontend driver
authorAndrzej Warzynski <andrzej.warzynski@arm.com>
Tue, 2 Feb 2021 09:07:33 +0000 (09:07 +0000)
committerAndrzej Warzynski <andrzej.warzynski@arm.com>
Tue, 2 Feb 2021 10:03:45 +0000 (10:03 +0000)
commit760e6c4ce58324856d8f105b37bb974564e0f170
tree6f3cd38402f9a64e21f32a9168a1ee2f278f7048
parentd4d4ceeb8f3be67be94781ed718ceb103213df74
[flang][driver] Disallow non-existent input files in the frontend driver

This patch adds a check that verifies that the input file used when
calling the frontend driver (i.e. `flang-new -fc1`) actually exists.
This was not required for the compiler driver, `flang-new`, as that's
already handled in libclangDriver.

Once all input/output file management is moved to the driver, we should
also check that for input from `stdin` the corresponding file descriptor
was successfully acquired.

This patch also makes sure that the default action in the frontend is
`ParseSyntaxOnly`. This is consistent with Clang. Before this change
`flang-new -fc1` would do nothing, which makes testing changes like the
one introduced here a bit tricky.

Reviewed By: SouraVX

Differential Revision: https://reviews.llvm.org/D95127
flang/lib/Frontend/CompilerInvocation.cpp
flang/lib/Frontend/FrontendAction.cpp
flang/test/Flang-Driver/missing-input.f90