[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:03:27 PDT 2013


On May 2, 2013, at 6:12 PM, Stephen Lin <swlin at post.harvard.edu> wrote:
>> CodeGenModule::ConstructAttributeList gets the Decl;  just have it
>> check for a ctor or dtor and ask the CXXABI whether that Decl
>> promises to return 'this'.
> 
> OK, turns out I can't call HasThisReturn directly because it needs a
> GlobalDecl rather than a Decl to determine the constructor or
> destructor type.

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.

John.



More information about the cfe-commits mailing list