usx95 wrote:

> Is there a valid use for having "EHCleanup" that _doesn't_ handle branches 
> across it? That is, do we _ever_ need a cleanup to be called only for an 
> exception thrown, and not otherwise leaving the scope? I'm just wondering if 
> we can simplify things conceptually here and remove an option.

@jyknight Previously, I had tried using all the `EHCleanup` in the EHStack for 
these purposes. I found the `CallCoroEnd` cleanup problematic because the 
suspension cleanup jump destination does not include `CallCoroEnd` cleanup in 
its scope. So we might emit it on jumping to this destination.
```cpp
CurCoro.Data->CleanupJD = getJumpDestInCurrentScope(RetBB);
...
    GroManager.EmitGroInit();
    EHStack.pushCleanup<CallCoroEnd>(EHCleanup);
```

I will try to juggle the `CallCoroEnd` cleanup and jump destination and make it 
work.

Another problem of relying on `EHCleanup` would be that many (and not all) 
EHOnly cleanups are added to the EHStack only when exceptions are enabled. We 
would need to restructure this to add them to EHStack "always" but only emit 
them with `-fexceptions`.

https://github.com/llvm/llvm-project/pull/80698
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to