[PATCH] Have 'this'-returning constructors and destructors to take advantage of the new backend 'returned' attribute

John McCall rjmccall at apple.com
Thu May 2 19:28:00 PDT 2013


On May 2, 2013, at 7:12 PM, Stephen Lin <swlin at post.harvard.edu> wrote:
>> That seems extremely fixable.  There are not very many callers of this,
>> and the major ones already derive the Decl* from a GlobalDecl.
>> For SetInternalFunctionAttributes, you can just wrap the Decl* back
>> up;  it should never be working with a ctor or dtor.
> 
> Oh ok, thanks, I can do that instead. Minor issue would be that
> arrangeCXXConstructorDeclaration calls
> CGCXXABI::BuildConstructorSignature (and similarly for
> arrangeCXXDestructor), which sets the return type to the type of
> 'this', but ConstructAttributeList would then call
> CGCXXABI::HasThisReturn to determine if there's a 'this' return, so
> there'd be an implicit assumption that the two implementations are
> consistent with each other, whereas in the version I just posted
> ultimately gets the information for both from
> CGCXXABI::BuildConstructorSignature. If you're OK with that I'll go
> with that (with an assert as a consistency sanity check).


It would be reasonable to change ItaniumCXXABI's
BuildConstructorSignature to call HasThisReturn instead of relying
on overrides.

John.



More information about the cfe-commits mailing list