diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2011-06-22 20:21:51 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2011-06-22 20:21:51 +0000 |
commit | 9d96bce991048fd2337cf058ec6a6a722207cbf2 (patch) | |
tree | d27de93cfae46f202f68d40e9d9d00bfdde78c5c /lib/CodeGen/CGObjCMac.cpp | |
parent | 0d9106fc97cde979a995e26b18bcd2643f8afb55 (diff) |
Alloa catching Objective-C id's being thrown with C++ throw
in Darwin's fragile abi mode. // rdar://8940528
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133639 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjCMac.cpp')
-rw-r--r-- | lib/CodeGen/CGObjCMac.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index f98770071e..52dd520aa8 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -200,7 +200,7 @@ public: const llvm::Type *CacheTy; /// CachePtrTy - LLVM type for struct objc_cache *. const llvm::Type *CachePtrTy; - + llvm::Constant *getGetPropertyFn() { CodeGen::CodeGenTypes &Types = CGM.getTypes(); ASTContext &Ctx = CGM.getContext(); @@ -452,7 +452,7 @@ public: /// ExceptionDataTy - LLVM type for struct _objc_exception_data. const llvm::Type *ExceptionDataTy; - + /// ExceptionTryEnterFn - LLVM objc_exception_try_enter function. llvm::Constant *getExceptionTryEnterFn() { const llvm::Type *params[] = { ExceptionDataTy->getPointerTo() }; @@ -633,7 +633,7 @@ public: const llvm::StructType *EHTypeTy; const llvm::Type *EHTypePtrTy; - + ObjCNonFragileABITypesHelper(CodeGen::CodeGenModule &cgm); ~ObjCNonFragileABITypesHelper(){} }; @@ -1010,7 +1010,7 @@ public: virtual llvm::Value *GetSelector(CGBuilderTy &Builder, const ObjCMethodDecl *Method); - virtual llvm::Constant *GetEHType(QualType T); + virtual llvm::Constant *GetEHType(QualType T, const CodeGenFunction *CGF=0); virtual void GenerateCategory(const ObjCCategoryImplDecl *CMD); @@ -1271,7 +1271,7 @@ public: virtual llvm::Value *GenerateProtocolRef(CGBuilderTy &Builder, const ObjCProtocolDecl *PD); - virtual llvm::Constant *GetEHType(QualType T); + virtual llvm::Constant *GetEHType(QualType T, const CodeGenFunction *CGF=0); virtual llvm::Constant *GetPropertyGetFunction() { return ObjCTypes.getGetPropertyFn(); @@ -1414,7 +1414,12 @@ llvm::Value *CGObjCMac::GetSelector(CGBuilderTy &Builder, const ObjCMethodDecl return EmitSelector(Builder, Method->getSelector()); } -llvm::Constant *CGObjCMac::GetEHType(QualType T) { +llvm::Constant *CGObjCMac::GetEHType(QualType T, const CodeGenFunction *CGF) { + if (T->isObjCIdType() || + T->isObjCQualifiedIdType()) { + return CGM.GetAddrOfRTTIDescriptor( + CGF->getContext().ObjCIdRedefinitionType, /*ForEH=*/true); + } llvm_unreachable("asking for catch type for ObjC type in fragile runtime"); return 0; } @@ -4176,6 +4181,7 @@ ObjCCommonTypesHelper::ObjCCommonTypesHelper(CodeGen::CodeGenModule &cgm) CacheTy = llvm::OpaqueType::get(VMContext); CGM.getModule().addTypeName("struct._objc_cache", CacheTy); CachePtrTy = llvm::PointerType::getUnqual(CacheTy); + } ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm) @@ -4580,7 +4586,7 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModul // SuperMessageRefPtrTy - LLVM for struct _super_message_ref_t* SuperMessageRefPtrTy = llvm::PointerType::getUnqual(SuperMessageRefTy); - + // struct objc_typeinfo { // const void** vtable; // objc_ehtype_vtable + 2 @@ -6015,7 +6021,7 @@ CGObjCNonFragileABIMac::EmitSynchronizedStmt(CodeGen::CodeGenFunction &CGF, } llvm::Constant * -CGObjCNonFragileABIMac::GetEHType(QualType T) { +CGObjCNonFragileABIMac::GetEHType(QualType T, const CodeGenFunction *CGF) { // There's a particular fixed type info for 'id'. if (T->isObjCIdType() || T->isObjCQualifiedIdType()) { |