[all-commits] [llvm/llvm-project] 6f8ef1: [flang][driver] Add actions that execute despite s...

Andrzej WarzyƄski via All-commits all-commits at lists.llvm.org
Mon Oct 11 04:53:53 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6f8ef1d6e8796993b69d4b1cf8e56590273268e3
      https://github.com/llvm/llvm-project/commit/6f8ef1d6e8796993b69d4b1cf8e56590273268e3
  Author: Andrzej Warzynski <andrzej.warzynski at arm.com>
  Date:   2021-10-11 (Mon, 11 Oct 2021)

  Changed paths:
    M flang/include/flang/Frontend/FrontendActions.h
    M flang/lib/Frontend/FrontendActions.cpp
    A flang/test/Driver/dump-all-bad.f90

  Log Message:
  -----------
  [flang][driver] Add actions that execute despite semantic errors

This patch adds a new abstract class for frontend actions:
`PrescanAndSemaDebugAction`. It's almost identical to
`PrescanAndSemaAction`, but in the presence of semantic errors it does
not skip the corresponding `ExecuteAction` specialisation. Instead, it
runs it as if there were no semantic errors. This class is for developer
actions only (i.e.  front-end driver options).

The new behaviour does not affect the return code from `flang-new -fc1`
when the input file is semantically incorrect. The return code is
inferred from the number of driver diagnostics generated in
`CompilerInstance::ExecuteAction` and this patch does not change that.
More specifically, the semantic errors are still reported and hence the
driver is able to correctly report that the compilation has failed (with
a non-zero return code).

This new base class is meant for debug actions only and
`DebugDumpAllAction` is updated to demonstrate the new behaviour. With
this change, `flang-new -fc1 -fdebug-dump-all` dumps the parse tree and
symbols for all input files, regardless of whether any semantic errors
were found.

This patch addresses https://bugs.llvm.org/show_bug.cgi?id=52097.

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




More information about the All-commits mailing list