[patch] Make emitCXXStructor an CGCXXABI method
Reid Kleckner
rnk at google.com
Mon Sep 15 10:42:36 PDT 2014
First patch looks good.
Any reason not to attempt to add more simplifications to the second patch?
We have duplicate code like this:
+ if (!CGM.getTarget().getCXXABI().hasConstructorVariants()) {
This is always true in Itanium and always false in Microsoft.
+ // If there are no constructor variants, always emit the complete
+ // destructor.
+ ctorType = StructorType::Complete;
+ } else if (!ctor->getParent()->getNumVBases() &&
+ (ctorType == StructorType::Complete ||
+ ctorType == StructorType::Base)) {
+ // The complete constructor is equivalent to the base constructor
+ // for classes with no virtual bases. Try to emit it as an alias.
+ bool ProducedAlias = !CGM.TryEmitDefinitionAsAlias(
+ GlobalDecl(ctor, Ctor_Complete), GlobalDecl(ctor, Ctor_Base),
true);
+ if (ctorType == StructorType::Complete && ProducedAlias)
+ return;
+ }
On Thu, Sep 11, 2014 at 9:54 AM, Rafael EspĂndola <
rafael.espindola at gmail.com> wrote:
> The first attached patch creates a emitCXXStructor function and makes
> the existing emitCXXConstructor and emitCXXDestructor static helpers.
>
> The next patch makes it be a method of CGCXXABI. For now with
> identical implementations in Itanium and Microsoft.
>
> The objective is that in subsequent patches we can
>
> * Simplify each implementation a bit.
> * Change the Itanium one to use comdats being sure the Microsoft one
> is not changed.
>
> Cheers,
> Rafael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140915/0f014d5c/attachment.html>
More information about the cfe-commits
mailing list