From: John McCall Date: Thu, 16 Jun 2011 23:24:51 +0000 (+0000) Subject: Be sure to try a final ARC-production even in Objective-C++. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=856d3798af7c2f7251e4a295f3da7a09ce4c62ab;p=clang Be sure to try a final ARC-production even in Objective-C++. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133215 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index 77932151c1..5bdadc6166 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -3544,6 +3544,8 @@ InitializationSequence::InitializationSequence(Sema &S, SetFailed(InitializationSequence::FK_ConversionFailed); } else { AddConversionSequenceStep(ICS, Entity.getType()); + + MaybeProduceObjCObject(S, *this, Entity); } } diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index 18e5f7e3a4..a5ad0a5a2b 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -1787,7 +1787,7 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { // overlap restriction of subclause 6.5.16.1 does not apply to the case of // function return. - // In C++ the return statement is handled via a copy initialization. + // In C++ the return statement is handled via a copy initialization, // the C version of which boils down to CheckSingleAssignmentConstraints. NRVOCandidate = getCopyElisionCandidate(FnRetType, RetValExp, false); InitializedEntity Entity = InitializedEntity::InitializeResult(ReturnLoc, diff --git a/test/CodeGenObjCXX/arc.mm b/test/CodeGenObjCXX/arc.mm index 5d46a818cf..43098553aa 100644 --- a/test/CodeGenObjCXX/arc.mm +++ b/test/CodeGenObjCXX/arc.mm @@ -150,3 +150,13 @@ void test35b(Test35_Helper x0, Test35_Helper *x0p) { // CHECK: call void @objc_release // CHECK-NEXT: ret void } + +// rdar://problem/9603128 +// CHECK: define i8* @_Z6test36P11objc_object( +id test36(id z) { + // CHECK: objc_retain + // CHECK: objc_retain + // CHECK: objc_release + // CHECK: objc_autoreleaseReturnValue + return z; +}