[PATCH] [ms-cxxabi] Remove hack from GetAddrOfCXXDestructor for complete dtors

Reid Kleckner rnk at google.com
Thu Oct 10 09:38:53 PDT 2013


-  // classes with no virtual bases, so try to emit it as an alias.
-  if (dtorType == Dtor_Complete &&
-      !dtor->getParent()->getNumVBases() &&
-      !TryEmitDefinitionAsAlias(GlobalDecl(dtor, Dtor_Complete),
-                                GlobalDecl(dtor, Dtor_Base)))
+  // classes with no virtual bases, so try to emit it as an alias or just
skip
+  // entirely if the ABI doesn't need it.
+  if (dtorType == Dtor_Complete && dtor->getParent()->getNumVBases() == 0
&&
+      (getCXXABI().useThunkForDtorVariant(dtor, Dtor_Complete) ||
+       !TryEmitDefinitionAsAlias(GlobalDecl(dtor, Dtor_Complete),
+                                 GlobalDecl(dtor, Dtor_Base))))

One thing that worries me about this is, how do we guarantee that Dtor_Base
gets emitted?


On Thu, Oct 10, 2013 at 9:27 AM, Timur Iskhodzhanov <timurrrr at google.com>wrote:

> I think supporting destructor aliases for classes that have just one
> destructor is a wrong thing to do.
>
> Please take a look at my alternative patch?
>
> 2013/10/9 Reid Kleckner <rnk at google.com>:
> > Hi timurrrr,
> >
> > Now that -mconstructor-aliases works for linkonce functions, we should
> > use aliases instead.  This makes our code less consistent with MSVC's
> > code, but that was never really a goal.
> >
> > http://llvm-reviews.chandlerc.com/D1872
> >
> > Files:
> >   lib/CodeGen/CGCXX.cpp
> >   test/CodeGenCXX/microsoft-abi-exceptions.cpp
> >   test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp
> >   test/CodeGenCXX/microsoft-abi-static-initializers.cpp
> >   test/CodeGenCXX/microsoft-abi-structors.cpp
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131010/2e62c93b/attachment.html>


More information about the cfe-commits mailing list