Do the LLVM SJLJ intrinsics interact with C++ exception handling and execute C++ cleanup actions?

Do the LLVM Setjmp/Longjmp intrinsics interact with C++ exception handling and execute C++ cleanup actions?

I compiled a small example using setjmp/longjmp using clang and they did not execute C++ cleanup actions and calling longjmp bypassed calling destructors on objects that were allocated between the call to setjmp and longjmp.

I’m wondering if the LLVM intrinsics behave differently from setjmp/longjmp.

Best,

.Chris.

Christian Schafmeister
Professor, Chemistry Department
Temple University

The intrinsics are completely distinct from the standard library functions. The names are historical legacy from GCC. They’re used for 32-bit iOS exception handling. I’m not aware of them being tested or supported in any other context.

-Jim

Thank you!

I was envisioning all sorts of wonderful uses for the SJLJ intrinsics to implement non-local exits for the Common Lisp CATCH/THROW, BLOCK/RETURN-FROM and TAGBODY/GO special operators that would work in a way that was compatible with C++. Currently I’m using C++ exception handling and it works fine but I have been under the misapprehension from reading http://llvm.org/docs/ExceptionHandling.html#setjmp-longjmp-exception-handling that SJLJ intrinsics were a parallel mechanism to C++ exception handling that offered different trade-offs in run-time cost/overhead.

I see now that SJLJ is a more primitive exception handling mechanism for a subset 32-bit iOS.

Best,

.Chris.