Skip to content

Commit 04fa52d

Browse files
author
David Chisnall
committed
Merge EH fix from trunk (GNUstep ObjC runtime).
Approved by Doug Gregor. llvm-svn: 127745
1 parent 98a4c87 commit 04fa52d

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

clang/lib/CodeGen/CGObjCGNU.cpp

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1993,17 +1993,28 @@ void CGObjCGNU::EmitTryStmt(CodeGen::CodeGenFunction &CGF,
19931993

19941994
// @catch() and @catch(id) both catch any ObjC exception.
19951995
// Treat them as catch-alls.
1996-
// FIXME: this is what this code was doing before, but should 'id'
19971996
// really be catching foreign exceptions?
1998-
if (!CatchDecl
1999-
|| CatchDecl->getType()->isObjCIdType()
2000-
|| CatchDecl->getType()->isObjCQualifiedIdType()) {
2001-
1997+
1998+
if (!CatchDecl) {
20021999
Handler.TypeInfo = 0; // catch-all
2003-
20042000
// Don't consider any other catches.
20052001
break;
20062002
}
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+
}
20072018

20082019
// All other types should be Objective-C interface pointer types.
20092020
const ObjCObjectPointerType *OPT =

0 commit comments

Comments
 (0)