Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CIR][CIRGen] Add more support for __cxa_rethrow #1343

Merged
merged 4 commits into from
Feb 20, 2025

Conversation

bruteforceboy
Copy link
Contributor

@bruteforceboy bruteforceboy commented Feb 13, 2025

This is the second part of PR#1290, adding initial support for __cxa_rethrow.

So, the last PR did not support statements that come after the UnreachableOp from the rethrow, we just ignored them, e.g:

struct S {
  S() {}
};

void foo() {
  int r = 1;
  try {
    throw;
    S s;
  } catch (...) {
    ++r;
  }
}

This PR fixes this.

A few changes:

  • rethrow statements split their block into multiple blocks.
  • Tests with statements that come after the rethrow were added and old ones were modified.

Concern:

  • The ScopeOp workaround still exists which I guess was one of the main concerns when we tried in the last PR.

As usual, I am open to discussions on this and how to approach it better -:)

clang/test/CIR/CodeGen/throw.cpp Outdated Show resolved Hide resolved
clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp Outdated Show resolved Hide resolved
clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp Show resolved Hide resolved
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.

Ready to go after nits get addressed.

clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp Outdated Show resolved Hide resolved
clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp Outdated Show resolved Hide resolved
clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp Outdated Show resolved Hide resolved
clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp Outdated Show resolved Hide resolved
clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp Show resolved Hide resolved
@bcardosolopes bcardosolopes changed the title [CIR][CodeGen] Add initial support for __cxa_rethrow II [CIR][CodeGen] Add more support for __cxa_rethrow Feb 20, 2025
@bcardosolopes bcardosolopes changed the title [CIR][CodeGen] Add more support for __cxa_rethrow [CIR][CIRGen] Add more support for __cxa_rethrow Feb 20, 2025
@bcardosolopes bcardosolopes merged commit e6165c8 into llvm:main Feb 20, 2025
6 checks passed
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