[cfe-commits] [PATCH] Move hardcoded GNUstep exceptions to CGObjCGNUstep

David Chisnall csdavec at swan.ac.uk
Sun Nov 11 07:25:42 PST 2012


This looks fine to me, but I'm currently on really flakey hotel Internet that dies in the middle of svn operations, so if someone else can commit it then that would be great.

David

On 10 Nov 2012, at 02:19, Jonathan Schleifer wrote:

> [PATCH] Move hardcoded GNUstep exceptions to CGObjCGNUstep
> 
> Not only were they referencing symbols in the GNUstep namespace, they
> had the mangled version of the symbol hardcoded instead of using the
> mangler. This broke it completely for every GNU-based runtime which is
> not the GNUstep runtime.
> ---
> lib/CodeGen/CGObjCGNU.cpp |   47 ++++++++++++++++++++++++---------------------
> 1 file changed, 25 insertions(+), 22 deletions(-)
> 
> diff --git a/lib/CodeGen/CGObjCGNU.cpp b/lib/CodeGen/CGObjCGNU.cpp
> index 5acc199..68d234d 100644
> --- a/lib/CodeGen/CGObjCGNU.cpp
> +++ b/lib/CodeGen/CGObjCGNU.cpp
> @@ -600,6 +600,8 @@ class CGObjCGNUstep : public CGObjCGNU {
>    /// Type of an slot structure pointer.  This is returned by the various
>    /// lookup functions.
>    llvm::Type *SlotTy;
> +  public:
> +    virtual llvm::Constant *GetEHType(QualType T);
>  protected:
>    virtual llvm::Value *LookupIMP(CodeGenFunction &CGF,
>                                   llvm::Value *&Receiver,
> @@ -966,29 +968,30 @@ llvm::Value *CGObjCGNU::GetSelector(CGBuilderTy &Builder, const ObjCMethodDecl
> }
> 
> llvm::Constant *CGObjCGNU::GetEHType(QualType T) {
> -  if (!CGM.getLangOpts().CPlusPlus) {
> -      if (T->isObjCIdType()
> -          || T->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.getLangOpts().ObjCRuntime.isNonFragile()) {
> -          return MakeConstantString("@id");
> -        } else {
> -          return 0;
> -        }
> -      }
> -
> -      // All other types should be Objective-C interface pointer types.
> -      const ObjCObjectPointerType *OPT =
> -        T->getAs<ObjCObjectPointerType>();
> -      assert(OPT && "Invalid @catch type.");
> -      const ObjCInterfaceDecl *IDecl =
> -        OPT->getObjectType()->getInterface();
> -      assert(IDecl && "Invalid @catch type.");
> -      return MakeConstantString(IDecl->getIdentifier()->getName());
> +  if (T->isObjCIdType() || T->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.getLangOpts().ObjCRuntime.isNonFragile()) {
> +      return MakeConstantString("@id");
> +    } else {
> +      return 0;
> +    }
>  }
> +
> +  // All other types should be Objective-C interface pointer types.
> +  const ObjCObjectPointerType *OPT = T->getAs<ObjCObjectPointerType>();
> +  assert(OPT && "Invalid @catch type.");
> +  const ObjCInterfaceDecl *IDecl = OPT->getObjectType()->getInterface();
> +  assert(IDecl && "Invalid @catch type.");
> +  return MakeConstantString(IDecl->getIdentifier()->getName());
> +}
> +
> +llvm::Constant *CGObjCGNUstep::GetEHType(QualType T) {
> +  if (!CGM.getLangOpts().CPlusPlus)
> +    return CGObjCGNU::GetEHType(T);
> +
>  // For Objective-C++, we want to provide the ability to catch both C++ and
>  // Objective-C objects in the same function.
> 
> -- 
> Jonathan





More information about the cfe-commits mailing list