[clang] [CIR][docs] Add cir.catch_param to ClangIR cleanup and EH design doc (PR #181284)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 13 06:27:31 PST 2026


================
@@ -350,11 +350,22 @@ the destructor. Therefore, this cleanup handler is marked as eh_only.
 Try-catch blocks will be represented, as they are in the ClangIR
 incubator project, using a `cir.try` operation.
 
+The `cir.catch_param` operation is used to represent the capturing of the
+exception object in an ABI-independent way. When the catch handler includes
+a source variable representing the exception object, the result of the
+`cir.catch_param` operation will be stored to an alloca object for the
+source variable.  If the handler is a catch-all, the `cir.catch_param` operation
+will return a pointer to void, but this cannot be captured by a source variable.
----------------
erichkeane wrote:

Does this interact ok with `std::current_exception`?  THe user can at least access the exception object that way, and it would be nice/useful/etc if this infra was used that way too.  (though note `current_exception` can be called from anywhere).

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


More information about the cfe-commits mailing list