[PATCH] D63161: Devirtualize destructor of final class.
Richard Smith - zygoloid via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 17 16:09:13 PDT 2019
rsmith added inline comments.
================
Comment at: lib/CodeGen/CGExprCXX.cpp:1887
+ Dtor = DevirtualizedDtor;
+ Ptr = CGF.EmitPointerWithAlignment(Inner);
+ } else {
----------------
yamauchi wrote:
> rsmith wrote:
> > In this case we'll emit the inner expression (including its side-effects) twice.
> >
> > The simplest thing to do would be to just drop this `else if` case for now and add a FIXME.
> I'd go with that. I assume there isn't a simple way to adjust the this pointer of a base class given a derived class? Sort of like CodeGenFunction::GetAddressOfDerivedClass?
>
I don't think we have anything quite like that. This won't be possible in the general case: there could be more than one base class of the current type within the derived class, so you'd need to take into account the path that the base expression took to reach the inner expression with the known dynamic type. (We could opportunistically do this in the common case where the derived class has only one base class of the base type, and it's a non-virtual base, but I don't think we have any existing code to do that either.)
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63161/new/
https://reviews.llvm.org/D63161
More information about the cfe-commits
mailing list