diff options
| author | Rumeet Dhindsa <rdhindsa@google.com> | 2019-06-25 22:58:25 +0000 |
|---|---|---|
| committer | Rumeet Dhindsa <rdhindsa@google.com> | 2019-06-25 22:58:25 +0000 |
| commit | 7b34212e8613fbf7a7c06ddc6f46bb80a4ee7f2c (patch) | |
| tree | 727296ed56b46e96e30c3d727dc4e7c695288fca /lib/CodeGen/CGExprCXX.cpp | |
| parent | d3f9eac03b57df52b2b096a70e38082c9e989c88 (diff) | |
| download | clang-7b34212e8613fbf7a7c06ddc6f46bb80a4ee7f2c.tar.gz | |
Revert Devirtualize destructor of final class.
This reverts r364100 (git commit 405c2b16225fc6eaf5eb8ba3ce584699a3b159ef)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364359 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprCXX.cpp')
| -rw-r--r-- | lib/CodeGen/CGExprCXX.cpp | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/lib/CodeGen/CGExprCXX.cpp b/lib/CodeGen/CGExprCXX.cpp index fdca769988..25b0abbc03 100644 --- a/lib/CodeGen/CGExprCXX.cpp +++ b/lib/CodeGen/CGExprCXX.cpp @@ -1865,33 +1865,9 @@ static void EmitObjectDelete(CodeGenFunction &CGF, Dtor = RD->getDestructor(); if (Dtor->isVirtual()) { - bool UseVirtualCall = true; - const Expr *Base = DE->getArgument(); - if (auto *DevirtualizedDtor = - dyn_cast_or_null<const CXXDestructorDecl>( - Dtor->getDevirtualizedMethod( - Base, CGF.CGM.getLangOpts().AppleKext))) { - UseVirtualCall = false; - const CXXRecordDecl *DevirtualizedClass = - DevirtualizedDtor->getParent(); - if (declaresSameEntity(getCXXRecord(Base), DevirtualizedClass)) { - // Devirtualized to the class of the base type (the type of the - // whole expression). - Dtor = DevirtualizedDtor; - } else { - // Devirtualized to some other type. Would need to cast the this - // pointer to that type but we don't have support for that yet, so - // do a virtual call. FIXME: handle the case where it is - // devirtualized to the derived type (the type of the inner - // expression) as in EmitCXXMemberOrOperatorMemberCallExpr. - UseVirtualCall = true; - } - } - if (UseVirtualCall) { - CGF.CGM.getCXXABI().emitVirtualObjectDelete(CGF, DE, Ptr, ElementType, - Dtor); - return; - } + CGF.CGM.getCXXABI().emitVirtualObjectDelete(CGF, DE, Ptr, ElementType, + Dtor); + return; } } } |
