r277923 - [ASTReader] Use real move semantics instead of emulating them in the copy ctor.

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 8 01:25:40 PDT 2016


The members are references, pointers and a bool. None of them requires
moving as they're trivially copyable. We actually have a clang-tidy
check to remove std::move in those cases.

On Mon, Aug 8, 2016 at 3:18 AM, Piotr Padlewski
<piotr.padlewski at gmail.com> wrote:
>
>
> 2016-08-06 5:45 GMT-07:00 Benjamin Kramer via cfe-commits
> <cfe-commits at lists.llvm.org>:
>>
>> Author: d0k
>> Date: Sat Aug  6 07:45:16 2016
>> New Revision: 277923
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=277923&view=rev
>> Log:
>> [ASTReader] Use real move semantics instead of emulating them in the copy
>> ctor.
>>
>> No functionality change intended.
>>
>> Modified:
>>     cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
>>
>> Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=277923&r1=277922&r2=277923&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
>> +++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Sat Aug  6 07:45:16 2016
>> @@ -170,12 +170,12 @@ namespace clang {
>>        ASTReader &Reader;
>>        NamedDecl *New;
>>        NamedDecl *Existing;
>> -      mutable bool AddResult;
>> +      bool AddResult;
>>
>>        unsigned AnonymousDeclNumber;
>>        IdentifierInfo *TypedefNameForLinkage;
>>
>> -      void operator=(FindExistingResult&) = delete;
>> +      void operator=(FindExistingResult &&) = delete;
>>
>>      public:
>>        FindExistingResult(ASTReader &Reader)
>> @@ -189,7 +189,7 @@ namespace clang {
>>              AnonymousDeclNumber(AnonymousDeclNumber),
>>              TypedefNameForLinkage(TypedefNameForLinkage) {}
>>
>> -      FindExistingResult(const FindExistingResult &Other)
>> +      FindExistingResult(FindExistingResult &&Other)
>>            : Reader(Other.Reader), New(Other.New),
>> Existing(Other.Existing),
>>              AddResult(Other.AddResult),
>>              AnonymousDeclNumber(Other.AnonymousDeclNumber),
>>
> Shouldn't these lines have std::move() everywhere to make them real move
> ctors?
>
>
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>


More information about the cfe-commits mailing list