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

Stephen Lin swlin at post.harvard.edu
Thu May 2 19:12:52 PDT 2013


> 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).



More information about the cfe-commits mailing list