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

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 1 23:14:19 PDT 2016


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/20160601/5f81f372/attachment.html>


More information about the llvm-commits mailing list