[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 18:12:53 PDT 2013


> 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. So I implemented a solution that checks if the Decl
is a constructor or destructor and then checks the return type for
equality with the first parameter type, which only happens with 'this'
returns; this introduces some coupling between implementations but
it's refactored so the coupling is all in one file (CGCall.cpp) and
commented on both ends.

All LNT tests pass except
MultiSource/Benchmarks/Olden/voronoi/voronoi.execution_time, which has
been failing for me for awhile in trunk.

Let me know if this looks OK: I'm hoping to get this in for the 3.3 release.

-Stephen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: this-return1.patch
Type: application/octet-stream
Size: 16434 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130502/3cc4e0cb/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: this-return2.patch
Type: application/octet-stream
Size: 24898 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130502/3cc4e0cb/attachment-0001.obj>


More information about the cfe-commits mailing list