[Bitstream] Remove pessimizing move
authorJan Svoboda <jan_svoboda@apple.com>
Wed, 16 Feb 2022 07:19:06 +0000 (08:19 +0100)
committerJan Svoboda <git@jansvoboda.dev>
Wed, 16 Feb 2022 07:23:02 +0000 (08:23 +0100)
Commit 4a794d848ce81f41c6e23a4d3d3f70c2d7d1baa4 caused build failure with -Werror -Wpessimizing-move on the clang-ppc64-aix buildbot. This patch applies Clang's suggestion to remove `std::move`.

llvm/lib/Bitstream/Reader/BitstreamReader.cpp

index ac674e8..c297e16 100644 (file)
@@ -220,9 +220,9 @@ Expected<unsigned> BitstreamCursor::readRecord(unsigned AbbrevID,
     uint32_t Code = MaybeCode.get();
     Expected<uint32_t> MaybeNumElts = ReadVBR(6);
     if (!MaybeNumElts)
-      return error(("Failed to read size: " +
-                    toString(std::move(MaybeNumElts.takeError())))
-                       .c_str());
+      return error(
+          ("Failed to read size: " + toString(MaybeNumElts.takeError()))
+              .c_str());
     uint32_t NumElts = MaybeNumElts.get();
     if (!isSizePlausible(NumElts))
       return error("Size is not plausible");
@@ -277,9 +277,9 @@ Expected<unsigned> BitstreamCursor::readRecord(unsigned AbbrevID,
       // Array case.  Read the number of elements as a vbr6.
       Expected<uint32_t> MaybeNumElts = ReadVBR(6);
       if (!MaybeNumElts)
-        return error(("Failed to read size: " +
-                      toString(std::move(MaybeNumElts.takeError())))
-                         .c_str());
+        return error(
+            ("Failed to read size: " + toString(MaybeNumElts.takeError()))
+                .c_str());
       uint32_t NumElts = MaybeNumElts.get();
       if (!isSizePlausible(NumElts))
         return error("Size is not plausible");