[cfe-dev] Exception Personality Function

David Chisnall csdavec at swan.ac.uk
Fri Mar 18 04:41:03 PDT 2011


Hi,

I've been testing Objective-C++ with clang, in preparation to the 2.9 release.  Most stuff works, but I noticed one strange thing.  Any @try block in Objective-C++ calls fails with an exception specifier violation.  It seems that this is caused by the C++ personality function being used in all Objective-C++ code (non-Darwin platforms), even though the exception tables are being initialised with unwind data for the Objective-C runtime exception model.

The correct fix would be to use the C++ exception personality function on the eh_selector call for try/catch statements and the Objective-C personality function for @try / @catch statements.  

Unfortunately, it seems that the information about the source-language type of the catch handler is lost by the time we get to the code for picking the personality function.  It only uses the language mode.  I presume that it's too late to get this fixed in time for 2.9, but I'd like to get it fixed in trunk anyway.  I can just add an Objective-C kind to the EHScope's kind, and then tweak the logic for using the selector, but it might be cleaner to specify the personality function in the code that generates the rest of the information for the unwind tables.

Thoughts?  Comments?  Suggestions?

David



More information about the cfe-dev mailing list