[clang] [CIR] Upstream Exception CXXTryStmt (PR #162528)

Bruno Cardoso Lopes via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 10 11:01:13 PDT 2025


bcardosolopes wrote:

> It would be useful to pull the CIR dialect changes out of this and into a separate PR that precedes this one. You could also Move the CFG flattening into a follow-up PR and just not lower to LLVM IR in this one. Those changes would make this easier to review.

+1

> I realised that in OGCG, it will call EmitStmt(S.getTryBlock()); and in case that try block is empty, nothing will be generated  In our case, in the incubator, we added scope and use cir::TryOp but I think we can early return in the codegen if the try block is empty. I will do that in another PR and will update this PR after that to handle either non-catch all or try with body.

Nice catch. We probably do this in the incubator because we are creating the scopes before we get into the actual emission, it might be more readable/easier to delete the ops altogether right after emission if they end being no-ops.

https://github.com/llvm/llvm-project/pull/162528


More information about the cfe-commits mailing list