[all-commits] [llvm/llvm-project] 3338ef: [flang] Produce proper "preprocessor output" for -...

Peter Klausler via All-commits all-commits at lists.llvm.org
Fri Jul 30 15:14:14 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3338ef93b02837edf69abc203e15a42fa55aa1b3
      https://github.com/llvm/llvm-project/commit/3338ef93b02837edf69abc203e15a42fa55aa1b3
  Author: peter klausler <pklausler at nvidia.com>
  Date:   2021-07-30 (Fri, 30 Jul 2021)

  Changed paths:
    M clang/include/clang/Driver/Options.td
    M clang/lib/Driver/ToolChains/Flang.cpp
    M flang/include/flang/Frontend/FrontendOptions.h
    M flang/include/flang/Frontend/PreprocessorOptions.h
    M flang/include/flang/Parser/parsing.h
    M flang/lib/Frontend/CompilerInvocation.cpp
    M flang/lib/Frontend/FrontendActions.cpp
    M flang/lib/Frontend/FrontendOptions.cpp
    M flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
    M flang/lib/Parser/parsing.cpp
    M flang/lib/Parser/provenance.cpp
    M flang/lib/Parser/token-sequence.cpp
    M flang/lib/Parser/token-sequence.h
    M flang/test/Driver/cpp-nocpp-command-line-macro.f90
    M flang/test/Driver/driver-help-hidden.f90
    M flang/test/Driver/driver-help.f90
    M flang/test/Driver/escaped-backslash.f90
    M flang/test/Driver/fixed-free-detection.f90
    M flang/test/Driver/fixed-line-length.f90
    M flang/test/Driver/frontend-forwarding.f90
    M flang/test/Driver/include-header.f90
    M flang/test/Driver/input-from-stdin.f90
    M flang/test/Driver/macro-def-undef.F90
    M flang/test/Driver/macro-multiline.F90
    M flang/test/Parser/badlabel.f
    M flang/test/Preprocessing/assert.F90
    A flang/test/Preprocessing/dash-E.F90
    M flang/test/Preprocessing/fixed-rescan.F
    M flang/test/Preprocessing/hollerith.f
    M flang/test/Preprocessing/pp001.F
    M flang/test/Preprocessing/pp002.F
    M flang/test/Preprocessing/pp003.F
    M flang/test/Preprocessing/pp004.F
    M flang/test/Preprocessing/pp005.F
    M flang/test/Preprocessing/pp006.F
    M flang/test/Preprocessing/pp007.F
    M flang/test/Preprocessing/pp008.F
    M flang/test/Preprocessing/pp009.F
    M flang/test/Preprocessing/pp010.F
    M flang/test/Preprocessing/pp011.F
    M flang/test/Preprocessing/pp012.F
    M flang/test/Preprocessing/pp013.F
    M flang/test/Preprocessing/pp014.F
    M flang/test/Preprocessing/pp015.F
    M flang/test/Preprocessing/pp016.F
    M flang/test/Preprocessing/pp017.F
    M flang/test/Preprocessing/pp018.F
    M flang/test/Preprocessing/pp019.F
    M flang/test/Preprocessing/pp020.F
    M flang/test/Preprocessing/pp021.F
    M flang/test/Preprocessing/pp022.F
    M flang/test/Preprocessing/pp023.F
    M flang/test/Preprocessing/pp024.F
    M flang/test/Preprocessing/pp025.F
    M flang/test/Preprocessing/pp026.F
    M flang/test/Preprocessing/pp027.F
    M flang/test/Preprocessing/pp028.F
    M flang/test/Preprocessing/pp029.F
    M flang/test/Preprocessing/pp030.F
    M flang/test/Preprocessing/pp031.F
    M flang/test/Preprocessing/pp032.F
    M flang/test/Preprocessing/pp033.F
    M flang/test/Preprocessing/pp034.F
    M flang/test/Preprocessing/pp035.F
    M flang/test/Preprocessing/pp036.F
    M flang/test/Preprocessing/pp037.F
    M flang/test/Preprocessing/pp038.F
    M flang/test/Preprocessing/pp039.F
    M flang/test/Preprocessing/pp041.F
    M flang/test/Preprocessing/pp043.F
    M flang/test/Preprocessing/pp044.F
    M flang/test/Preprocessing/pp101.F90
    M flang/test/Preprocessing/pp102.F90
    M flang/test/Preprocessing/pp104.F90
    M flang/test/Preprocessing/pp107.F90
    M flang/test/Preprocessing/pp108.F90
    M flang/test/Preprocessing/pp111.F90
    M flang/test/Preprocessing/pp112.F90
    M flang/test/Preprocessing/pp115.F90
    M flang/test/Preprocessing/pp116.F90
    M flang/test/Preprocessing/pp117.F90
    M flang/test/Preprocessing/pp118.F90
    M flang/test/Preprocessing/pp121.F90
    M flang/test/Preprocessing/pp123.F90
    M flang/test/Preprocessing/pp124.F90
    M flang/test/Preprocessing/pp125.F90
    M flang/test/Preprocessing/pp126.F90
    M flang/test/Preprocessing/pp127.F90
    M flang/test/Preprocessing/pp128.F90
    M flang/tools/f18-parse-demo/f18-parse-demo.cpp
    M flang/tools/f18/f18.cpp
    M flang/unittests/Frontend/FrontendActionTest.cpp

  Log Message:
  -----------
  [flang] Produce proper "preprocessor output" for -E option

Rename the current -E option to "-E -Xflang -fno-reformat".

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.

Add -P and -fno-reformat to the new drivers.

Tweak test options to avoid confusion with prior -E output; use
-fno-reformat where needed, but prefer to keep -E, sometimes
in concert with -P, on most, updating expected results accordingly.

Differential Revision: https://reviews.llvm.org/D106727




More information about the All-commits mailing list