Exceptions for my own programming language (original) (raw)

I am working on an back end for my own programming language. I think the most challenging feature will be exceptions. I’ve read the documentation, but I’m still missing some crucial pieces.

What I (think I) know:

My main question now is about the landingpad arguments. In particular, I need to provide at least one catch clause with a “type” of exception. But which type should I use there? I don’t have to provide a type when using _Unwind_RaiseException, so how does the mechanism know that my exception should land on this landingpad?

I would also appreciate any information about what the personality function is supposed to do, because the LLVM documentation is really light on the details:

The personality attribute permits functions to specify what function to use for exception handling.

😕

In particular, about the personality function, I’m wondering how it should jump to the LLVM landing pad.