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

David Blaikie dblaikie at gmail.com
Sun Nov 25 10:17:20 PST 2012


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.

>
> -Chris
>
>>
>> Modified:
>>    llvm/trunk/include/llvm/Attributes.h
>>
>> Modified: llvm/trunk/include/llvm/Attributes.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Attributes.h?rev=168211&r1=168210&r2=168211&view=diff
>> ==============================================================================
>> --- llvm/trunk/include/llvm/Attributes.h (original)
>> +++ llvm/trunk/include/llvm/Attributes.h Fri Nov 16 16:22:20 2012
>> @@ -92,11 +92,6 @@
>>   Attributes(AttributesImpl *A) : Attrs(A) {}
>> public:
>>   Attributes() : Attrs(0) {}
>> -  Attributes(const Attributes &A) : Attrs(A.Attrs) {}
>> -  Attributes &operator=(const Attributes &A) {
>> -    Attrs = A.Attrs;
>> -    return *this;
>> -  }
>>
>>   /// get - Return a uniquified Attributes object. This takes the uniquified
>>   /// value from the Builder and wraps it in the Attributes class.
>> @@ -199,7 +194,6 @@
>>   AttrBuilder() : Bits(0) {}
>>   explicit AttrBuilder(uint64_t B) : Bits(B) {}
>>   AttrBuilder(const Attributes &A) : Bits(A.Raw()) {}
>> -  AttrBuilder(const AttrBuilder &B) : Bits(B.Bits) {}
>>
>>   void clear() { Bits = 0; }
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list