[all-commits] [llvm/llvm-project] fa87fa: Skip exception cleanups when the innermost scope i...

James Y Knight via All-commits all-commits at lists.llvm.org
Wed Feb 2 14:51:30 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fa87fa97fb79e4205a84b12a8c4f2f7d819473d5
      https://github.com/llvm/llvm-project/commit/fa87fa97fb79e4205a84b12a8c4f2f7d819473d5
  Author: James Y Knight <jyknight at google.com>
  Date:   2022-02-02 (Wed, 02 Feb 2022)

  Changed paths:
    M clang/lib/CodeGen/CGCleanup.cpp
    M clang/test/CodeGenCXX/noexcept.cpp
    M clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
    M clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
    M clang/test/OpenMP/openmp_win_codegen.cpp
    M clang/test/OpenMP/ordered_doacross_codegen.cpp
    M clang/test/OpenMP/parallel_master_codegen.cpp
    M clang/test/OpenMP/single_codegen.cpp
    M clang/test/OpenMP/taskgroup_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_num_threads_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_simd_num_threads_codegen.cpp

  Log Message:
  -----------
  Skip exception cleanups when the innermost scope is EHTerminateScope.

EHTerminateScope is used to implement C++ noexcept semantics. Per C++
[except.terminate], it is implemented-defined whether no, some, or all
cleanups are run prior to terminatation.

Therefore, the code to run cleanups on the way towards termination is
unnecessary, and may be omitted.

After this change, we will still run some cleanups: any cleanups in a
function called from the noexcept function will continue to run, while
those in the noexcept function itself will not.

(Commit attempt 2: check InnermostEHScope != stable_end() before accessing it.)

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




More information about the All-commits mailing list