[all-commits] [llvm/llvm-project] 3e782b: [flang][driver] Fix support for `-x`

Andrzej WarzyƄski via All-commits all-commits at lists.llvm.org
Fri Jun 10 03:36:44 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3e782ba21be4b88c761d3b0854df130d7ca08a56
      https://github.com/llvm/llvm-project/commit/3e782ba21be4b88c761d3b0854df130d7ca08a56
  Author: Andrzej Warzynski <andrzej.warzynski at arm.com>
  Date:   2022-06-10 (Fri, 10 Jun 2022)

  Changed paths:
    M clang/include/clang/Driver/Options.td
    M clang/lib/Driver/ToolChains/Flang.cpp
    M flang/lib/Frontend/CompilerInvocation.cpp
    M flang/lib/Frontend/FrontendActions.cpp
    A flang/test/Driver/input-from-stdin-llvm.ll
    M flang/test/Driver/input-from-stdin.f90
    M flang/test/Driver/linker-flags.f90
    R flang/test/Driver/parse-error.f95
    A flang/test/Driver/parse-error.ll
    A flang/test/Driver/parse-ir-error.f95

  Log Message:
  -----------
  [flang][driver] Fix support for `-x`

Until now, `-x` wasn't really taken into account in Flang's compiler and
frontend drivers. `flang-new` and `flang-new -fc1` only recently gained
powers to consume inputs other than Fortran files and that's probably
why this hasn't been noticed yet.

This patch makes sure that `-x` is supported correctly and consistently
with Clang. To this end, verification is added when reading LLVM IR
files (i.e. IR modules are verified with `llvm::verifyModule`). This
way, LLVM IR parsing errors are correctly reported to Flang users. This
also aids testing.

With the new functionality, we can verify that `-x ir` breaks
compilation for e.g. Fortran files and vice-versa. Tests are updated
accordingly.

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




More information about the All-commits mailing list