aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2011-06-23 19:00:08 +0000
committerFariborz Jahanian <fjahanian@apple.com>2011-06-23 19:00:08 +0000
commitcf5abc7ba032bd35158e4d75b0bc92a482fc67e8 (patch)
tree84687f1541301b30a527f804d1367dca86f61580 /lib/CodeGen
parentb9b4b789ebd28d6fde1c42de820b036ffaf95162 (diff)
Support for catching objc pointer objects in c++ catch-statement
in fragile abi mode and some other cleanups. // rdar://8940528 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133747 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/CGException.cpp2
-rw-r--r--lib/CodeGen/CGObjCGNU.cpp4
-rw-r--r--lib/CodeGen/CGObjCMac.cpp18
-rw-r--r--lib/CodeGen/CGObjCRuntime.h3
4 files changed, 17 insertions, 10 deletions
diff --git a/lib/CodeGen/CGException.cpp b/lib/CodeGen/CGException.cpp
index 79a730eb7e..1a4a5f988a 100644
--- a/lib/CodeGen/CGException.cpp
+++ b/lib/CodeGen/CGException.cpp
@@ -521,7 +521,7 @@ void CodeGenFunction::EnterCXXTryStmt(const CXXTryStmt &S, bool IsFnTryBlock) {
llvm::Value *TypeInfo = 0;
if (CaughtType->isObjCObjectPointerType())
- TypeInfo = CGM.getObjCRuntime().GetEHType(CaughtType, this);
+ TypeInfo = CGM.getObjCRuntime().GetEHType(CaughtType);
else
TypeInfo = CGM.GetAddrOfRTTIDescriptor(CaughtType, /*ForEH=*/true);
CatchScope->setHandler(I, TypeInfo, Handler);
diff --git a/lib/CodeGen/CGObjCGNU.cpp b/lib/CodeGen/CGObjCGNU.cpp
index ed194d9c91..6a711bff55 100644
--- a/lib/CodeGen/CGObjCGNU.cpp
+++ b/lib/CodeGen/CGObjCGNU.cpp
@@ -438,7 +438,7 @@ public:
bool lval = false);
virtual llvm::Value *GetSelector(CGBuilderTy &Builder, const ObjCMethodDecl
*Method);
- virtual llvm::Constant *GetEHType(QualType T, const CodeGenFunction *CGF=0);
+ virtual llvm::Constant *GetEHType(QualType T);
virtual llvm::Function *GenerateMethod(const ObjCMethodDecl *OMD,
const ObjCContainerDecl *CD);
@@ -832,7 +832,7 @@ llvm::Value *CGObjCGNU::GetSelector(CGBuilderTy &Builder, const ObjCMethodDecl
return GetSelector(Builder, Method->getSelector(), SelTypes, false);
}
-llvm::Constant *CGObjCGNU::GetEHType(QualType T, const CodeGenFunction *CGF) {
+llvm::Constant *CGObjCGNU::GetEHType(QualType T) {
if (!CGM.getLangOptions().CPlusPlus) {
if (T->isObjCIdType()
|| T->isObjCQualifiedIdType()) {
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index 52dd520aa8..d518372f9c 100644
--- a/lib/CodeGen/CGObjCMac.cpp
+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -1010,7 +1010,7 @@ public:
virtual llvm::Value *GetSelector(CGBuilderTy &Builder,
const ObjCMethodDecl *Method);
- virtual llvm::Constant *GetEHType(QualType T, const CodeGenFunction *CGF=0);
+ virtual llvm::Constant *GetEHType(QualType T);
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, const CodeGenFunction *CGF=0);
+ virtual llvm::Constant *GetEHType(QualType T);
virtual llvm::Constant *GetPropertyGetFunction() {
return ObjCTypes.getGetPropertyFn();
@@ -1414,12 +1414,20 @@ llvm::Value *CGObjCMac::GetSelector(CGBuilderTy &Builder, const ObjCMethodDecl
return EmitSelector(Builder, Method->getSelector());
}
-llvm::Constant *CGObjCMac::GetEHType(QualType T, const CodeGenFunction *CGF) {
+llvm::Constant *CGObjCMac::GetEHType(QualType T) {
if (T->isObjCIdType() ||
T->isObjCQualifiedIdType()) {
return CGM.GetAddrOfRTTIDescriptor(
- CGF->getContext().ObjCIdRedefinitionType, /*ForEH=*/true);
+ CGM.getContext().ObjCIdRedefinitionType, /*ForEH=*/true);
}
+ if (T->isObjCClassType() ||
+ T->isObjCQualifiedClassType()) {
+ return CGM.GetAddrOfRTTIDescriptor(
+ CGM.getContext().ObjCClassRedefinitionType, /*ForEH=*/true);
+ }
+ if (T->isObjCObjectPointerType())
+ return CGM.GetAddrOfRTTIDescriptor(T, /*ForEH=*/true);
+
llvm_unreachable("asking for catch type for ObjC type in fragile runtime");
return 0;
}
@@ -6021,7 +6029,7 @@ CGObjCNonFragileABIMac::EmitSynchronizedStmt(CodeGen::CodeGenFunction &CGF,
}
llvm::Constant *
-CGObjCNonFragileABIMac::GetEHType(QualType T, const CodeGenFunction *CGF) {
+CGObjCNonFragileABIMac::GetEHType(QualType T) {
// There's a particular fixed type info for 'id'.
if (T->isObjCIdType() ||
T->isObjCQualifiedIdType()) {
diff --git a/lib/CodeGen/CGObjCRuntime.h b/lib/CodeGen/CGObjCRuntime.h
index 510143f767..7accc70c96 100644
--- a/lib/CodeGen/CGObjCRuntime.h
+++ b/lib/CodeGen/CGObjCRuntime.h
@@ -128,8 +128,7 @@ public:
/// This is used externally to implement catching ObjC types in C++.
/// Runtimes which don't support this should add the appropriate
/// error to Sema.
- virtual llvm::Constant *GetEHType(QualType T,
- const CodeGenFunction *CGF=0) = 0;
+ virtual llvm::Constant *GetEHType(QualType T) = 0;
/// Generate a constant string object.
virtual llvm::Constant *GenerateConstantString(const StringLiteral *) = 0;