diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2013-01-10 19:02:56 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2013-01-10 19:02:56 +0000 |
commit | 1eab052a7fb49194eb9a8d3c545975cccd3a1e1a (patch) | |
tree | abe14fd41ef4c34ae20a6e6834f3008e7450d2df /clang/lib/CodeGen/CGException.cpp | |
parent | f036f1a630943627e5bcd344ace9d7a7b617154d (diff) | |
download | bcm5719-llvm-1eab052a7fb49194eb9a8d3c545975cccd3a1e1a.tar.gz bcm5719-llvm-1eab052a7fb49194eb9a8d3c545975cccd3a1e1a.zip |
objectiveC++: When throwing c++ exception of
an objectiveC object, use objc_exception_throw
to raise the exception. // rdar://12605907
llvm-svn: 172091
Diffstat (limited to 'clang/lib/CodeGen/CGException.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGException.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGException.cpp b/clang/lib/CodeGen/CGException.cpp index 4d4f529f204..5797fd7578f 100644 --- a/clang/lib/CodeGen/CGException.cpp +++ b/clang/lib/CodeGen/CGException.cpp @@ -15,6 +15,7 @@ #include "CGCleanup.h" #include "CGObjCRuntime.h" #include "TargetInfo.h" +#include "clang/AST/StmtObjC.h" #include "clang/AST/StmtCXX.h" #include "llvm/IR/Intrinsics.h" #include "llvm/Support/CallSite.h" @@ -434,6 +435,17 @@ void CodeGenFunction::EmitCXXThrowExpr(const CXXThrowExpr *E) { QualType ThrowType = E->getSubExpr()->getType(); + if (ThrowType->isObjCObjectPointerType()) { + const Stmt *ThrowStmt = E->getSubExpr(); + const ObjCAtThrowStmt S(E->getExprLoc(), + const_cast<Stmt *>(ThrowStmt)); + CGM.getObjCRuntime().EmitThrowStmt(*this, S, false); + // This will clear insertion point which was not cleared in + // call to EmitThrowStmt. + EmitBlock(createBasicBlock("throw.cont")); + return; + } + // Now allocate the exception object. llvm::Type *SizeTy = ConvertType(getContext().getSizeType()); uint64_t TypeSize = getContext().getTypeSizeInChars(ThrowType).getQuantity(); |