[cfe-commits] r103938 - /cfe/trunk/lib/CodeGen/CGException.cpp

David Chisnall csdavec at swan.ac.uk
Mon May 17 08:21:56 PDT 2010


On 17 May 2010, at 16:11, Fariborz Jahanian wrote:

>> +static llvm::Constant *getPersonalityFn(CodeGenModule &CGM) {
>> +  const char *PersonalityFnName = "__gcc_personality_v0";
>> +  LangOptions Opts = CGM.getLangOptions();
>> +  if (Opts.CPlusPlus)
>> +     PersonalityFnName = "__gxx_personality_v0";
>> +  else if (Opts.ObjC1)
>> +    if (Opts.NeXTRuntime) {
>> +      if (Opts.ObjCNonFragileABI)
>> +        PersonalityFnName = "__gcc_personality_v0";
> 
> All can say:
> 
>     if (!Opts.NeXTRuntime)
>       PersonalityFnName = "__gnu_objc_personality_v0";

Unless I am missing something, that would break if you do this:

@try {
	if (something) {
		__attribute__((cleanup(destroy))
		void *foo;
		...
	}
} ...

With the Mac non-fragile ABI.  You will get two different personality functions, one for the @try block and one for the cleanup attribute, associated with the same function.  My understanding of the zero-cost EH mechanism is that each function may only have one personality function, so this will break.

With the legacy NeXT runtime, this is not an issue because Objective-C exceptions are handled by the setjmp/longjmp mechanism, so there is no conflict.

David

-- Sent from my Difference Engine







More information about the cfe-commits mailing list