Fix a bunch of -Wpessimizing-move issues.
authorPete Cooper <peter_cooper@apple.com>
Thu, 31 Mar 2016 00:35:50 +0000 (00:35 +0000)
committerPete Cooper <peter_cooper@apple.com>
Thu, 31 Mar 2016 00:35:50 +0000 (00:35 +0000)
Thanks to Rui for pointing out this warning was firing.

llvm-svn: 264977

lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
lld/lib/ReaderWriter/MachO/WriterMachO.cpp

index 0ec7a40..5eb5924 100644 (file)
@@ -779,7 +779,7 @@ llvm::Error MachOFileLayout::writeLoadCommands() {
     // Object files have one unnamed segment which holds all sections.
     if (_is64) {
      if (auto ec = writeSingleSegmentLoadCommand<MachO64Trait>(lc))
-       return std::move(ec);
+       return ec;
     } else {
       if (auto ec = writeSingleSegmentLoadCommand<MachO32Trait>(lc))
         return std::move(ec);
index e419739..fc760a3 100644 (file)
@@ -1177,7 +1177,7 @@ normalizedObjectToAtoms(MachOFile *file,
       continue;
     if (llvm::Error ec = convertRelocs(sect, normalizedFile, scatterable,
                                        *file, *handler))
-      return std::move(ec);
+      return ec;
   }
 
   // Add additional arch-specific References
index 972f987..f08487f 100644 (file)
@@ -33,13 +33,13 @@ public:
     llvm::Expected<std::unique_ptr<NormalizedFile>> nFile =
         normalized::normalizedFromAtoms(file, _ctx);
     if (auto ec = nFile.takeError())
-      return std::move(ec);
+      return ec;
 
     // For testing, write out yaml form of normalized file.
     if (_ctx.printAtoms()) {
       std::unique_ptr<Writer> yamlWriter = createWriterYAML(_ctx);
       if (auto ec = yamlWriter->writeFile(file, "-"))
-        return std::move(ec);
+        return ec;
     }
 
     // Write normalized file as mach-o binary.