[flang-commits] [PATCH] D106727: [flang] Produce proper "preprocessor output" for -E option

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri Jul 23 16:56:12 PDT 2021


klausler created this revision.
klausler added a reviewer: awarzynski.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
klausler requested review of this revision.

Rename the current -E option to -fdebug-dump-cooked-chars.

Add a new Parsing::EmitPreprocessedSource() routine to convert the
cooked character stream output of the prescanner back to something
more closely resembling output from a traditional preprocessor;
call this new routine when -E appears.

The new -E output is suitable for use as fixed form Fortran source to
compilation by (one hopes) any Fortran compiler.  If the original
top-level source file had been free form source, the output will be
suitable for use as free form source as well; otherwise there may be
diagnostics about missing spaces if they were indeed absent in the
original fixed form source.

Unless the -P option appears, #line directives are interspersed
with the output (but be advised, f18 will ignore these if presented
with them in a later compilation).

An effort has been made to preserve original alphabetic character case
and source indentation.


https://reviews.llvm.org/D106727

Files:
  flang/include/flang/Parser/parsing.h
  flang/lib/Parser/parsing.cpp
  flang/lib/Parser/provenance.cpp
  flang/tools/f18/f18.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106727.361384.patch
Type: text/x-patch
Size: 6228 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20210723/06d5aaf1/attachment-0001.bin>


More information about the flang-commits mailing list