File tree Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -1993,17 +1993,28 @@ void CGObjCGNU::EmitTryStmt(CodeGen::CodeGenFunction &CGF,
1993
1993
1994
1994
// @catch() and @catch(id) both catch any ObjC exception.
1995
1995
// Treat them as catch-alls.
1996
- // FIXME: this is what this code was doing before, but should 'id'
1997
1996
// really be catching foreign exceptions?
1998
- if (!CatchDecl
1999
- || CatchDecl->getType ()->isObjCIdType ()
2000
- || CatchDecl->getType ()->isObjCQualifiedIdType ()) {
2001
-
1997
+
1998
+ if (!CatchDecl) {
2002
1999
Handler.TypeInfo = 0 ; // catch-all
2003
-
2004
2000
// Don't consider any other catches.
2005
2001
break ;
2006
2002
}
2003
+ if (CatchDecl->getType ()->isObjCIdType ()
2004
+ || CatchDecl->getType ()->isObjCQualifiedIdType ()) {
2005
+ // With the old ABI, there was only one kind of catchall, which broke
2006
+ // foreign exceptions. With the new ABI, we use __objc_id_typeinfo as
2007
+ // a pointer indicating object catchalls, and NULL to indicate real
2008
+ // catchalls
2009
+ if (CGM.getLangOptions ().ObjCNonFragileABI ) {
2010
+ Handler.TypeInfo = MakeConstantString (" @id" );
2011
+ continue ;
2012
+ } else {
2013
+ Handler.TypeInfo = 0 ; // catch-all
2014
+ // Don't consider any other catches.
2015
+ break ;
2016
+ }
2017
+ }
2007
2018
2008
2019
// All other types should be Objective-C interface pointer types.
2009
2020
const ObjCObjectPointerType *OPT =
You can’t perform that action at this time.
0 commit comments