[PATCH] D124669: [flang][driver] Add support for -save-temps

Andrzej Warzynski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 29 05:07:14 PDT 2022

awarzynski created this revision.
awarzynski added reviewers: rovka, kiranchandramohan, Leporacanthicus, unterumarmung, ekieri, schweitz, jeanPerier, peixin, shraiysh.
Herald added a reviewer: sscalpone.
Herald added projects: Flang, All.
awarzynski requested review of this revision.
Herald added subscribers: cfe-commits, jdoerfert.
Herald added a project: clang.

This patch adds support for `-save-temps` in `flang-new`, Flang's
compiler driver. The semantics of this option are inherited from Clang.

The file extension for temporary Fortran preprocessed files is set to
`i`. This is identical to what Clang uses for C (or C++) preprocessed
files. I have tried researching what other compilers do here, but I
couldn't find any definitive answers. One GFortran thread [1] suggests
that indeed it is not clear what the right approach should be.

Normally, various phases in Clang/Flang are combined. The `-save-temps`
option works by forcing the compiler to run every phase separately. As
there is no integrated assembler driver in Flang, user will have to use
`-save-temps` together with `-fno-integrated-as`. Otherwise, an
invocation to the integrated assembler would be generated generated,
which is going to fail (i.e. something equivalent to `clang -cc1as` from

There are no specific plans for implementing an integrated assembler for
Flang for now. One possible solution would be to share it entirely with

[1] https://gcc.gnu.org/bugzilla//show_bug.cgi?id=81615

Depends on D124664 <https://reviews.llvm.org/D124664>
Depends on D124665 <https://reviews.llvm.org/D124665>
Depends on D124667 <https://reviews.llvm.org/D124667>

  rG LLVM Github Monorepo



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124669.426023.patch
Type: text/x-patch
Size: 7909 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220429/c78f5f20/attachment.bin>

More information about the cfe-commits mailing list