diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-01-12 01:22:23 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-01-12 01:22:23 +0000 |
commit | 66867c526ce9ae5402bb3d0caf1458ccd8576a5e (patch) | |
tree | 6ed8e3e922e65195ca83b80d2096d2f1643f15dc | |
parent | 3f477a1a804ead812781168bd354af2adefddde8 (diff) |
Fix rewriting of MacOS sjlj based eh.
Fixes radar 7522880.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93219 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Frontend/RewriteObjC.cpp | 8 | ||||
-rw-r--r-- | test/Rewriter/rewrite-eh.m | 20 |
2 files changed, 24 insertions, 4 deletions
diff --git a/lib/Frontend/RewriteObjC.cpp b/lib/Frontend/RewriteObjC.cpp index e8bb18665b..74b2a1eb85 100644 --- a/lib/Frontend/RewriteObjC.cpp +++ b/lib/Frontend/RewriteObjC.cpp @@ -1757,10 +1757,10 @@ Stmt *RewriteObjC::RewriteObjCTryStmt(ObjCAtTryStmt *S) { buf += "1) { "; ReplaceText(startLoc, lParenLoc-startBuf+1, buf.c_str(), buf.size()); sawIdTypedCatch = true; - } else if (const PointerType *pType = t->getAs<PointerType>()) { - ObjCInterfaceType *cls; // Should be a pointer to a class. - - cls = dyn_cast<ObjCInterfaceType>(pType->getPointeeType().getTypePtr()); + } else if (t->isObjCObjectPointerType()) { + QualType InterfaceTy = t->getPointeeType(); + const ObjCInterfaceType *cls = // Should be a pointer to a class. + InterfaceTy->getAs<ObjCInterfaceType>(); if (cls) { buf += "objc_exception_match((struct objc_class *)objc_getClass(\""; buf += cls->getDecl()->getNameAsString(); diff --git a/test/Rewriter/rewrite-eh.m b/test/Rewriter/rewrite-eh.m new file mode 100644 index 0000000000..5bc80b5509 --- /dev/null +++ b/test/Rewriter/rewrite-eh.m @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -rewrite-objc -o - %s +// rdar://7522880 + +@interface NSException +@end + +@interface Foo +@end + +@implementation Foo +- (void)bar { + @try { + } @catch (NSException *e) { + } + @catch (Foo *f) { + } + @catch (...) { + } +} +@end |