[PATCH] D95465: [flang][driver] Fix reading from stdin when using `-test-io`

Andrzej Warzynski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 26 11:24:03 PST 2021


awarzynski created this revision.
Herald added subscribers: usaxena95, kadircet.
Herald added a reviewer: sscalpone.
awarzynski requested review of this revision.
Herald added subscribers: llvm-commits, ilya-biryukov.
Herald added a project: LLVM.

This patch adds logic in the `InputOutputTestAction` frontend action for
reading input from stdin. Without this patch the following fails:

- `flang-new -fc1 -test-io -`

The implementation of `InputOutputTestAction` is cleaned-up and a test
for reading from stdin is added.

Note that there's a difference between `-test-io` and e.g. `-E` in terms
of file I/O. The frontend action for the former handles all file I/O on
it's own. Conversely, the action corresponding to `-E` relies on the
prescanner API to handle this.

Currently we can't test reading from stdin for `flang-new -`. In this
case libclangDriver assumes `-x -c`. This in turn leads to `flang-new
-cc1`, which is not supported.

Depends on: D95464 <https://reviews.llvm.org/D95464>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95465

Files:
  flang/lib/Frontend/FrontendActions.cpp
  flang/test/Flang-Driver/input-from-stdin.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95465.319366.patch
Type: text/x-patch
Size: 3617 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210126/24a3c968/attachment.bin>


More information about the llvm-commits mailing list