diff options
author | John McCall <rjmccall@apple.com> | 2010-07-24 00:37:23 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-07-24 00:37:23 +0000 |
commit | 2ca705eb134f236f71a236ff6ea5b1772cdde5d7 (patch) | |
tree | 342d89e218a49ab8fbc767ba0fe915a7430762eb /clang/lib/CodeGen/CGException.cpp | |
parent | 72cdffa401698cccd63279718109c5fbf4e8a689 (diff) | |
download | bcm5719-llvm-2ca705eb134f236f71a236ff6ea5b1772cdde5d7.tar.gz bcm5719-llvm-2ca705eb134f236f71a236ff6ea5b1772cdde5d7.zip |
Support catching Objective C pointers in C++ under the non-fragile NeXT runtime.
Diagnose attempts to do this under the GNU or fragile NeXT runtimes.
llvm-svn: 109298
Diffstat (limited to 'clang/lib/CodeGen/CGException.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGException.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGException.cpp b/clang/lib/CodeGen/CGException.cpp index d31cab51949..99105e165f3 100644 --- a/clang/lib/CodeGen/CGException.cpp +++ b/clang/lib/CodeGen/CGException.cpp @@ -16,6 +16,7 @@ #include "llvm/Intrinsics.h" #include "llvm/Support/CallSite.h" +#include "CGObjCRuntime.h" #include "CodeGenFunction.h" #include "CGException.h" #include "TargetInfo.h" @@ -617,7 +618,12 @@ void CodeGenFunction::EnterCXXTryStmt(const CXXTryStmt &S, bool IsFnTryBlock) { // http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#388 QualType CaughtType = C->getCaughtType(); CaughtType = CaughtType.getNonReferenceType().getUnqualifiedType(); - llvm::Value *TypeInfo = CGM.GetAddrOfRTTIDescriptor(CaughtType, true); + + llvm::Value *TypeInfo = 0; + if (CaughtType->isObjCObjectPointerType()) + TypeInfo = CGM.getObjCRuntime().GetEHType(CaughtType); + else + TypeInfo = CGM.GetAddrOfRTTIDescriptor(CaughtType, true); CatchScope->setHandler(I, TypeInfo, Handler); } else { // No exception decl indicates '...', a catch-all. |