Skip to content

Conversation

bruteforceboy
Copy link
Contributor

@bruteforceboy bruteforceboy commented Jul 11, 2025

This PR has two parts:

  1. Mimicking the OG special case for a single catch-all when getting dispatch blocks. The huge testcase I added, gotten by using creduce on a c++ file, crashed at this point in our version.
  2. Fixing multiple destructor calls for the same object. For example, there were tests like #1 and #2, having a second destructor call to an already destroyed object. This PR fixes these and I have updated the tests. Also, I added "CIR-NEXT" at some points, to confirm the destructors are indeed called once.

As usual, please let me know if you have any concerns.

Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks great, thanks! One clarifying question

@bcardosolopes bcardosolopes merged commit aa1692a into llvm:main Jul 15, 2025
8 of 9 checks passed
terapines-osc-cir pushed a commit to Terapines/clangir that referenced this pull request Sep 2, 2025
…lvm#1740)

This PR has two parts:
1. Mimicking the OG [special
case](https://github.com/llvm/clangir/blob/d030c9bff74f4f9504a61abe9b2c04a8777028a5/clang/lib/CodeGen/CGException.cpp#L690)
for a single catch-all when getting dispatch blocks. The huge testcase I
added, gotten by using
[creduce](https://github.com/csmith-project/creduce) on a c++ file,
crashed at this point [in our
version](https://github.com/llvm/clangir/blob/d030c9bff74f4f9504a61abe9b2c04a8777028a5/clang/lib/CIR/CodeGen/CIRGenException.cpp#L789).
2. Fixing multiple destructor calls for the same object. For example,
there were tests like
[llvm#1](https://github.com/llvm/clangir/blob/d030c9bff74f4f9504a61abe9b2c04a8777028a5/clang/test/CIR/CodeGen/try-catch-dtors.cpp#L370C1-L372C80)
and
[llvm#2](https://github.com/llvm/clangir/blob/d030c9bff74f4f9504a61abe9b2c04a8777028a5/clang/test/CIR/CodeGen/conditional-cleanup.cpp#L217C1-L224C25),
having a second destructor call to an already destroyed object. This PR
fixes these and I have updated the tests. Also, I added `"CIR-NEXT"` at
some points, to confirm the destructors are indeed called once.

As usual, please let me know if you have any concerns.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants