[cfe-commits] r127736 - /cfe/trunk/lib/CodeGen/CGObjCGNU.cpp

Douglas Gregor dgregor at apple.com
Wed Mar 16 10:14:45 PDT 2011


Bill, can you pull this into the 2.9 branch?

	Thanks!
	- Doug

On Mar 16, 2011, at 8:44 AM, David Chisnall wrote:

> Author: theraven
> Date: Wed Mar 16 10:44:28 2011
> New Revision: 127736
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=127736&view=rev
> Log:
> Fix foreign exception handling (GNU runtime).
> 
> 
> Modified:
>    cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
> 
> Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=127736&r1=127735&r2=127736&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Wed Mar 16 10:44:28 2011
> @@ -1993,17 +1993,28 @@
> 
>       // @catch() and @catch(id) both catch any ObjC exception.
>       // Treat them as catch-alls.
> -      // FIXME: this is what this code was doing before, but should 'id'
>       // really be catching foreign exceptions?
> -      if (!CatchDecl
> -          || CatchDecl->getType()->isObjCIdType()
> -          || CatchDecl->getType()->isObjCQualifiedIdType()) {
> -
> +      
> +      if (!CatchDecl) {
>         Handler.TypeInfo = 0; // catch-all
> -
>         // Don't consider any other catches.
>         break;
>       }
> +      if (CatchDecl->getType()->isObjCIdType()
> +          || CatchDecl->getType()->isObjCQualifiedIdType()) {
> +        // With the old ABI, there was only one kind of catchall, which broke
> +        // foreign exceptions.  With the new ABI, we use __objc_id_typeinfo as
> +        // a pointer indicating object catchalls, and NULL to indicate real
> +        // catchalls
> +        if (CGM.getLangOptions().ObjCNonFragileABI) {
> +          Handler.TypeInfo = MakeConstantString("@id");
> +          continue;
> +        } else {
> +          Handler.TypeInfo = 0; // catch-all
> +          // Don't consider any other catches.
> +          break;
> +        }
> +      }
> 
>       // All other types should be Objective-C interface pointer types.
>       const ObjCObjectPointerType *OPT =
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits





More information about the cfe-commits mailing list