Skip to content

Conversation

bruteforceboy
Copy link
Contributor

This PR adds support for returns inside of a TryOp, for example:

void foo() {
  int r = 1;
  try {
    return;
    ++r;
  } catch (...) {
  }
}

Currently, it fails during the CodeGen with:

error: 'cir.return' op expects parent op to be one of 'cir.func, cir.scope, cir.if, cir.switch, cir.do, cir.while, cir.for, cir.case'

were TryOp's omitted on purpose?

@bcardosolopes
Copy link
Member

were TryOp's omitted on purpose?

wasn't updated properly when introduced, thanks for spotting that

@bcardosolopes bcardosolopes merged commit 2947f38 into llvm:main Feb 24, 2025
7 checks passed
lanza pushed a commit that referenced this pull request Mar 18, 2025
This PR adds support for returns inside of a TryOp, for example: 

```
void foo() {
  int r = 1;
  try {
    return;
    ++r;
  } catch (...) {
  }
}
```
Currently, it fails during the CodeGen with: 
```
error: 'cir.return' op expects parent op to be one of 'cir.func, cir.scope, cir.if, cir.switch, cir.do, cir.while, cir.for, cir.case'
```
were TryOp's omitted on purpose?
terapines-osc-cir pushed a commit to Terapines/clangir that referenced this pull request Sep 2, 2025
This PR adds support for returns inside of a TryOp, for example: 

```
void foo() {
  int r = 1;
  try {
    return;
    ++r;
  } catch (...) {
  }
}
```
Currently, it fails during the CodeGen with: 
```
error: 'cir.return' op expects parent op to be one of 'cir.func, cir.scope, cir.if, cir.switch, cir.do, cir.while, cir.for, cir.case'
```
were TryOp's omitted on purpose?
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