[all-commits] [llvm/llvm-project] abb228: [CIR] Fix handling of cleanup scopes inside a try ...

Andy Kaylor via All-commits all-commits at lists.llvm.org
Mon Mar 2 14:30:40 PST 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: abb228af20c95d7d347831453d64da626e3c4392
      https://github.com/llvm/llvm-project/commit/abb228af20c95d7d347831453d64da626e3c4392
  Author: Andy Kaylor <akaylor at nvidia.com>
  Date:   2026-03-02 (Mon, 02 Mar 2026)

  Changed paths:
    M clang/lib/CIR/CodeGen/CIRGenCleanup.cpp
    M clang/lib/CIR/CodeGen/CIRGenException.cpp
    M clang/test/CIR/CodeGen/try-catch-tmp.cpp

  Log Message:
  -----------
  [CIR] Fix handling of cleanup scopes inside a try body (#183869)

We had a problem where scope terminators were not being created
correctly when a cleanup scope appeared inside the body of a try
operation. This was caused by cleanup scope operation not being properly
flushed before the try body scope was completed.

This change fixes the problem by creating a RunCleanupsScope in the
lambda that pupulates the try body and forcing cleanups before adding
the yield terminator to the try body.

The test case also exposed a secondary bug where we were not properly
updating the innermostEHScope variable when popping a cleanup from the
eh stack. That is also fixed here.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list