diff options
author | John McCall <rjmccall@apple.com> | 2012-07-31 00:33:55 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2012-07-31 00:33:55 +0000 |
commit | ff755cda9c624dd807360bf09717e808dff1665a (patch) | |
tree | 5437d89ad07c58aaebc845c968dc2605628fbf88 /clang/lib/CodeGen | |
parent | 9d192e1a900de29419c78674e80e514398cba936 (diff) | |
download | bcm5719-llvm-ff755cda9c624dd807360bf09717e808dff1665a.tar.gz bcm5719-llvm-ff755cda9c624dd807360bf09717e808dff1665a.zip |
Don't crash *or* insert a bogus autorelease when emitting a
this-adjustment thunk in ARC++.
llvm-svn: 161014
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGCall.cpp | 3 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGVTables.cpp | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 37a9a5eaff0..9deec19bf80 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -1405,7 +1405,8 @@ static llvm::Value *tryEmitFusedAutoreleaseOfResult(CodeGenFunction &CGF, static llvm::Value *tryRemoveRetainOfSelf(CodeGenFunction &CGF, llvm::Value *result) { // This is only applicable to a method with an immutable 'self'. - const ObjCMethodDecl *method = dyn_cast<ObjCMethodDecl>(CGF.CurCodeDecl); + const ObjCMethodDecl *method = + dyn_cast_or_null<ObjCMethodDecl>(CGF.CurCodeDecl); if (!method) return 0; const VarDecl *self = method->getSelfDecl(); if (!self->getType().isConstQualified()) return 0; diff --git a/clang/lib/CodeGen/CGVTables.cpp b/clang/lib/CodeGen/CGVTables.cpp index 3c0dd5d56b5..cdaa26a2bad 100644 --- a/clang/lib/CodeGen/CGVTables.cpp +++ b/clang/lib/CodeGen/CGVTables.cpp @@ -387,6 +387,9 @@ void CodeGenFunction::GenerateThunk(llvm::Function *Fn, if (!ResultType->isVoidType() && Slot.isNull()) CGM.getCXXABI().EmitReturnFromThunk(*this, RV, ResultType); + // Disable the final ARC autorelease. + AutoreleaseResult = false; + FinishFunction(); // Set the right linkage. |