Page MenuHomePhabricator

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

Authored by awarzynski on Jan 26 2021, 11:24 AM.



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

Diff Detail

Event Timeline

awarzynski created this revision.Jan 26 2021, 11:24 AM
awarzynski requested review of this revision.Jan 26 2021, 11:24 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 26 2021, 11:24 AM
FarisRehman accepted this revision.Feb 4 2021, 7:52 AM

Thanks for working on this @awarzynski!
I've left a comment on the test but otherwise looks good to me.


Comment corresponds to the wrong section


Comment corresponds to the wrong section

This revision is now accepted and ready to land.Feb 4 2021, 7:52 AM