[PATCH] D127207: [flang][driver] Fix support for `-x`

Andrzej Warzynski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 7 05:18:09 PDT 2022


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

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D127207

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127207.434785.patch
Type: text/x-patch
Size: 8633 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220607/57560591/attachment.bin>


More information about the cfe-commits mailing list