[all-commits] [llvm/llvm-project] 7e2254: [flang] Finer control over error recovery with Get...

Peter Klausler via All-commits all-commits at lists.llvm.org
Fri Apr 15 14:25:57 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7e225423d39ae1982e9380a4a0836888ab6b3bd8
      https://github.com/llvm/llvm-project/commit/7e225423d39ae1982e9380a4a0836888ab6b3bd8
  Author: Peter Klausler <pklausler at nvidia.com>
  Date:   2022-04-15 (Fri, 15 Apr 2022)

  Changed paths:
    M flang/include/flang/Semantics/tools.h
    M flang/lib/Semantics/assignment.cpp
    M flang/lib/Semantics/check-allocate.cpp
    M flang/lib/Semantics/check-arithmeticif.cpp
    M flang/lib/Semantics/check-case.cpp
    M flang/lib/Semantics/check-coarray.cpp
    M flang/lib/Semantics/check-deallocate.cpp
    M flang/lib/Semantics/check-do-forall.cpp
    M flang/lib/Semantics/check-io.cpp
    M flang/lib/Semantics/check-io.h
    M flang/lib/Semantics/check-nullify.cpp
    M flang/lib/Semantics/check-omp-structure.cpp
    M flang/lib/Semantics/check-stop.cpp
    M flang/lib/Semantics/data-to-inits.cpp
    M flang/lib/Semantics/resolve-directives.cpp
    M flang/lib/Semantics/tools.cpp

  Log Message:
  -----------
  [flang] Finer control over error recovery with GetExpr()

Prior to this patch, the semantics utility GetExpr() will crash
unconditionally if it encounters a typed expression in the parse
tree that has not been set by expression semantics.  This is the
right behavior when called from lowering, by which time it is known
that the program had no fatal user errors, since it signifies a
fatal internal error.  However, prior to lowering, in the statement
semantics checking code, a more nuanced test should be used before
crashing -- specifically, we should not crash in the face of a
missing typed expression when in error recovery mode.

Getting this right requires GetExpr() and its helper class to have
access to the semantics context, so that it can check AnyFatalErrors()
before crashing.  So this patch touches nearly all of its call sites.

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




More information about the All-commits mailing list