<div dir="ltr">Sorry for not including the reason, I discussed offline with the author to temporarily revert this patch.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 25, 2019 at 4:00 PM Roman Lebedev <<a href="mailto:lebedev.ri@gmail.com" target="_blank">lebedev.ri@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Wed, Jun 26, 2019 at 1:58 AM Rumeet Dhindsa via cfe-commits<br>
<<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>> wrote:<br>
><br>
> Author: rdhindsa<br>
> Date: Tue Jun 25 15:58:25 2019<br>
> New Revision: 364359<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=364359&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=364359&view=rev</a><br>
> Log:<br>
> Revert Devirtualize destructor of final class.<br>
><br>
> This reverts r364100 (git commit 405c2b16225fc6eaf5eb8ba3ce584699a3b159ef)<br>
It is usually customary to specify the reason of the revert in the<br>
commit message.<br>
<br>
> Removed:<br>
>     cfe/trunk/test/CodeGenCXX/devirtualize-dtor-final.cpp<br>
> Modified:<br>
>     cfe/trunk/lib/CodeGen/CGExprCXX.cpp<br>
><br>
> Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=364359&r1=364358&r2=364359&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=364359&r1=364358&r2=364359&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)<br>
> +++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Tue Jun 25 15:58:25 2019<br>
> @@ -1865,33 +1865,9 @@ static void EmitObjectDelete(CodeGenFunc<br>
>        Dtor = RD->getDestructor();<br>
><br>
>        if (Dtor->isVirtual()) {<br>
> -        bool UseVirtualCall = true;<br>
> -        const Expr *Base = DE->getArgument();<br>
> -        if (auto *DevirtualizedDtor =<br>
> -                dyn_cast_or_null<const CXXDestructorDecl>(<br>
> -                    Dtor->getDevirtualizedMethod(<br>
> -                        Base, CGF.CGM.getLangOpts().AppleKext))) {<br>
> -          UseVirtualCall = false;<br>
> -          const CXXRecordDecl *DevirtualizedClass =<br>
> -              DevirtualizedDtor->getParent();<br>
> -          if (declaresSameEntity(getCXXRecord(Base), DevirtualizedClass)) {<br>
> -            // Devirtualized to the class of the base type (the type of the<br>
> -            // whole expression).<br>
> -            Dtor = DevirtualizedDtor;<br>
> -          } else {<br>
> -            // Devirtualized to some other type. Would need to cast the this<br>
> -            // pointer to that type but we don't have support for that yet, so<br>
> -            // do a virtual call. FIXME: handle the case where it is<br>
> -            // devirtualized to the derived type (the type of the inner<br>
> -            // expression) as in EmitCXXMemberOrOperatorMemberCallExpr.<br>
> -            UseVirtualCall = true;<br>
> -          }<br>
> -        }<br>
> -        if (UseVirtualCall) {<br>
> -          CGF.CGM.getCXXABI().emitVirtualObjectDelete(CGF, DE, Ptr, ElementType,<br>
> -                                                      Dtor);<br>
> -          return;<br>
> -        }<br>
> +        CGF.CGM.getCXXABI().emitVirtualObjectDelete(CGF, DE, Ptr, ElementType,<br>
> +                                                    Dtor);<br>
> +        return;<br>
>        }<br>
>      }<br>
>    }<br>
><br>
> Removed: cfe/trunk/test/CodeGenCXX/devirtualize-dtor-final.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/devirtualize-dtor-final.cpp?rev=364358&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/devirtualize-dtor-final.cpp?rev=364358&view=auto</a><br>
> ==============================================================================<br>
> --- cfe/trunk/test/CodeGenCXX/devirtualize-dtor-final.cpp (original)<br>
> +++ cfe/trunk/test/CodeGenCXX/devirtualize-dtor-final.cpp (removed)<br>
> @@ -1,23 +0,0 @@<br>
> -// RUN: %clang_cc1 -triple i386-unknown-unknown -std=c++11 %s -emit-llvm -o - | FileCheck %s<br>
> -<br>
> -namespace Test1 {<br>
> -  struct A { virtual ~A() {} };<br>
> -  struct B final : A {};<br>
> -  struct C : A { virtual ~C() final {} };<br>
> -  struct D { virtual ~D() final = 0; };<br>
> -  // CHECK-LABEL: define void @_ZN5Test13fooEPNS_1BE<br>
> -  void foo(B *b) {<br>
> -    // CHECK: call void @_ZN5Test11BD1Ev<br>
> -    delete b;<br>
> -  }<br>
> -  // CHECK-LABEL: define void @_ZN5Test14foo2EPNS_1CE<br>
> -  void foo2(C *c) {<br>
> -    // CHECK: call void @_ZN5Test11CD1Ev<br>
> -    delete c;<br>
> -  }<br>
> -  // CHECK-LABEL: define void @_ZN5Test14evilEPNS_1DE<br>
> -  void evil(D *p) {<br>
> -    // CHECK-NOT: call void @_ZN5Test11DD1Ev<br>
> -    delete p;<br>
> -  }<br>
> -}<br>
><br>
><br>
> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div>