diff options
| author | Stephen Lin <stephenwlin@gmail.com> | 2013-06-19 18:10:35 +0000 |
|---|---|---|
| committer | Stephen Lin <stephenwlin@gmail.com> | 2013-06-19 18:10:35 +0000 |
| commit | 4444dbbb96ba55ff8a05a1918627f609a387db9f (patch) | |
| tree | 1eca5e8f7492bfa88ef404cf19b68a6ad83e4608 /lib/CodeGen/CGExprCXX.cpp | |
| parent | 2d588b4bc7127adf1a1c621002dfe452a99fef6f (diff) | |
| download | clang-4444dbbb96ba55ff8a05a1918627f609a387db9f.tar.gz clang-4444dbbb96ba55ff8a05a1918627f609a387db9f.tar.bz2 clang-4444dbbb96ba55ff8a05a1918627f609a387db9f.tar.xz | |
Corrections to r184205 ('this'-return optimization) due to the wrong version of the patch being committed originally.
1) Removed useless return value of CGCXXABI::EmitConstructorCall and CGCXXABI::EmitVirtualDestructorCall and implementations
2) Corrected last portion of CodeGenCXX/constructor-destructor-return-this to correctly test for non-'this'-return of virtual destructor calls
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184330 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprCXX.cpp')
| -rw-r--r-- | lib/CodeGen/CGExprCXX.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/lib/CodeGen/CGExprCXX.cpp b/lib/CodeGen/CGExprCXX.cpp index 60a70f8e07..438657ae22 100644 --- a/lib/CodeGen/CGExprCXX.cpp +++ b/lib/CodeGen/CGExprCXX.cpp @@ -280,16 +280,15 @@ RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE, // We also don't emit a virtual call if the base expression has a record type // because then we know what the type is. bool UseVirtualCall = CanUseVirtualCall && !DevirtualizedMethod; - llvm::Value *Callee; + if (const CXXDestructorDecl *Dtor = dyn_cast<CXXDestructorDecl>(MD)) { + assert(CE->arg_begin() == CE->arg_end() && + "Destructor shouldn't have explicit parameters"); + assert(ReturnValue.isNull() && "Destructor shouldn't have return value"); if (UseVirtualCall) { - assert(CE->arg_begin() == CE->arg_end() && - "Virtual destructor shouldn't have explicit parameters"); - return CGM.getCXXABI().EmitVirtualDestructorCall(*this, Dtor, - Dtor_Complete, - CE->getExprLoc(), - ReturnValue, This); + CGM.getCXXABI().EmitVirtualDestructorCall(*this, Dtor, Dtor_Complete, + CE->getExprLoc(), This); } else { if (getLangOpts().AppleKext && MD->isVirtual() && @@ -302,12 +301,16 @@ RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE, cast<CXXDestructorDecl>(DevirtualizedMethod); Callee = CGM.GetAddrOfFunction(GlobalDecl(DDtor, Dtor_Complete), Ty); } + EmitCXXMemberCall(MD, CE->getExprLoc(), Callee, ReturnValue, This, + /*ImplicitParam=*/0, QualType(), 0, 0); } - } else if (const CXXConstructorDecl *Ctor = - dyn_cast<CXXConstructorDecl>(MD)) { + return RValue::get(0); + } + + if (const CXXConstructorDecl *Ctor = dyn_cast<CXXConstructorDecl>(MD)) { Callee = CGM.GetAddrOfFunction(GlobalDecl(Ctor, Ctor_Complete), Ty); } else if (UseVirtualCall) { - Callee = BuildVirtualCall(MD, This, Ty); + Callee = BuildVirtualCall(MD, This, Ty); } else { if (getLangOpts().AppleKext && MD->isVirtual() && @@ -1413,8 +1416,7 @@ static void EmitObjectDelete(CodeGenFunction &CGF, // FIXME: Provide a source location here. CXXDtorType DtorType = UseGlobalDelete ? Dtor_Complete : Dtor_Deleting; CGF.CGM.getCXXABI().EmitVirtualDestructorCall(CGF, Dtor, DtorType, - SourceLocation(), - ReturnValueSlot(), Ptr); + SourceLocation(), Ptr); if (UseGlobalDelete) { CGF.PopCleanupBlock(); |
