[llvm] r271420 - [pdb] silence warnings about moving from a temporary.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 2 00:05:28 PDT 2016


Sorry, I'll make a better commit message next time.  Yes, it's tricky in
the face of a macro, but what I ultimately decided is that the user of the
macro is responsible for writing EXPECT_ERROR(std::move(E)) if he/she does
not have a temporary.

On Wed, Jun 1, 2016 at 11:14 PM David Blaikie <dblaikie at gmail.com> wrote:

> On Wed, Jun 1, 2016 at 11:18 AM, Zachary Turner via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>> Author: zturner
>> Date: Wed Jun  1 13:18:55 2016
>> New Revision: 271420
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=271420&view=rev
>> Log:
>> [pdb] silence warnings about moving from a temporary.
>>
>
> FWIW: When I read "silence warnings" I think the change involves
> suppressing the compiler warning without changing the semantics of the code
> - that makes me suspicious/go and look at the change to see if it's
> addressed the compiler warning or just worked around it. At least for me,
> I'd find "fix warnings about std::move of a temporary" to be a more
> apt/less interesting description of this change (& some other recent ones
> too)
>
> That said, this warning is tricky in the face of a macro - but I assume
> the only thing ever passed to the macro is a single expression with a
> result of error.
>
> Also, might want to put some ()s in there:
>
> auto E = (Err);
>
> Just in case anyone does anything weird... (comma operator, etc)
>
>
>>
>> Modified:
>>     llvm/trunk/unittests/DebugInfo/PDB/MappedBlockStreamTest.cpp
>>
>> Modified: llvm/trunk/unittests/DebugInfo/PDB/MappedBlockStreamTest.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/DebugInfo/PDB/MappedBlockStreamTest.cpp?rev=271420&r1=271419&r2=271420&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/unittests/DebugInfo/PDB/MappedBlockStreamTest.cpp
>> (original)
>> +++ llvm/trunk/unittests/DebugInfo/PDB/MappedBlockStreamTest.cpp Wed Jun
>> 1 13:18:55 2016
>> @@ -23,7 +23,7 @@ namespace {
>>
>>  #define EXPECT_NO_ERROR(Err)
>>        \
>>    {
>>       \
>> -    auto E = std::move(Err);
>>        \
>> +    auto E = Err;
>>       \
>>      EXPECT_FALSE(static_cast<bool>(E));
>>       \
>>      if (E)
>>        \
>>        consumeError(std::move(E));
>>       \
>> @@ -31,7 +31,7 @@ namespace {
>>
>>  #define EXPECT_ERROR(Err)
>>       \
>>    {
>>       \
>> -    auto E = std::move(Err);
>>        \
>> +    auto E = Err;
>>       \
>>      EXPECT_TRUE(static_cast<bool>(E));
>>        \
>>      if (E)
>>        \
>>        consumeError(std::move(E));
>>       \
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160602/9950f055/attachment.html>


More information about the llvm-commits mailing list