[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 09:23:25 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:

I guess my point is: that library function requires SOME level of compiler magic via a builtin/etc... though I guess if we're handling this like a normal lowering the library should take care of it?  

I think this works .... but I'll think more on it.  We at one point will probably need to make sure that `current_exception` still does the right thing/we fit into that, but perhaps thats just a validation step.

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


More information about the cfe-commits mailing list