[cfe-commits] [PATCH] Smarter implicit copy-construction/copy-assignment.
Lang Hames
lhames at gmail.com
Fri Jan 11 19:05:22 PST 2013
At present, if a class contains any Non-POD members we perform element-wise
copies for each field when generating the implicit copy-constructor and
implicit copy-assignment operator (with an optimization for array members).
This patch changes this behavior - adjacent POD members will be memcpy'd,
with Non-POD members output as usual.
This is an initial implementation that I'd like to get in tree. Obvious
deficiencies are:
It punts entirely when LangOpts.getGC != None.
It doesn't handle inner classes/unions.
It doesn't attach any TBAA info, even when all members are the same type.
It isn't particularly smart about when it falls back on element-wise copies
(at the moment it emits a memcpy any time it finds more than one POD field).
These should all be easy to test and remedy once the code's in tree though.
Does anybody see any problems with this?
Style comments?
Feedback much appreciated.
- Lang.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130111/019fe137/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smarter-implicit-copies.patch
Type: application/octet-stream
Size: 17111 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130111/019fe137/attachment.obj>
More information about the cfe-commits
mailing list