[llvm-commits] [llvm] r168211 - /llvm/trunk/include/llvm/Attributes.h

David Blaikie dblaikie at gmail.com
Mon Nov 26 16:42:19 PST 2012


On Mon, Nov 26, 2012 at 4:36 PM, Chris Lattner <clattner at apple.com> wrote:
>
> On Nov 25, 2012, at 10:17 AM, David Blaikie <dblaikie at gmail.com> wrote:
>
>> On Sun, Nov 25, 2012 at 9:06 AM, Chris Lattner <clattner at apple.com> wrote:
>>>
>>> On Nov 16, 2012, at 2:22 PM, Benjamin Kramer <benny.kra at googlemail.com> wrote:
>>>
>>>> Author: d0k
>>>> Date: Fri Nov 16 16:22:20 2012
>>>> New Revision: 168211
>>>>
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=168211&view=rev
>>>> Log:
>>>> Remove default public copy ctors.
>>>>
>>>> They are just useless and prevent SmallVector from picking an optimized codepath
>>>> for memcpyable elements.
>>>
>>> Is this something that Clang could conceivably warn about?
>>
>> +1 (generalized to all special member functions that can be provided
>> implicitly, possibly with a fixit/text to suggest removal and/or a
>> fixit to suggest "= default" (under C++11))
>>
>> It's perhaps a little on the "stylistic" end, though we could restrict
>> it to cases where the explicit definition disables move operations
>> only (to get the meatier/important cases). Separate version for when
>> this explicit definition causes a type to become
>> non-standard-layout/pod/trivial/etc or other useful traits.
>
> I think that most useful version would be to only warn about types with copy constructors that are actually *used* in a type trait checking for triviality, to avoid massive spam in codebases where it wouldn't help anyway (e.g. building with an old libstdc++).  David, can you file a PR to track this if you think it would be useful? :)

PR14441

Thanks,
- David




More information about the llvm-commits mailing list