[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:55:47 PDT 2013


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

I was actually just going to have arrangeCXXConstructorDeclaration
prepopulate ResTy based on HasThisReturn, since it's already
prepopulating 'this'...

But (and I might be wrong, apologizes for my unfamiliarity with the
code) it actually doesn't seem that easy to convert
ConstructAttributeList to take a GlobalDecl with the appropriate
constructor/destructor type, since ConstructAttributeList is called by
EmitCall, which doesn't directly have the information either, and (I
believe) the parameter needs to be on the call site in case the
constructor is defined in a different TU?

Is there anything wrong with just checking the return type instead as
I did in my revised patch? It's some coupling since it assumes the
semantics of a constructor/destructor return value based on its type,
but it seems to be a very justifiable assumption even for any future
C++ ABI, and the assumption is documented.

Thanks,
Stephen



More information about the cfe-commits mailing list