[llvm] c55cf4a - Revert "Remove redundant "std::move"s in return statements"
Bill Wendling via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 10 07:07:56 PST 2020
Author: Bill Wendling
Date: 2020-02-10T07:07:40-08:00
New Revision: c55cf4afa9161bb4413b7ca9933d553327f5f069
URL: https://github.com/llvm/llvm-project/commit/c55cf4afa9161bb4413b7ca9933d553327f5f069
DIFF: https://github.com/llvm/llvm-project/commit/c55cf4afa9161bb4413b7ca9933d553327f5f069.diff
LOG: Revert "Remove redundant "std::move"s in return statements"
The build failed with
error: call to deleted constructor of 'llvm::Error'
errors.
This reverts commit 1c2241a7936bf85aa68aef94bd40c3ba77d8ddf2.
Added:
Modified:
llvm/include/llvm/Bitstream/BitstreamReader.h
llvm/include/llvm/DebugInfo/CodeView/CVRecord.h
llvm/include/llvm/DebugInfo/CodeView/SymbolDeserializer.h
llvm/include/llvm/DebugInfo/CodeView/TypeDeserializer.h
llvm/include/llvm/DebugInfo/DWARF/DWARFListTable.h
llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h
llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
llvm/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h
llvm/include/llvm/ExecutionEngine/Orc/LazyReexports.h
llvm/include/llvm/ExecutionEngine/Orc/Legacy.h
llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h
llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetServer.h
llvm/include/llvm/ExecutionEngine/Orc/RPC/RPCUtils.h
llvm/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h
llvm/include/llvm/Object/ELF.h
llvm/include/llvm/Object/ELFObjectFile.h
llvm/include/llvm/ProfileData/Coverage/CoverageMappingReader.h
llvm/include/llvm/Support/Error.h
llvm/include/llvm/Support/TaskQueue.h
llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
llvm/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/lib/Bitcode/Reader/MetadataLoader.cpp
llvm/lib/Bitstream/Reader/BitstreamReader.cpp
llvm/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp
llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
llvm/lib/DebugInfo/GSYM/FunctionInfo.cpp
llvm/lib/DebugInfo/GSYM/GsymReader.cpp
llvm/lib/DebugInfo/GSYM/Header.cpp
llvm/lib/DebugInfo/GSYM/LineTable.cpp
llvm/lib/DebugInfo/MSF/MSFBuilder.cpp
llvm/lib/DebugInfo/PDB/Native/DbiModuleList.cpp
llvm/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp
llvm/lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp
llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp
llvm/lib/DebugInfo/PDB/Native/TpiHashing.cpp
llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp
llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.cpp
llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp
llvm/lib/ExecutionEngine/Orc/CompileUtils.cpp
llvm/lib/ExecutionEngine/Orc/Core.cpp
llvm/lib/ExecutionEngine/Orc/DebugUtils.cpp
llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp
llvm/lib/ExecutionEngine/Orc/OrcCBindingsStack.h
llvm/lib/ExecutionEngine/RuntimeDyld/JITSymbol.cpp
llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
llvm/lib/IR/LLVMRemarkStreamer.cpp
llvm/lib/LTO/LTO.cpp
llvm/lib/LTO/LTOModule.cpp
llvm/lib/MCA/InstrBuilder.cpp
llvm/lib/MCA/Pipeline.cpp
llvm/lib/Object/Archive.cpp
llvm/lib/Object/ArchiveWriter.cpp
llvm/lib/Object/COFFModuleDefinition.cpp
llvm/lib/Object/COFFObjectFile.cpp
llvm/lib/Object/Decompressor.cpp
llvm/lib/Object/ELFObjectFile.cpp
llvm/lib/Object/IRObjectFile.cpp
llvm/lib/Object/IRSymtab.cpp
llvm/lib/Object/MachOObjectFile.cpp
llvm/lib/Object/MachOUniversal.cpp
llvm/lib/Object/ObjectFile.cpp
llvm/lib/Object/SymbolicFile.cpp
llvm/lib/Object/TapiUniversal.cpp
llvm/lib/Object/WasmObjectFile.cpp
llvm/lib/Object/WindowsResource.cpp
llvm/lib/Object/XCOFFObjectFile.cpp
llvm/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp
llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
llvm/lib/ObjectYAML/CodeViewYAMLTypes.cpp
llvm/lib/ObjectYAML/DWARFEmitter.cpp
llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
llvm/lib/ProfileData/GCOV.cpp
llvm/lib/ProfileData/InstrProf.cpp
llvm/lib/ProfileData/InstrProfReader.cpp
llvm/lib/ProfileData/SampleProfReader.cpp
llvm/lib/ProfileData/SampleProfWriter.cpp
llvm/lib/Remarks/BitstreamRemarkParser.cpp
llvm/lib/Remarks/YAMLRemarkParser.cpp
llvm/lib/Support/APFloat.cpp
llvm/lib/Support/FileCheck.cpp
llvm/lib/Support/JSON.cpp
llvm/lib/Support/MemoryBuffer.cpp
llvm/lib/Support/Path.cpp
llvm/lib/Support/YAMLTraits.cpp
llvm/lib/TableGen/JSONBackend.cpp
llvm/lib/TextAPI/ELF/TBEHandler.cpp
llvm/lib/TextAPI/MachO/TextStub.cpp
llvm/lib/Transforms/IPO/FunctionImport.cpp
llvm/lib/XRay/FDRRecordProducer.cpp
llvm/lib/XRay/FileHeaderReader.cpp
llvm/lib/XRay/InstrumentationMap.cpp
llvm/lib/XRay/Profile.cpp
llvm/lib/XRay/Trace.cpp
llvm/tools/bugpoint/ExecutionDriver.cpp
llvm/tools/bugpoint/ListReducer.h
llvm/tools/bugpoint/Miscompilation.cpp
llvm/tools/bugpoint/ToolRunner.cpp
llvm/tools/dsymutil/BinaryHolder.cpp
llvm/tools/dsymutil/DebugMap.cpp
llvm/tools/dsymutil/MachODebugMapParser.cpp
llvm/tools/dsymutil/dsymutil.cpp
llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
llvm/tools/llvm-cfi-verify/lib/FileAnalysis.cpp
llvm/tools/llvm-cov/SourceCoverageView.cpp
llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp
llvm/tools/llvm-dwp/llvm-dwp.cpp
llvm/tools/llvm-elfabi/ELFObjHandler.cpp
llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
llvm/tools/llvm-exegesis/lib/Clustering.cpp
llvm/tools/llvm-exegesis/lib/LatencyBenchmarkRunner.cpp
llvm/tools/llvm-exegesis/lib/SerialSnippetGenerator.cpp
llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp
llvm/tools/llvm-exegesis/lib/UopsBenchmarkRunner.cpp
llvm/tools/llvm-exegesis/lib/X86/Target.cpp
llvm/tools/llvm-ifs/llvm-ifs.cpp
llvm/tools/llvm-jitlink/llvm-jitlink.cpp
llvm/tools/llvm-mca/llvm-mca.cpp
llvm/tools/llvm-objcopy/COFF/Reader.cpp
llvm/tools/llvm-objcopy/CopyConfig.cpp
llvm/tools/llvm-objcopy/ELF/Object.cpp
llvm/tools/llvm-objcopy/wasm/Reader.cpp
llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
llvm/tools/llvm-pdbutil/InputFile.cpp
llvm/tools/llvm-rc/ResourceScriptParser.cpp
llvm/tools/llvm-rc/ResourceScriptToken.cpp
llvm/tools/llvm-readobj/ELFDumper.cpp
llvm/tools/obj2yaml/elf2yaml.cpp
llvm/tools/obj2yaml/macho2yaml.cpp
llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp
llvm/utils/TableGen/GlobalISelEmitter.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Bitstream/BitstreamReader.h b/llvm/include/llvm/Bitstream/BitstreamReader.h
index fa0855fa1547..c476f60420fa 100644
--- a/llvm/include/llvm/Bitstream/BitstreamReader.h
+++ b/llvm/include/llvm/Bitstream/BitstreamReader.h
@@ -209,7 +209,7 @@ class SimpleBitstreamCursor {
unsigned BitsLeft = NumBits - BitsInCurWord;
if (Error fillResult = fillCurWord())
- return fillResult;
+ return std::move(fillResult);
// If we run out of data, abort.
if (BitsLeft > BitsInCurWord)
@@ -425,7 +425,7 @@ class BitstreamCursor : SimpleBitstreamCursor {
// We read and accumulate abbrev's, the client can't do anything with
// them anyway.
if (Error Err = ReadAbbrevRecord())
- return Err;
+ return std::move(Err);
continue;
}
@@ -448,7 +448,7 @@ class BitstreamCursor : SimpleBitstreamCursor {
// If we found a sub-block, just skip over it and check the next entry.
if (Error Err = SkipBlock())
- return Err;
+ return std::move(Err);
}
}
diff --git a/llvm/include/llvm/DebugInfo/CodeView/CVRecord.h b/llvm/include/llvm/DebugInfo/CodeView/CVRecord.h
index 5567214c5b7d..784c47e3bf5d 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/CVRecord.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/CVRecord.h
@@ -100,14 +100,14 @@ inline Expected<CVRecord<Kind>> readCVRecordFromStream(BinaryStreamRef Stream,
Reader.setOffset(Offset);
if (auto EC = Reader.readObject(Prefix))
- return EC;
+ return std::move(EC);
if (Prefix->RecordLen < 2)
return make_error<CodeViewError>(cv_error_code::corrupt_record);
Reader.setOffset(Offset);
ArrayRef<uint8_t> RawData;
if (auto EC = Reader.readBytes(RawData, Prefix->RecordLen + sizeof(uint16_t)))
- return EC;
+ return std::move(EC);
return codeview::CVRecord<Kind>(RawData);
}
diff --git a/llvm/include/llvm/DebugInfo/CodeView/SymbolDeserializer.h b/llvm/include/llvm/DebugInfo/CodeView/SymbolDeserializer.h
index 80a092e69ff6..108abb291498 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/SymbolDeserializer.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/SymbolDeserializer.h
@@ -48,7 +48,7 @@ class SymbolDeserializer : public SymbolVisitorCallbacks {
template <typename T> static Expected<T> deserializeAs(CVSymbol Symbol) {
T Record(static_cast<SymbolRecordKind>(Symbol.kind()));
if (auto EC = deserializeAs<T>(Symbol, Record))
- return EC;
+ return std::move(EC);
return Record;
}
diff --git a/llvm/include/llvm/DebugInfo/CodeView/TypeDeserializer.h b/llvm/include/llvm/DebugInfo/CodeView/TypeDeserializer.h
index 6aca4911f466..2b17f5ccb13b 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/TypeDeserializer.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/TypeDeserializer.h
@@ -60,7 +60,7 @@ class TypeDeserializer : public TypeVisitorCallbacks {
T Record(K);
CVType CVT(Data);
if (auto EC = deserializeAs<T>(CVT, Record))
- return EC;
+ return std::move(EC);
return Record;
}
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFListTable.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFListTable.h
index 8c568f455ea7..496fdb2477f9 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFListTable.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFListTable.h
@@ -280,7 +280,7 @@ DWARFListTableBase<DWARFListType>::findList(DWARFDataExtractor Data,
if (Error E =
List.extract(Data, getHeaderOffset(), End, &Offset,
Header.getSectionName(), Header.getListTypeString()))
- return E;
+ return std::move(E);
ListMap[StartingOffset] = List;
return List;
}
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h b/llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
index ca1f3dd81ea5..65295f97e2c6 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
@@ -233,7 +233,7 @@ class LegacyCompileOnDemandLayer {
if (auto Sym = BaseLayer.findSymbolIn(BLK, Name, ExportedSymbolsOnly))
return Sym;
else if (auto Err = Sym.takeError())
- return Err;
+ return std::move(Err);
return nullptr;
}
@@ -342,7 +342,7 @@ class LegacyCompileOnDemandLayer {
findSymbolIn(KV.first, std::string(Name), ExportedSymbolsOnly))
return Sym;
else if (auto Err = Sym.takeError())
- return Err;
+ return std::move(Err);
}
return BaseLayer.findSymbol(std::string(Name), ExportedSymbolsOnly);
}
@@ -518,7 +518,7 @@ class LegacyCompileOnDemandLayer {
if (auto Sym = LD.findSymbol(BaseLayer, std::string(Name), false))
return Sym;
else if (auto Err = Sym.takeError())
- return Err;
+ return std::move(Err);
return nullptr;
};
@@ -611,7 +611,7 @@ class LegacyCompileOnDemandLayer {
} else
return FnBodyAddrOrErr.takeError();
} else if (auto Err = FnBodySym.takeError())
- return Err;
+ return std::move(Err);
else
llvm_unreachable("Function not emitted for partition");
}
@@ -729,7 +729,7 @@ class LegacyCompileOnDemandLayer {
SetSymbolResolver(K, std::move(Resolver));
if (auto Err = BaseLayer.addModule(std::move(K), std::move(M)))
- return Err;
+ return std::move(Err);
return K;
}
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h b/llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h
index eecb31a5c241..a9ab3a630a64 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h
@@ -80,8 +80,8 @@ template <typename ORCABI> class LocalTrampolinePool : public TrampolinePool {
new LocalTrampolinePool(std::move(GetTrampolineLanding), Err));
if (Err)
- return Err;
- return LTP;
+ return std::move(Err);
+ return std::move(LTP);
}
/// Get a free trampoline. Returns an error if one can not be provided (e.g.
@@ -90,7 +90,7 @@ template <typename ORCABI> class LocalTrampolinePool : public TrampolinePool {
std::lock_guard<std::mutex> Lock(LTPMutex);
if (AvailableTrampolines.empty()) {
if (auto Err = grow())
- return Err;
+ return std::move(Err);
}
assert(!AvailableTrampolines.empty() && "Failed to grow trampoline pool");
auto TrampolineAddr = AvailableTrampolines.back();
@@ -229,8 +229,8 @@ class LocalJITCompileCallbackManager : public JITCompileCallbackManager {
auto CCMgr = std::unique_ptr<LocalJITCompileCallbackManager>(
new LocalJITCompileCallbackManager(ES, ErrorHandlerAddress, Err));
if (Err)
- return Err;
- return CCMgr;
+ return std::move(Err);
+ return std::move(CCMgr);
}
private:
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h b/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
index 93f122696a10..3374a29f04df 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
@@ -262,13 +262,13 @@ class LLJITBuilderSetters {
/// Create an instance of the JIT.
Expected<std::unique_ptr<JITType>> create() {
if (auto Err = impl().prepareForConstruction())
- return Err;
+ return std::move(Err);
Error Err = Error::success();
std::unique_ptr<JITType> J(new JITType(impl(), Err));
if (Err)
- return Err;
- return J;
+ return std::move(Err);
+ return std::move(J);
}
protected:
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h b/llvm/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h
index 326c5982a12d..84f5e0350c2e 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h
@@ -57,13 +57,13 @@ template <typename BaseLayerT> class LazyEmittingLayer {
else if (this->EmitState == NotEmitted) {
this->EmitState = Emitting;
if (auto Err = this->emitToBaseLayer(B))
- return Err;
+ return std::move(Err);
this->EmitState = Emitted;
}
if (auto Sym = B.findSymbolIn(K, Name, ExportedSymbolsOnly))
return Sym.getAddress();
else if (auto Err = Sym.takeError())
- return Err;
+ return std::move(Err);
else
llvm_unreachable("Successful symbol lookup should return "
"definition address here");
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/LazyReexports.h b/llvm/include/llvm/ExecutionEngine/Orc/LazyReexports.h
index 38eb06360e6d..fd34556ff959 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/LazyReexports.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/LazyReexports.h
@@ -101,9 +101,9 @@ class LocalLazyCallThroughManager : public LazyCallThroughManager {
new LocalLazyCallThroughManager(ES, ErrorHandlerAddr));
if (auto Err = LLCTM->init<ORCABI>())
- return Err;
+ return std::move(Err);
- return LLCTM;
+ return std::move(LLCTM);
}
};
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Legacy.h b/llvm/include/llvm/ExecutionEngine/Orc/Legacy.h
index 29d257ff1bd6..148e260c9569 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Legacy.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Legacy.h
@@ -123,7 +123,7 @@ getResponsibilitySetWithLegacyFn(const SymbolNameSet &Symbols,
if (!Sym.getFlags().isStrong())
Result.insert(S);
} else if (auto Err = Sym.takeError())
- return Err;
+ return std::move(Err);
}
return Result;
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h b/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h
index 1c5394677e81..86e8d5df3ad9 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h
@@ -457,7 +457,7 @@ class OrcRemoteTargetClient
std::lock_guard<std::mutex> Lock(RTPMutex);
if (AvailableTrampolines.empty()) {
if (auto Err = grow())
- return Err;
+ return std::move(Err);
}
assert(!AvailableTrampolines.empty() && "Failed to grow trampoline pool");
auto TrampolineAddr = AvailableTrampolines.back();
@@ -506,8 +506,8 @@ class OrcRemoteTargetClient
auto Client = std::unique_ptr<OrcRemoteTargetClient>(
new OrcRemoteTargetClient(Channel, ES, Err));
if (Err)
- return Err;
- return Client;
+ return std::move(Err);
+ return std::move(Client);
}
/// Call the int(void) function at the given address in the target and return
@@ -541,7 +541,7 @@ class OrcRemoteTargetClient
createRemoteMemoryManager() {
auto Id = AllocatorIds.getNext();
if (auto Err = callB<mem::CreateRemoteAllocator>(Id))
- return Err;
+ return std::move(Err);
return std::unique_ptr<RemoteRTDyldMemoryManager>(
new RemoteRTDyldMemoryManager(*this, Id));
}
@@ -552,7 +552,7 @@ class OrcRemoteTargetClient
createIndirectStubsManager() {
auto Id = IndirectStubOwnerIds.getNext();
if (auto Err = callB<stubs::CreateIndirectStubsOwner>(Id))
- return Err;
+ return std::move(Err);
return std::make_unique<RemoteIndirectStubsManager>(*this, Id);
}
@@ -562,7 +562,7 @@ class OrcRemoteTargetClient
// Emit the resolver block on the JIT server.
if (auto Err = callB<stubs::EmitResolverBlock>())
- return Err;
+ return std::move(Err);
// Create the callback manager.
CallbackManager.emplace(*this, ES, ErrorHandlerAddress);
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetServer.h b/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetServer.h
index 7faf08054aec..4c8e2ea1a7be 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetServer.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetServer.h
@@ -265,7 +265,7 @@ class OrcRemoteTargetServer
typename TargetT::IndirectStubsInfo IS;
if (auto Err =
TargetT::emitIndirectStubsBlock(IS, NumStubsRequired, nullptr))
- return Err;
+ return std::move(Err);
JITTargetAddress StubsBase = static_cast<JITTargetAddress>(
reinterpret_cast<uintptr_t>(IS.getStub(0)));
@@ -382,7 +382,7 @@ class OrcRemoteTargetServer
auto &Allocator = I->second;
void *LocalAllocAddr = nullptr;
if (auto Err = Allocator.allocate(LocalAllocAddr, Size, Align))
- return Err;
+ return std::move(Err);
LLVM_DEBUG(dbgs() << " Allocator " << Id << " reserved " << LocalAllocAddr
<< " (" << Size << " bytes, alignment " << Align
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/RPC/RPCUtils.h b/llvm/include/llvm/ExecutionEngine/Orc/RPC/RPCUtils.h
index 6cf5612af8dc..ed09363dcecc 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/RPC/RPCUtils.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/RPC/RPCUtils.h
@@ -1528,20 +1528,20 @@ class SingleThreadedRPCEndpoint
Args...)) {
detail::ResultTraits<typename Func::ReturnType>::consumeAbandoned(
std::move(Result));
- return Err;
+ return std::move(Err);
}
if (auto Err = this->C.send()) {
detail::ResultTraits<typename Func::ReturnType>::consumeAbandoned(
std::move(Result));
- return Err;
+ return std::move(Err);
}
while (!ReceivedResponse) {
if (auto Err = this->handleOne()) {
detail::ResultTraits<typename Func::ReturnType>::consumeAbandoned(
std::move(Result));
- return Err;
+ return std::move(Err);
}
}
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h b/llvm/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h
index 74342931dd9d..435c882d506d 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h
@@ -276,7 +276,7 @@ class LegacyRTDyldObjectLinkingLayer : public LegacyRTDyldObjectLinkingLayerBase
// and its execution, so we need to double check.
if (!this->Finalized)
if (auto Err = this->finalize())
- return Err;
+ return std::move(Err);
return this->getSymbol(Name, false).getAddress();
};
}
@@ -430,7 +430,7 @@ class LegacyRTDyldObjectLinkingLayer : public LegacyRTDyldObjectLinkingLayerBase
if (auto Sym = KV.second->getSymbol(Name, ExportedSymbolsOnly))
return Sym;
else if (auto Err = Sym.takeError())
- return Err;
+ return std::move(Err);
return nullptr;
}
diff --git a/llvm/include/llvm/Object/ELF.h b/llvm/include/llvm/Object/ELF.h
index 28dd77ebd7fa..42c5b67ac3fa 100644
--- a/llvm/include/llvm/Object/ELF.h
+++ b/llvm/include/llvm/Object/ELF.h
@@ -601,7 +601,7 @@ ELFFile<ELFT>::getStringTable(const Elf_Shdr *Section,
": expected SHT_STRTAB, but got " +
object::getELFSectionTypeName(
getHeader()->e_machine, Section->sh_type)))
- return E;
+ return std::move(E);
auto V = getSectionContentsAsArray<char>(Section);
if (!V)
diff --git a/llvm/include/llvm/Object/ELFObjectFile.h b/llvm/include/llvm/Object/ELFObjectFile.h
index ca99dcf6188a..8a68e49477fd 100644
--- a/llvm/include/llvm/Object/ELFObjectFile.h
+++ b/llvm/include/llvm/Object/ELFObjectFile.h
@@ -948,7 +948,7 @@ Expected<ELFObjectFile<ELFT>>
ELFObjectFile<ELFT>::create(MemoryBufferRef Object) {
auto EFOrErr = ELFFile<ELFT>::create(Object.getBuffer());
if (Error E = EFOrErr.takeError())
- return E;
+ return std::move(E);
auto EF = std::move(*EFOrErr);
auto SectionsOrErr = EF.sections();
diff --git a/llvm/include/llvm/ProfileData/Coverage/CoverageMappingReader.h b/llvm/include/llvm/ProfileData/Coverage/CoverageMappingReader.h
index b7584ea1570e..57a2aaefd660 100644
--- a/llvm/include/llvm/ProfileData/Coverage/CoverageMappingReader.h
+++ b/llvm/include/llvm/ProfileData/Coverage/CoverageMappingReader.h
@@ -77,7 +77,7 @@ class CoverageMappingIterator
if (ReadErr != coveragemap_error::success) {
auto E = make_error<CoverageMapError>(ReadErr);
ReadErr = coveragemap_error::success;
- return E;
+ return std::move(E);
}
return Record;
}
@@ -85,7 +85,7 @@ class CoverageMappingIterator
if (ReadErr != coveragemap_error::success) {
auto E = make_error<CoverageMapError>(ReadErr);
ReadErr = coveragemap_error::success;
- return E;
+ return std::move(E);
}
return &Record;
}
diff --git a/llvm/include/llvm/Support/Error.h b/llvm/include/llvm/Support/Error.h
index 61bf9efa90f1..44676338808b 100644
--- a/llvm/include/llvm/Support/Error.h
+++ b/llvm/include/llvm/Support/Error.h
@@ -963,7 +963,7 @@ Expected<T> handleExpected(Expected<T> ValOrErr, RecoveryFtor &&RecoveryPath,
if (auto Err = handleErrors(ValOrErr.takeError(),
std::forward<HandlerTs>(Handlers)...))
- return Err;
+ return std::move(Err);
return RecoveryPath();
}
diff --git a/llvm/include/llvm/Support/TaskQueue.h b/llvm/include/llvm/Support/TaskQueue.h
index 740400aa44fa..df2ffdee2cc2 100644
--- a/llvm/include/llvm/Support/TaskQueue.h
+++ b/llvm/include/llvm/Support/TaskQueue.h
@@ -98,7 +98,7 @@ class TaskQueue {
IsTaskInFlight = true;
}
}
- return F;
+ return std::move(F);
}
private:
diff --git a/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp b/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
index 0bf62f2c64af..e70caa83c8c1 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
@@ -415,41 +415,41 @@ static Expected<CurStreamTypeType> ReadSignature(BitstreamCursor &Stream) {
char Signature[6];
if (Error Err = tryRead(Signature[0], 8))
- return Err;
+ return std::move(Err);
if (Error Err = tryRead(Signature[1], 8))
- return Err;
+ return std::move(Err);
// Autodetect the file contents, if it is one we know.
if (Signature[0] == 'C' && Signature[1] == 'P') {
if (Error Err = tryRead(Signature[2], 8))
- return Err;
+ return std::move(Err);
if (Error Err = tryRead(Signature[3], 8))
- return Err;
+ return std::move(Err);
if (Signature[2] == 'C' && Signature[3] == 'H')
return ClangSerializedASTBitstream;
} else if (Signature[0] == 'D' && Signature[1] == 'I') {
if (Error Err = tryRead(Signature[2], 8))
- return Err;
+ return std::move(Err);
if (Error Err = tryRead(Signature[3], 8))
- return Err;
+ return std::move(Err);
if (Signature[2] == 'A' && Signature[3] == 'G')
return ClangSerializedDiagnosticsBitstream;
} else if (Signature[0] == 'R' && Signature[1] == 'M') {
if (Error Err = tryRead(Signature[2], 8))
- return Err;
+ return std::move(Err);
if (Error Err = tryRead(Signature[3], 8))
- return Err;
+ return std::move(Err);
if (Signature[2] == 'R' && Signature[3] == 'K')
return LLVMBitstreamRemarks;
} else {
if (Error Err = tryRead(Signature[2], 4))
- return Err;
+ return std::move(Err);
if (Error Err = tryRead(Signature[3], 4))
- return Err;
+ return std::move(Err);
if (Error Err = tryRead(Signature[4], 4))
- return Err;
+ return std::move(Err);
if (Error Err = tryRead(Signature[5], 4))
- return Err;
+ return std::move(Err);
if (Signature[0] == 'B' && Signature[1] == 'C' && Signature[2] == 0x0 &&
Signature[3] == 0xC && Signature[4] == 0xE && Signature[5] == 0xD)
return LLVMIRBitstream;
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 83e72f7a80c0..b5476065c36e 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -141,9 +141,9 @@ static Expected<BitstreamCursor> initStream(MemoryBufferRef Buffer) {
BitstreamCursor Stream(ArrayRef<uint8_t>(BufPtr, BufEnd));
if (Error Err = hasInvalidBitcodeHeader(Stream))
- return Err;
+ return std::move(Err);
- return Stream;
+ return std::move(Stream);
}
/// Convert a string from a record into an std::string, return true on failure.
@@ -172,7 +172,7 @@ static void stripTBAA(Module *M) {
/// "epoch" encoded in the bitcode, and return the producer name if any.
static Expected<std::string> readIdentificationBlock(BitstreamCursor &Stream) {
if (Error Err = Stream.EnterSubBlock(bitc::IDENTIFICATION_BLOCK_ID))
- return Err;
+ return std::move(Err);
// Read all the records.
SmallVector<uint64_t, 64> Record;
@@ -244,7 +244,7 @@ static Expected<std::string> readIdentificationCode(BitstreamCursor &Stream) {
// Ignore other sub-blocks.
if (Error Err = Stream.SkipBlock())
- return Err;
+ return std::move(Err);
continue;
case BitstreamEntry::Record:
if (Expected<unsigned> Skipped = Stream.skipRecord(Entry.ID))
@@ -257,7 +257,7 @@ static Expected<std::string> readIdentificationCode(BitstreamCursor &Stream) {
static Expected<bool> hasObjCCategoryInModule(BitstreamCursor &Stream) {
if (Error Err = Stream.EnterSubBlock(bitc::MODULE_BLOCK_ID))
- return Err;
+ return std::move(Err);
SmallVector<uint64_t, 64> Record;
// Read all the records for this module.
@@ -324,7 +324,7 @@ static Expected<bool> hasObjCCategory(BitstreamCursor &Stream) {
// Ignore other sub-blocks.
if (Error Err = Stream.SkipBlock())
- return Err;
+ return std::move(Err);
continue;
case BitstreamEntry::Record:
@@ -338,7 +338,7 @@ static Expected<bool> hasObjCCategory(BitstreamCursor &Stream) {
static Expected<std::string> readModuleTriple(BitstreamCursor &Stream) {
if (Error Err = Stream.EnterSubBlock(bitc::MODULE_BLOCK_ID))
- return Err;
+ return std::move(Err);
SmallVector<uint64_t, 64> Record;
@@ -402,7 +402,7 @@ static Expected<std::string> readTriple(BitstreamCursor &Stream) {
// Ignore other sub-blocks.
if (Error Err = Stream.SkipBlock())
- return Err;
+ return std::move(Err);
continue;
case BitstreamEntry::Record:
@@ -2044,7 +2044,7 @@ static Expected<uint64_t> jumpToValueSymbolTable(uint64_t Offset,
// of the VST read.
uint64_t CurrentBit = Stream.GetCurrentBitNo();
if (Error JumpFailed = Stream.JumpToBit(Offset * 32))
- return JumpFailed;
+ return std::move(JumpFailed);
Expected<BitstreamEntry> MaybeEntry = Stream.advance();
if (!MaybeEntry)
return MaybeEntry.takeError();
@@ -6293,7 +6293,7 @@ const std::error_category &llvm::BitcodeErrorCategory() {
static Expected<StringRef> readBlobInRecord(BitstreamCursor &Stream,
unsigned Block, unsigned RecordID) {
if (Error Err = Stream.EnterSubBlock(Block))
- return Err;
+ return std::move(Err);
StringRef Strtab;
while (true) {
@@ -6311,7 +6311,7 @@ static Expected<StringRef> readBlobInRecord(BitstreamCursor &Stream,
case BitstreamEntry::SubBlock:
if (Error Err = Stream.SkipBlock())
- return Err;
+ return std::move(Err);
break;
case BitstreamEntry::Record:
@@ -6372,7 +6372,7 @@ llvm::getBitcodeFileContents(MemoryBufferRef Buffer) {
if (Entry.ID == bitc::IDENTIFICATION_BLOCK_ID) {
IdentificationBit = Stream.GetCurrentBitNo() - BCBegin * 8;
if (Error Err = Stream.SkipBlock())
- return Err;
+ return std::move(Err);
{
Expected<llvm::BitstreamEntry> MaybeEntry = Stream.advance();
@@ -6389,7 +6389,7 @@ llvm::getBitcodeFileContents(MemoryBufferRef Buffer) {
if (Entry.ID == bitc::MODULE_BLOCK_ID) {
uint64_t ModuleBit = Stream.GetCurrentBitNo() - BCBegin * 8;
if (Error Err = Stream.SkipBlock())
- return Err;
+ return std::move(Err);
F.Mods.push_back({Stream.getBitcodeBytes().slice(
BCBegin, Stream.getCurrentByteNo() - BCBegin),
@@ -6438,7 +6438,7 @@ llvm::getBitcodeFileContents(MemoryBufferRef Buffer) {
}
if (Error Err = Stream.SkipBlock())
- return Err;
+ return std::move(Err);
continue;
}
case BitstreamEntry::Record:
@@ -6466,7 +6466,7 @@ BitcodeModule::getModuleImpl(LLVMContext &Context, bool MaterializeAll,
std::string ProducerIdentification;
if (IdentificationBit != -1ull) {
if (Error JumpFailed = Stream.JumpToBit(IdentificationBit))
- return JumpFailed;
+ return std::move(JumpFailed);
Expected<std::string> ProducerIdentificationOrErr =
readIdentificationBlock(Stream);
if (!ProducerIdentificationOrErr)
@@ -6476,7 +6476,7 @@ BitcodeModule::getModuleImpl(LLVMContext &Context, bool MaterializeAll,
}
if (Error JumpFailed = Stream.JumpToBit(ModuleBit))
- return JumpFailed;
+ return std::move(JumpFailed);
auto *R = new BitcodeReader(std::move(Stream), Strtab, ProducerIdentification,
Context);
@@ -6487,18 +6487,18 @@ BitcodeModule::getModuleImpl(LLVMContext &Context, bool MaterializeAll,
// Delay parsing Metadata if ShouldLazyLoadMetadata is true.
if (Error Err =
R->parseBitcodeInto(M.get(), ShouldLazyLoadMetadata, IsImporting))
- return Err;
+ return std::move(Err);
if (MaterializeAll) {
// Read in the entire module, and destroy the BitcodeReader.
if (Error Err = M->materializeAll())
- return Err;
+ return std::move(Err);
} else {
// Resolve forward references from blockaddresses.
if (Error Err = R->materializeForwardReferencedFunctions())
- return Err;
+ return std::move(Err);
}
- return M;
+ return std::move(M);
}
Expected<std::unique_ptr<Module>>
@@ -6526,22 +6526,22 @@ Error BitcodeModule::readSummary(ModuleSummaryIndex &CombinedIndex,
Expected<std::unique_ptr<ModuleSummaryIndex>> BitcodeModule::getSummary() {
BitstreamCursor Stream(Buffer);
if (Error JumpFailed = Stream.JumpToBit(ModuleBit))
- return JumpFailed;
+ return std::move(JumpFailed);
auto Index = std::make_unique<ModuleSummaryIndex>(/*HaveGVs=*/false);
ModuleSummaryIndexBitcodeReader R(std::move(Stream), Strtab, *Index,
ModuleIdentifier, 0);
if (Error Err = R.parseModule())
- return Err;
+ return std::move(Err);
- return Index;
+ return std::move(Index);
}
static Expected<bool> getEnableSplitLTOUnitFlag(BitstreamCursor &Stream,
unsigned ID) {
if (Error Err = Stream.EnterSubBlock(ID))
- return Err;
+ return std::move(Err);
SmallVector<uint64_t, 64> Record;
while (true) {
@@ -6587,10 +6587,10 @@ static Expected<bool> getEnableSplitLTOUnitFlag(BitstreamCursor &Stream,
Expected<BitcodeLTOInfo> BitcodeModule::getLTOInfo() {
BitstreamCursor Stream(Buffer);
if (Error JumpFailed = Stream.JumpToBit(ModuleBit))
- return JumpFailed;
+ return std::move(JumpFailed);
if (Error Err = Stream.EnterSubBlock(bitc::MODULE_BLOCK_ID))
- return Err;
+ return std::move(Err);
while (true) {
Expected<llvm::BitstreamEntry> MaybeEntry = Stream.advance();
@@ -6626,7 +6626,7 @@ Expected<BitcodeLTOInfo> BitcodeModule::getLTOInfo() {
// Ignore other sub-blocks.
if (Error Err = Stream.SkipBlock())
- return Err;
+ return std::move(Err);
continue;
case BitstreamEntry::Record:
diff --git a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
index 06b8415dc9dc..3cff468dca89 100644
--- a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
+++ b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
@@ -711,7 +711,7 @@ MetadataLoader::MetadataLoaderImpl::lazyLoadModuleMetadataBlock() {
case bitc::METADATA_STRINGS: {
// Rewind and parse the strings.
if (Error Err = IndexCursor.JumpToBit(CurrentPos))
- return Err;
+ return std::move(Err);
StringRef Blob;
Record.clear();
if (Expected<unsigned> MaybeRecord =
@@ -725,14 +725,14 @@ MetadataLoader::MetadataLoaderImpl::lazyLoadModuleMetadataBlock() {
MDStringRef.push_back(Str);
};
if (auto Err = parseMetadataStrings(Record, Blob, IndexNextMDString))
- return Err;
+ return std::move(Err);
break;
}
case bitc::METADATA_INDEX_OFFSET: {
// This is the offset to the index, when we see this we skip all the
// records and load only an index to these.
if (Error Err = IndexCursor.JumpToBit(CurrentPos))
- return Err;
+ return std::move(Err);
Record.clear();
if (Expected<unsigned> MaybeRecord =
IndexCursor.readRecord(Entry.ID, Record))
@@ -744,7 +744,7 @@ MetadataLoader::MetadataLoaderImpl::lazyLoadModuleMetadataBlock() {
auto Offset = Record[0] + (Record[1] << 32);
auto BeginPos = IndexCursor.GetCurrentBitNo();
if (Error Err = IndexCursor.JumpToBit(BeginPos + Offset))
- return Err;
+ return std::move(Err);
Expected<BitstreamEntry> MaybeEntry =
IndexCursor.advanceSkippingSubblocks(
BitstreamCursor::AF_DontPopBlockAtEnd);
@@ -778,7 +778,7 @@ MetadataLoader::MetadataLoaderImpl::lazyLoadModuleMetadataBlock() {
case bitc::METADATA_NAME: {
// Named metadata need to be materialized now and aren't deferred.
if (Error Err = IndexCursor.JumpToBit(CurrentPos))
- return Err;
+ return std::move(Err);
Record.clear();
unsigned Code;
@@ -823,7 +823,7 @@ MetadataLoader::MetadataLoaderImpl::lazyLoadModuleMetadataBlock() {
// FIXME: we need to do this early because we don't materialize global
// value explicitly.
if (Error Err = IndexCursor.JumpToBit(CurrentPos))
- return Err;
+ return std::move(Err);
Record.clear();
if (Expected<unsigned> MaybeRecord =
IndexCursor.readRecord(Entry.ID, Record))
@@ -838,7 +838,7 @@ MetadataLoader::MetadataLoaderImpl::lazyLoadModuleMetadataBlock() {
if (auto *GO = dyn_cast<GlobalObject>(ValueList[ValueID]))
if (Error Err = parseGlobalObjectAttachment(
*GO, ArrayRef<uint64_t>(Record).slice(1)))
- return Err;
+ return std::move(Err);
break;
}
case bitc::METADATA_KIND:
diff --git a/llvm/lib/Bitstream/Reader/BitstreamReader.cpp b/llvm/lib/Bitstream/Reader/BitstreamReader.cpp
index c6aeaefdcd37..92d7c91a1d35 100644
--- a/llvm/lib/Bitstream/Reader/BitstreamReader.cpp
+++ b/llvm/lib/Bitstream/Reader/BitstreamReader.cpp
@@ -158,7 +158,7 @@ Expected<unsigned> BitstreamCursor::skipRecord(unsigned AbbrevID) {
assert((unsigned)EltEnc.getEncodingData() <= MaxChunkSize);
if (Error Err = JumpToBit(GetCurrentBitNo() +
NumElts * EltEnc.getEncodingData()))
- return Err;
+ return std::move(Err);
break;
case BitCodeAbbrevOp::VBR:
assert((unsigned)EltEnc.getEncodingData() <= MaxChunkSize);
@@ -171,7 +171,7 @@ Expected<unsigned> BitstreamCursor::skipRecord(unsigned AbbrevID) {
break;
case BitCodeAbbrevOp::Char6:
if (Error Err = JumpToBit(GetCurrentBitNo() + NumElts * 6))
- return Err;
+ return std::move(Err);
break;
}
continue;
@@ -197,7 +197,7 @@ Expected<unsigned> BitstreamCursor::skipRecord(unsigned AbbrevID) {
// Skip over the blob.
if (Error Err = JumpToBit(NewEnd))
- return Err;
+ return std::move(Err);
}
return Code;
}
@@ -326,7 +326,7 @@ Expected<unsigned> BitstreamCursor::readRecord(unsigned AbbrevID,
// over tail padding first, in case jumping to NewEnd invalidates the Blob
// pointer.
if (Error Err = JumpToBit(NewEnd))
- return Err;
+ return std::move(Err);
const char *Ptr = (const char *)getPointerToBit(CurBitPos, NumElts);
// If we can return a reference to the data, do so to avoid copying it.
@@ -401,7 +401,7 @@ Error BitstreamCursor::ReadAbbrevRecord() {
Expected<Optional<BitstreamBlockInfo>>
BitstreamCursor::ReadBlockInfoBlock(bool ReadBlockInfoNames) {
if (llvm::Error Err = EnterSubBlock(bitc::BLOCKINFO_BLOCK_ID))
- return Err;
+ return std::move(Err);
BitstreamBlockInfo NewBlockInfo;
@@ -421,7 +421,7 @@ BitstreamCursor::ReadBlockInfoBlock(bool ReadBlockInfoNames) {
case llvm::BitstreamEntry::Error:
return None;
case llvm::BitstreamEntry::EndBlock:
- return NewBlockInfo;
+ return std::move(NewBlockInfo);
case llvm::BitstreamEntry::Record:
// The interesting case.
break;
@@ -431,7 +431,7 @@ BitstreamCursor::ReadBlockInfoBlock(bool ReadBlockInfoNames) {
if (Entry.ID == bitc::DEFINE_ABBREV) {
if (!CurBlockInfo) return None;
if (Error Err = ReadAbbrevRecord())
- return Err;
+ return std::move(Err);
// ReadAbbrevRecord installs the abbrev in CurAbbrevs. Move it to the
// appropriate BlockInfo.
diff --git a/llvm/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp b/llvm/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp
index 4ad0bb566bc3..63342749918d 100644
--- a/llvm/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp
+++ b/llvm/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp
@@ -37,7 +37,7 @@ DebugStringTableSubsectionRef::getString(uint32_t Offset) const {
Reader.setOffset(Offset);
StringRef Result;
if (auto EC = Reader.readCString(Result))
- return EC;
+ return std::move(EC);
return Result;
}
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp b/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
index df19b364f321..bfcd0960faec 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
@@ -481,7 +481,7 @@ DWARFDebugNames::NameIndex::extractAttributeEncodings(uint64_t *Offset) {
if (!AttrEncOr)
return AttrEncOr.takeError();
if (isSentinel(*AttrEncOr))
- return Result;
+ return std::move(Result);
Result.emplace_back(*AttrEncOr);
}
@@ -649,7 +649,7 @@ DWARFDebugNames::NameIndex::getEntry(uint64_t *Offset) const {
return createStringError(errc::io_error,
"Error extracting index attribute values.");
}
- return E;
+ return std::move(E);
}
DWARFDebugNames::NameTableEntry
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
index bed6686680f9..4d1cf71ef9a2 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
@@ -522,7 +522,7 @@ Expected<const DWARFDebugLine::LineTable *> DWARFDebugLine::getOrParseLineTable(
if (Pos.second) {
if (Error Err =
LT->parse(DebugLineData, &Offset, Ctx, U, RecoverableErrorCallback))
- return Err;
+ return std::move(Err);
return LT;
}
return LT;
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
index bde45cbcf10f..7bb019466161 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
@@ -349,7 +349,7 @@ parseListTableHeader(DWARFDataExtractor &DA, uint64_t Offset,
}
ListTableType Table;
if (Error E = Table.extractHeaderAndOffsets(DA, &Offset))
- return E;
+ return std::move(E);
return Table;
}
@@ -621,7 +621,7 @@ DWARFUnit::findRnglistFromOffset(uint64_t Offset) {
if (getVersion() <= 4) {
DWARFDebugRangeList RangeList;
if (Error E = extractRangeList(Offset, RangeList))
- return E;
+ return std::move(E);
return RangeList.getAbsoluteRanges(getBaseAddress());
}
if (RngListTable) {
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
index eaebc3d62a4c..68bacbfda467 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
@@ -34,11 +34,11 @@ DWARFVerifier::DieRangeInfo::insert(const DWARFAddressRange &R) {
if (Pos != End) {
if (Pos->intersects(R))
- return Pos;
+ return std::move(Pos);
if (Pos != Begin) {
auto Iter = Pos - 1;
if (Iter->intersects(R))
- return Iter;
+ return std::move(Iter);
}
}
diff --git a/llvm/lib/DebugInfo/GSYM/FunctionInfo.cpp b/llvm/lib/DebugInfo/GSYM/FunctionInfo.cpp
index 373161d3bd00..6731a8b27443 100644
--- a/llvm/lib/DebugInfo/GSYM/FunctionInfo.cpp
+++ b/llvm/lib/DebugInfo/GSYM/FunctionInfo.cpp
@@ -90,7 +90,7 @@ llvm::Expected<FunctionInfo> FunctionInfo::decode(DataExtractor &Data,
}
Offset += InfoLength;
}
- return FI;
+ return std::move(FI);
}
llvm::Expected<uint64_t> FunctionInfo::encode(FileWriter &O) const {
@@ -114,7 +114,7 @@ llvm::Expected<uint64_t> FunctionInfo::encode(FileWriter &O) const {
const auto StartOffset = O.tell();
llvm::Error err = OptLineTable->encode(O, Range.Start);
if (err)
- return err;
+ return std::move(err);
const auto Length = O.tell() - StartOffset;
if (Length > UINT32_MAX)
return createStringError(std::errc::invalid_argument,
@@ -132,7 +132,7 @@ llvm::Expected<uint64_t> FunctionInfo::encode(FileWriter &O) const {
const auto StartOffset = O.tell();
llvm::Error err = Inline->encode(O, Range.Start);
if (err)
- return err;
+ return std::move(err);
const auto Length = O.tell() - StartOffset;
if (Length > UINT32_MAX)
return createStringError(std::errc::invalid_argument,
@@ -244,6 +244,6 @@ llvm::Expected<LookupResult> FunctionInfo::lookup(DataExtractor &Data,
llvm::Error Err = InlineInfo::lookup(GR, *InlineInfoData, FuncAddr, Addr,
LR.Locations);
if (Err)
- return Err;
+ return std::move(Err);
return LR;
}
diff --git a/llvm/lib/DebugInfo/GSYM/GsymReader.cpp b/llvm/lib/DebugInfo/GSYM/GsymReader.cpp
index c05d6bce4f68..b4f3f2052ae7 100644
--- a/llvm/lib/DebugInfo/GSYM/GsymReader.cpp
+++ b/llvm/lib/DebugInfo/GSYM/GsymReader.cpp
@@ -54,8 +54,8 @@ GsymReader::create(std::unique_ptr<MemoryBuffer> &MemBuffer) {
GsymReader GR(std::move(MemBuffer));
llvm::Error Err = GR.parse();
if (Err)
- return Err;
- return GR;
+ return std::move(Err);
+ return std::move(GR);
}
llvm::Error
diff --git a/llvm/lib/DebugInfo/GSYM/Header.cpp b/llvm/lib/DebugInfo/GSYM/Header.cpp
index 85d8fbe9cf68..0b3fb9c49894 100644
--- a/llvm/lib/DebugInfo/GSYM/Header.cpp
+++ b/llvm/lib/DebugInfo/GSYM/Header.cpp
@@ -78,7 +78,7 @@ llvm::Expected<Header> Header::decode(DataExtractor &Data) {
H.StrtabSize = Data.getU32(&Offset);
Data.getU8(&Offset, H.UUID, GSYM_MAX_UUID_SIZE);
if (llvm::Error Err = H.checkForError())
- return Err;
+ return std::move(Err);
return H;
}
diff --git a/llvm/lib/DebugInfo/GSYM/LineTable.cpp b/llvm/lib/DebugInfo/GSYM/LineTable.cpp
index 4e1d75b26b88..a49a3ba9bf2a 100644
--- a/llvm/lib/DebugInfo/GSYM/LineTable.cpp
+++ b/llvm/lib/DebugInfo/GSYM/LineTable.cpp
@@ -256,7 +256,7 @@ llvm::Expected<LineTable> LineTable::decode(DataExtractor &Data,
return true; // Keep parsing by returning true.
});
if (Err)
- return Err;
+ return std::move(Err);
return LT;
}
// Parse the line table on the fly and find the row we are looking for.
@@ -278,7 +278,7 @@ Expected<LineEntry> LineTable::lookup(DataExtractor &Data, uint64_t BaseAddr, ui
return true; // Keep parsing till we find the right row.
});
if (Err)
- return Err;
+ return std::move(Err);
if (Result.isValid())
return Result;
return createStringError(std::errc::invalid_argument,
diff --git a/llvm/lib/DebugInfo/MSF/MSFBuilder.cpp b/llvm/lib/DebugInfo/MSF/MSFBuilder.cpp
index d27cecc78c0d..c6fe764ab7e0 100644
--- a/llvm/lib/DebugInfo/MSF/MSFBuilder.cpp
+++ b/llvm/lib/DebugInfo/MSF/MSFBuilder.cpp
@@ -183,7 +183,7 @@ Expected<uint32_t> MSFBuilder::addStream(uint32_t Size) {
std::vector<uint32_t> NewBlocks;
NewBlocks.resize(ReqBlocks);
if (auto EC = allocateBlocks(ReqBlocks, NewBlocks))
- return EC;
+ return std::move(EC);
StreamData.push_back(std::make_pair(Size, NewBlocks));
return StreamData.size() - 1;
}
@@ -267,7 +267,7 @@ Expected<MSFLayout> MSFBuilder::generateLayout() {
uint32_t NumExtraBlocks = NumDirectoryBlocks - DirectoryBlocks.size();
ExtraBlocks.resize(NumExtraBlocks);
if (auto EC = allocateBlocks(NumExtraBlocks, ExtraBlocks))
- return EC;
+ return std::move(EC);
DirectoryBlocks.insert(DirectoryBlocks.end(), ExtraBlocks.begin(),
ExtraBlocks.end());
} else if (NumDirectoryBlocks < DirectoryBlocks.size()) {
@@ -346,14 +346,14 @@ Expected<FileBufferByteStream> MSFBuilder::commit(StringRef Path,
uint64_t FileSize = Layout.SB->BlockSize * Layout.SB->NumBlocks;
auto OutFileOrError = FileOutputBuffer::create(Path, FileSize);
if (auto EC = OutFileOrError.takeError())
- return EC;
+ return std::move(EC);
FileBufferByteStream Buffer(std::move(*OutFileOrError),
llvm::support::little);
BinaryStreamWriter Writer(Buffer);
if (auto EC = Writer.writeObject(*Layout.SB))
- return EC;
+ return std::move(EC);
commitFpm(Buffer, Layout, Allocator);
@@ -361,21 +361,21 @@ Expected<FileBufferByteStream> MSFBuilder::commit(StringRef Path,
msf::blockToOffset(Layout.SB->BlockMapAddr, Layout.SB->BlockSize);
Writer.setOffset(BlockMapOffset);
if (auto EC = Writer.writeArray(Layout.DirectoryBlocks))
- return EC;
+ return std::move(EC);
auto DirStream = WritableMappedBlockStream::createDirectoryStream(
Layout, Buffer, Allocator);
BinaryStreamWriter DW(*DirStream);
if (auto EC = DW.writeInteger<uint32_t>(Layout.StreamSizes.size()))
- return EC;
+ return std::move(EC);
if (auto EC = DW.writeArray(Layout.StreamSizes))
- return EC;
+ return std::move(EC);
for (const auto &Blocks : Layout.StreamMap) {
if (auto EC = DW.writeArray(Blocks))
- return EC;
+ return std::move(EC);
}
- return Buffer;
+ return std::move(Buffer);
}
diff --git a/llvm/lib/DebugInfo/PDB/Native/DbiModuleList.cpp b/llvm/lib/DebugInfo/PDB/Native/DbiModuleList.cpp
index 991616f03169..5cf014e881cd 100644
--- a/llvm/lib/DebugInfo/PDB/Native/DbiModuleList.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/DbiModuleList.cpp
@@ -274,6 +274,6 @@ Expected<StringRef> DbiModuleList::getFileName(uint32_t Index) const {
Names.setOffset(FileOffset);
StringRef Name;
if (auto EC = Names.readCString(Name))
- return EC;
+ return std::move(EC);
return Name;
}
diff --git a/llvm/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp b/llvm/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp
index 0c990c82607e..1445f0bd9e1b 100644
--- a/llvm/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp
@@ -137,7 +137,7 @@ ModuleDebugStreamRef::findChecksumsSubsection() const {
continue;
if (auto EC = Result.initialize(SS.getRecordData()))
- return EC;
+ return std::move(EC);
return Result;
}
return Result;
diff --git a/llvm/lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp b/llvm/lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp
index ffaa79d1a27a..7a258acbd7c0 100644
--- a/llvm/lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp
@@ -24,7 +24,7 @@ Expected<std::string> readStreamData(BinaryStream &Stream, uint32_t Limit) {
while (Offset < DataLength) {
ArrayRef<uint8_t> Data;
if (auto E = Stream.readLongestContiguousChunk(Offset, Data))
- return E;
+ return std::move(E);
Data = Data.take_front(DataLength - Offset);
Offset += Data.size();
Result += toStringRef(Data);
diff --git a/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp b/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp
index e5c293c8b3e3..cde645236851 100644
--- a/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp
@@ -108,7 +108,7 @@ Expected<ArrayRef<uint8_t>> PDBFile::getBlockData(uint32_t BlockIndex,
ArrayRef<uint8_t> Result;
if (auto EC = Buffer->readBytes(StreamBlockOffset, NumBytes, Result))
- return EC;
+ return std::move(EC);
return Result;
}
@@ -267,7 +267,7 @@ Expected<GlobalsStream &> PDBFile::getPDBGlobalsStream() {
return GlobalS.takeError();
auto TempGlobals = std::make_unique<GlobalsStream>(std::move(*GlobalS));
if (auto EC = TempGlobals->reload())
- return EC;
+ return std::move(EC);
Globals = std::move(TempGlobals);
}
return *Globals;
@@ -280,7 +280,7 @@ Expected<InfoStream &> PDBFile::getPDBInfoStream() {
return InfoS.takeError();
auto TempInfo = std::make_unique<InfoStream>(std::move(*InfoS));
if (auto EC = TempInfo->reload())
- return EC;
+ return std::move(EC);
Info = std::move(TempInfo);
}
return *Info;
@@ -293,7 +293,7 @@ Expected<DbiStream &> PDBFile::getPDBDbiStream() {
return DbiS.takeError();
auto TempDbi = std::make_unique<DbiStream>(std::move(*DbiS));
if (auto EC = TempDbi->reload(this))
- return EC;
+ return std::move(EC);
Dbi = std::move(TempDbi);
}
return *Dbi;
@@ -306,7 +306,7 @@ Expected<TpiStream &> PDBFile::getPDBTpiStream() {
return TpiS.takeError();
auto TempTpi = std::make_unique<TpiStream>(*this, std::move(*TpiS));
if (auto EC = TempTpi->reload())
- return EC;
+ return std::move(EC);
Tpi = std::move(TempTpi);
}
return *Tpi;
@@ -322,7 +322,7 @@ Expected<TpiStream &> PDBFile::getPDBIpiStream() {
return IpiS.takeError();
auto TempIpi = std::make_unique<TpiStream>(*this, std::move(*IpiS));
if (auto EC = TempIpi->reload())
- return EC;
+ return std::move(EC);
Ipi = std::move(TempIpi);
}
return *Ipi;
@@ -340,7 +340,7 @@ Expected<PublicsStream &> PDBFile::getPDBPublicsStream() {
return PublicS.takeError();
auto TempPublics = std::make_unique<PublicsStream>(std::move(*PublicS));
if (auto EC = TempPublics->reload())
- return EC;
+ return std::move(EC);
Publics = std::move(TempPublics);
}
return *Publics;
@@ -359,7 +359,7 @@ Expected<SymbolStream &> PDBFile::getPDBSymbolStream() {
auto TempSymbols = std::make_unique<SymbolStream>(std::move(*SymbolS));
if (auto EC = TempSymbols->reload())
- return EC;
+ return std::move(EC);
Symbols = std::move(TempSymbols);
}
return *Symbols;
@@ -374,7 +374,7 @@ Expected<PDBStringTable &> PDBFile::getStringTable() {
auto N = std::make_unique<PDBStringTable>();
BinaryStreamReader Reader(**NS);
if (auto EC = N->reload(Reader))
- return EC;
+ return std::move(EC);
assert(Reader.bytesRemaining() == 0);
StringTableStream = std::move(*NS);
Strings = std::move(N);
@@ -394,7 +394,7 @@ Expected<InjectedSourceStream &> PDBFile::getInjectedSourceStream() {
auto IJ = std::make_unique<InjectedSourceStream>(std::move(*IJS));
if (auto EC = IJ->reload(*Strings))
- return EC;
+ return std::move(EC);
InjectedSources = std::move(IJ);
}
return *InjectedSources;
diff --git a/llvm/lib/DebugInfo/PDB/Native/TpiHashing.cpp b/llvm/lib/DebugInfo/PDB/Native/TpiHashing.cpp
index 40ea032aab69..b71b2b158144 100644
--- a/llvm/lib/DebugInfo/PDB/Native/TpiHashing.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/TpiHashing.cpp
@@ -44,7 +44,7 @@ static Expected<uint32_t> getHashForUdt(const CVType &Rec) {
T Deserialized;
if (auto E = TypeDeserializer::deserializeAs(const_cast<CVType &>(Rec),
Deserialized))
- return E;
+ return std::move(E);
return getHashForUdt(Deserialized, Rec.data());
}
@@ -53,7 +53,7 @@ static Expected<TagRecordHash> getTagRecordHashForUdt(const CVType &Rec) {
T Deserialized;
if (auto E = TypeDeserializer::deserializeAs(const_cast<CVType &>(Rec),
Deserialized))
- return E;
+ return std::move(E);
ClassOptions Opts = Deserialized.getOptions();
@@ -79,7 +79,7 @@ static Expected<uint32_t> getSourceLineHash(const CVType &Rec) {
T Deserialized;
if (auto E = TypeDeserializer::deserializeAs(const_cast<CVType &>(Rec),
Deserialized))
- return E;
+ return std::move(E);
char Buf[4];
support::endian::write32le(Buf, Deserialized.getUDT().getIndex());
return hashStringV1(StringRef(Buf, 4));
diff --git a/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp b/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
index c6fdeadc2f9a..b4d49d9ff958 100644
--- a/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
+++ b/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
@@ -101,7 +101,7 @@ SymbolizableObjectFile::create(const object::ObjectFile *Obj,
Uniquify(Fs);
Uniquify(Os);
- return res;
+ return std::move(res);
}
SymbolizableObjectFile::SymbolizableObjectFile(const ObjectFile *Obj,
diff --git a/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp b/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp
index 3f435f63c160..f1114e92c360 100644
--- a/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp
@@ -547,7 +547,7 @@ EHFrameEdgeFixer::parseAugmentationString(BinaryStreamReader &RecordReader) {
uint8_t *NextField = &AugInfo.Fields[0];
if (auto Err = RecordReader.readInteger(NextChar))
- return Err;
+ return std::move(Err);
while (NextChar != 0) {
switch (NextChar) {
@@ -556,7 +556,7 @@ EHFrameEdgeFixer::parseAugmentationString(BinaryStreamReader &RecordReader) {
break;
case 'e':
if (auto Err = RecordReader.readInteger(NextChar))
- return Err;
+ return std::move(Err);
if (NextChar != 'h')
return make_error<JITLinkError>("Unrecognized substring e" +
Twine(NextChar) +
@@ -575,10 +575,10 @@ EHFrameEdgeFixer::parseAugmentationString(BinaryStreamReader &RecordReader) {
}
if (auto Err = RecordReader.readInteger(NextChar))
- return Err;
+ return std::move(Err);
}
- return AugInfo;
+ return std::move(AugInfo);
}
Expected<JITTargetAddress>
@@ -589,11 +589,11 @@ EHFrameEdgeFixer::readAbsolutePointer(LinkGraph &G,
JITTargetAddress Addr;
if (G.getPointerSize() == 8) {
if (auto Err = RecordReader.readInteger(Addr))
- return Err;
+ return std::move(Err);
} else if (G.getPointerSize() == 4) {
uint32_t Addr32;
if (auto Err = RecordReader.readInteger(Addr32))
- return Err;
+ return std::move(Err);
Addr = Addr32;
} else
llvm_unreachable("Pointer size is not 32-bit or 64-bit");
diff --git a/llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.cpp b/llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.cpp
index eeb0a4e473b9..89eef5783df9 100644
--- a/llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.cpp
@@ -28,19 +28,19 @@ Expected<std::unique_ptr<LinkGraph>> MachOLinkGraphBuilder::buildGraph() {
return make_error<JITLinkError>("Object is not a relocatable MachO");
if (auto Err = createNormalizedSections())
- return Err;
+ return std::move(Err);
if (auto Err = createNormalizedSymbols())
- return Err;
+ return std::move(Err);
if (auto Err = graphifyRegularSymbols())
- return Err;
+ return std::move(Err);
if (auto Err = graphifySectionsWithCustomParsers())
- return Err;
+ return std::move(Err);
if (auto Err = addRelocations())
- return Err;
+ return std::move(Err);
return std::move(G);
}
diff --git a/llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp b/llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp
index b465b11b0921..29d18b6e4d7b 100644
--- a/llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp
@@ -102,7 +102,7 @@ class PartitioningIRMaterializationUnit : public IRMaterializationUnit {
Optional<CompileOnDemandLayer::GlobalValueSet>
CompileOnDemandLayer::compileRequested(GlobalValueSet Requested) {
- return Requested;
+ return std::move(Requested);
}
Optional<CompileOnDemandLayer::GlobalValueSet>
@@ -294,7 +294,7 @@ void CompileOnDemandLayer::emitPartition(
SymbolFlags[Mangle(GV->getName())] =
JITSymbolFlags::fromGlobalValue(*GV);
if (auto Err = R.defineMaterializing(SymbolFlags))
- return Err;
+ return std::move(Err);
}
expandPartition(*GVsToExtract);
diff --git a/llvm/lib/ExecutionEngine/Orc/CompileUtils.cpp b/llvm/lib/ExecutionEngine/Orc/CompileUtils.cpp
index ef3f2253bc32..160e5ba50311 100644
--- a/llvm/lib/ExecutionEngine/Orc/CompileUtils.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/CompileUtils.cpp
@@ -37,7 +37,7 @@ irManglingOptionsFromTargetOptions(const TargetOptions &Opts) {
Expected<SimpleCompiler::CompileResult> SimpleCompiler::operator()(Module &M) {
CompileResult CachedObject = tryToLoadFromObjectCache(M);
if (CachedObject)
- return CachedObject;
+ return std::move(CachedObject);
SmallVector<char, 0> ObjBufferSV;
@@ -61,7 +61,7 @@ Expected<SimpleCompiler::CompileResult> SimpleCompiler::operator()(Module &M) {
return Obj.takeError();
notifyObjectCompiled(M, *ObjBuffer);
- return ObjBuffer;
+ return std::move(ObjBuffer);
}
SimpleCompiler::CompileResult
diff --git a/llvm/lib/ExecutionEngine/Orc/Core.cpp b/llvm/lib/ExecutionEngine/Orc/Core.cpp
index 5341c0c3f2bf..f2b161cc9fc1 100644
--- a/llvm/lib/ExecutionEngine/Orc/Core.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/Core.cpp
@@ -1455,7 +1455,7 @@ JITDylib::lookupFlags(LookupKind K, JITDylibLookupFlags JDLookupFlags,
// Run this generator.
if (auto Err = DG->tryToGenerate(K, *this, JDLookupFlags, LookupSet))
- return Err;
+ return std::move(Err);
// Re-try the search.
lookupFlagsImpl(Result, K, JDLookupFlags, LookupSet);
@@ -1613,7 +1613,7 @@ JITDylib::legacyLookup(std::shared_ptr<AsynchronousSymbolQuery> Q,
});
if (Err)
- return Err;
+ return std::move(Err);
assert((MUs.empty() || !QueryComplete) &&
"If action flags are set, there should be no work to do (so no MUs)");
@@ -1970,12 +1970,12 @@ Expected<SymbolMap> ExecutionSession::legacyLookup(
auto ResultFuture = PromisedResult.get_future();
auto Result = ResultFuture.get();
if (ResolutionError)
- return ResolutionError;
- return Result;
+ return std::move(ResolutionError);
+ return std::move(Result);
#else
if (ResolutionError)
- return ResolutionError;
+ return std::move(ResolutionError);
return Result;
#endif
@@ -2125,13 +2125,13 @@ ExecutionSession::lookup(const JITDylibSearchOrder &SearchOrder,
auto Result = ResultFuture.get();
if (ResolutionError)
- return ResolutionError;
+ return std::move(ResolutionError);
- return Result;
+ return std::move(Result);
#else
if (ResolutionError)
- return ResolutionError;
+ return std::move(ResolutionError);
return Result;
#endif
diff --git a/llvm/lib/ExecutionEngine/Orc/DebugUtils.cpp b/llvm/lib/ExecutionEngine/Orc/DebugUtils.cpp
index 85b185481ae6..c9e87ff737fc 100644
--- a/llvm/lib/ExecutionEngine/Orc/DebugUtils.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/DebugUtils.cpp
@@ -53,7 +53,7 @@ DumpObjects::operator()(std::unique_ptr<MemoryBuffer> Obj) {
return errorCodeToError(EC);
DumpStream.write(Obj->getBufferStart(), Obj->getBufferSize());
- return Obj;
+ return std::move(Obj);
}
StringRef DumpObjects::getBufferIdentifier(MemoryBuffer &B) {
diff --git a/llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp b/llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp
index de0c29ff62fb..3d97fe9eeab1 100644
--- a/llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp
@@ -267,9 +267,9 @@ StaticLibraryDefinitionGenerator::Create(
new StaticLibraryDefinitionGenerator(L, std::move(ArchiveBuffer), Err));
if (Err)
- return Err;
+ return std::move(Err);
- return ADG;
+ return std::move(ADG);
}
Error StaticLibraryDefinitionGenerator::tryToGenerate(
diff --git a/llvm/lib/ExecutionEngine/Orc/OrcCBindingsStack.h b/llvm/lib/ExecutionEngine/Orc/OrcCBindingsStack.h
index 73640d308226..87bb4398765d 100644
--- a/llvm/lib/ExecutionEngine/Orc/OrcCBindingsStack.h
+++ b/llvm/lib/ExecutionEngine/Orc/OrcCBindingsStack.h
@@ -305,7 +305,7 @@ class OrcCBindingsStack {
Resolvers[K] = std::make_shared<CBindingsResolver>(*this, ExternalResolver,
ExternalResolverCtx);
if (auto Err = Layer.addModule(K, std::move(M)))
- return Err;
+ return std::move(Err);
KeyLayers[K] = detail::createGenericLayer(Layer);
@@ -314,7 +314,7 @@ class OrcCBindingsStack {
orc::LegacyCtorDtorRunner<OrcCBindingsStack> CtorRunner(
AcknowledgeORCv1Deprecation, std::move(CtorNames), K);
if (auto Err = CtorRunner.runViaLayer(*this))
- return Err;
+ return std::move(Err);
IRStaticDestructorRunners.emplace_back(AcknowledgeORCv1Deprecation,
std::move(DtorNames), K);
@@ -365,7 +365,7 @@ class OrcCBindingsStack {
*this, ExternalResolver, ExternalResolverCtx);
if (auto Err = ObjectLayer.addObject(K, std::move(ObjBuffer)))
- return Err;
+ return std::move(Err);
KeyLayers[K] = detail::createGenericLayer(ObjectLayer);
@@ -399,7 +399,7 @@ class OrcCBindingsStack {
return AddrOrErr.takeError();
} else if (auto Err = Sym.takeError()) {
// Lookup failure - report error.
- return Err;
+ return std::move(Err);
}
// No symbol not found. Return 0.
@@ -417,7 +417,7 @@ class OrcCBindingsStack {
return AddrOrErr.takeError();
} else if (auto Err = Sym.takeError()) {
// Lookup failure - report error.
- return Err;
+ return std::move(Err);
}
// Symbol not found. Return 0.
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/JITSymbol.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/JITSymbol.cpp
index 15b7f764204e..4e2d0f422f39 100644
--- a/llvm/lib/ExecutionEngine/RuntimeDyld/JITSymbol.cpp
+++ b/llvm/lib/ExecutionEngine/RuntimeDyld/JITSymbol.cpp
@@ -119,7 +119,7 @@ LegacyJITSymbolResolver::getResponsibilitySet(const LookupSet &Symbols) {
if (!Sym.getFlags().isStrong())
Result.insert(Symbol);
} else if (auto Err = Sym.takeError())
- return Err;
+ return std::move(Err);
else {
// If there is no existing definition then the caller is responsible for
// it.
@@ -127,5 +127,5 @@ LegacyJITSymbolResolver::getResponsibilitySet(const LookupSet &Symbols) {
}
}
- return Result;
+ return std::move(Result);
}
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
index 404c4380ae64..2df71a5e5e74 100644
--- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
+++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
@@ -194,7 +194,7 @@ RuntimeDyldImpl::loadObjectImpl(const object::ObjectFile &Obj) {
CodeSize, CodeAlign,
RODataSize, RODataAlign,
RWDataSize, RWDataAlign))
- return Err;
+ return std::move(Err);
MemMgr.reserveAllocationSpace(CodeSize, CodeAlign, RODataSize, RODataAlign,
RWDataSize, RWDataAlign);
}
@@ -319,7 +319,7 @@ RuntimeDyldImpl::loadObjectImpl(const object::ObjectFile &Obj) {
// Get symbol offset.
uint64_t SectOffset;
if (auto Err = getOffset(*I, *SI, SectOffset))
- return Err;
+ return std::move(Err);
bool IsCode = SI->isText();
unsigned SectionID;
@@ -341,7 +341,7 @@ RuntimeDyldImpl::loadObjectImpl(const object::ObjectFile &Obj) {
// Allocate common symbols
if (auto Err = emitCommonSymbols(Obj, CommonSymbolsToAllocate, CommonSize,
CommonAlign))
- return Err;
+ return std::move(Err);
// Parse and process relocations
LLVM_DEBUG(dbgs() << "Parse relocations:\n");
@@ -432,7 +432,7 @@ RuntimeDyldImpl::loadObjectImpl(const object::ObjectFile &Obj) {
// Give the subclasses a chance to tie-up any loose ends.
if (auto Err = finalizeLoad(Obj, LocalSections))
- return Err;
+ return std::move(Err);
// for (auto E : LocalSections)
// llvm::dbgs() << "Added: " << E.first.getRawDataRefImpl() << " -> " << E.second << "\n";
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
index f5dbf3b5caa5..440ab4174a56 100644
--- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
+++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
@@ -102,10 +102,10 @@ Expected<std::unique_ptr<DyldELFObject<ELFT>>>
DyldELFObject<ELFT>::create(MemoryBufferRef Wrapper) {
auto Obj = ELFObjectFile<ELFT>::create(Wrapper);
if (auto E = Obj.takeError())
- return E;
+ return std::move(E);
std::unique_ptr<DyldELFObject<ELFT>> Ret(
new DyldELFObject<ELFT>(std::move(*Obj)));
- return Ret;
+ return std::move(Ret);
}
template <class ELFT>
@@ -153,7 +153,7 @@ createRTDyldELFObject(MemoryBufferRef Buffer, const ObjectFile &SourceObject,
Expected<std::unique_ptr<DyldELFObject<ELFT>>> ObjOrErr =
DyldELFObject<ELFT>::create(Buffer);
if (Error E = ObjOrErr.takeError())
- return E;
+ return std::move(E);
std::unique_ptr<DyldELFObject<ELFT>> Obj = std::move(*ObjOrErr);
@@ -180,7 +180,7 @@ createRTDyldELFObject(MemoryBufferRef Buffer, const ObjectFile &SourceObject,
++SI;
}
- return Obj;
+ return std::move(Obj);
}
static OwningBinary<ObjectFile>
@@ -1460,7 +1460,7 @@ RuntimeDyldELF::processRelocationRef(
// so the final symbol value is calculated based on the relocation
// values in the .opd section.
if (auto Err = findOPDEntrySection(Obj, ObjSectionToID, Value))
- return Err;
+ return std::move(Err);
} else {
// In the ELFv2 ABI, a function symbol may provide a local entry
// point, which must be used for direct calls.
@@ -1574,7 +1574,7 @@ RuntimeDyldELF::processRelocationRef(
RelocationValueRef TOCValue;
if (auto Err = findPPC64TOCSection(Obj, ObjSectionToID, TOCValue))
- return Err;
+ return std::move(Err);
if (Value.SymbolName || Value.SectionID != TOCValue.SectionID)
llvm_unreachable("Unsupported TOC relocation.");
Value.Addend -= TOCValue.Addend;
@@ -1587,10 +1587,10 @@ RuntimeDyldELF::processRelocationRef(
if (RelType == ELF::R_PPC64_TOC) {
RelType = ELF::R_PPC64_ADDR64;
if (auto Err = findPPC64TOCSection(Obj, ObjSectionToID, Value))
- return Err;
+ return std::move(Err);
} else if (TargetName == ".TOC.") {
if (auto Err = findPPC64TOCSection(Obj, ObjSectionToID, Value))
- return Err;
+ return std::move(Err);
Value.Addend += Addend;
}
diff --git a/llvm/lib/IR/LLVMRemarkStreamer.cpp b/llvm/lib/IR/LLVMRemarkStreamer.cpp
index c137208c4423..326523eaa102 100644
--- a/llvm/lib/IR/LLVMRemarkStreamer.cpp
+++ b/llvm/lib/IR/LLVMRemarkStreamer.cpp
@@ -133,7 +133,7 @@ Expected<std::unique_ptr<ToolOutputFile>> llvm::setupLLVMOptimizationRemarks(
if (Error E = Context.getMainRemarkStreamer()->setFilter(RemarksPasses))
return make_error<LLVMRemarkSetupPatternError>(std::move(E));
- return RemarksFile;
+ return std::move(RemarksFile);
}
Error llvm::setupLLVMOptimizationRemarks(LLVMContext &Context, raw_ostream &OS,
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index 1c52bea8709a..1d23c6bab36d 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -456,7 +456,7 @@ Expected<std::unique_ptr<InputFile>> InputFile::create(MemoryBufferRef Object) {
File->Mods = FOrErr->Mods;
File->Strtab = std::move(FOrErr->Strtab);
- return File;
+ return std::move(File);
}
StringRef InputFile::getName() const {
@@ -676,7 +676,7 @@ LTO::addRegularLTO(BitcodeModule BM, ArrayRef<InputFile::Symbol> Syms,
Mod.M = std::move(*MOrErr);
if (Error Err = M.materializeMetadata())
- return Err;
+ return std::move(Err);
UpgradeDebugInfo(M);
ModuleSymbolTable SymTab;
@@ -776,7 +776,7 @@ LTO::addRegularLTO(BitcodeModule BM, ArrayRef<InputFile::Symbol> Syms,
for (GlobalValue &GV : M.global_values())
handleNonPrevailingComdat(GV, NonPrevailingComdats);
assert(MsymI == MsymE);
- return Mod;
+ return std::move(Mod);
}
Error LTO::linkRegularLTO(RegularLTOState::AddedModule Mod,
@@ -1429,7 +1429,7 @@ Expected<std::unique_ptr<ToolOutputFile>> lto::setupLLVMOptimizationRemarks(
auto ResultOrErr = llvm::setupLLVMOptimizationRemarks(
Context, Filename, RemarksPasses, RemarksFormat, RemarksWithHotness);
if (Error E = ResultOrErr.takeError())
- return E;
+ return std::move(E);
if (*ResultOrErr)
(*ResultOrErr)->keep();
@@ -1451,5 +1451,5 @@ lto::setupStatsFile(StringRef StatsFilename) {
return errorCodeToError(EC);
StatsFile->keep();
- return StatsFile;
+ return std::move(StatsFile);
}
diff --git a/llvm/lib/LTO/LTOModule.cpp b/llvm/lib/LTO/LTOModule.cpp
index 0210953f2117..587b332e7064 100644
--- a/llvm/lib/LTO/LTOModule.cpp
+++ b/llvm/lib/LTO/LTOModule.cpp
@@ -232,7 +232,7 @@ LTOModule::makeLTOModule(MemoryBufferRef Buffer, const TargetOptions &options,
Ret->parseSymbols();
Ret->parseMetadata();
- return Ret;
+ return std::move(Ret);
}
/// Create a MemoryBuffer from a memory range with an optional name.
diff --git a/llvm/lib/MCA/InstrBuilder.cpp b/llvm/lib/MCA/InstrBuilder.cpp
index 90ac0bdc0e0d..b2503f348d66 100644
--- a/llvm/lib/MCA/InstrBuilder.cpp
+++ b/llvm/lib/MCA/InstrBuilder.cpp
@@ -564,7 +564,7 @@ InstrBuilder::createInstrDescImpl(const MCInst &MCI) {
computeMaxLatency(*ID, MCDesc, SCDesc, STI);
if (Error Err = verifyOperands(MCDesc, MCI))
- return Err;
+ return std::move(Err);
populateWrites(*ID, MCI, SchedClassID);
populateReads(*ID, MCI, SchedClassID);
@@ -574,7 +574,7 @@ InstrBuilder::createInstrDescImpl(const MCInst &MCI) {
// Sanity check on the instruction descriptor.
if (Error Err = verifyInstrDesc(*ID, MCI))
- return Err;
+ return std::move(Err);
// Now add the new descriptor.
bool IsVariadic = MCDesc.isVariadic();
@@ -666,7 +666,7 @@ InstrBuilder::createInstruction(const MCInst &MCI) {
// Early exit if there are no writes.
if (D.Writes.empty())
- return NewIS;
+ return std::move(NewIS);
// Track register writes that implicitly clear the upper portion of the
// underlying super-registers using an APInt.
@@ -695,7 +695,7 @@ InstrBuilder::createInstruction(const MCInst &MCI) {
++WriteIndex;
}
- return NewIS;
+ return std::move(NewIS);
}
} // namespace mca
} // namespace llvm
diff --git a/llvm/lib/MCA/Pipeline.cpp b/llvm/lib/MCA/Pipeline.cpp
index 76258fcb1784..22b9d0799f77 100644
--- a/llvm/lib/MCA/Pipeline.cpp
+++ b/llvm/lib/MCA/Pipeline.cpp
@@ -40,7 +40,7 @@ Expected<unsigned> Pipeline::run() {
do {
notifyCycleBegin();
if (Error Err = runCycle())
- return Err;
+ return std::move(Err);
notifyCycleEnd();
++Cycles;
} while (hasWorkToProcess());
diff --git a/llvm/lib/Object/Archive.cpp b/llvm/lib/Object/Archive.cpp
index 4f7cea8f9e1f..17d5eec9156c 100644
--- a/llvm/lib/Object/Archive.cpp
+++ b/llvm/lib/Object/Archive.cpp
@@ -481,7 +481,7 @@ Expected<Archive::Child> Archive::Child::getNext() const {
Error Err = Error::success();
Child Ret(Parent, NextLoc, &Err);
if (Err)
- return Err;
+ return std::move(Err);
return Ret;
}
@@ -531,8 +531,8 @@ Expected<std::unique_ptr<Archive>> Archive::create(MemoryBufferRef Source) {
Error Err = Error::success();
std::unique_ptr<Archive> Ret(new Archive(Source, Err));
if (Err)
- return Err;
- return Ret;
+ return std::move(Err);
+ return std::move(Ret);
}
void Archive::setFirstRegular(const Child &C) {
@@ -852,7 +852,7 @@ Expected<Archive::Child> Archive::Symbol::getMember() const {
Error Err = Error::success();
Child C(Parent, Loc, &Err);
if (Err)
- return Err;
+ return std::move(Err);
return C;
}
diff --git a/llvm/lib/Object/ArchiveWriter.cpp b/llvm/lib/Object/ArchiveWriter.cpp
index 7af798eceed6..13dafb58f472 100644
--- a/llvm/lib/Object/ArchiveWriter.cpp
+++ b/llvm/lib/Object/ArchiveWriter.cpp
@@ -70,7 +70,7 @@ NewArchiveMember::getOldMember(const object::Archive::Child &OldMember,
return AccessModeOrErr.takeError();
M.Perms = AccessModeOrErr.get();
}
- return M;
+ return std::move(M);
}
Expected<NewArchiveMember> NewArchiveMember::getFile(StringRef FileName,
@@ -109,7 +109,7 @@ Expected<NewArchiveMember> NewArchiveMember::getFile(StringRef FileName,
M.GID = Status.getGroup();
M.Perms = Status.permissions();
}
- return M;
+ return std::move(M);
}
template <typename T>
@@ -379,7 +379,7 @@ getSymbols(MemoryBufferRef Buf, raw_ostream &SymNames, bool &HasObject) {
continue;
Ret.push_back(SymNames.tell());
if (Error E = S.printName(SymNames))
- return E;
+ return std::move(E);
SymNames << '\0';
}
return Ret;
@@ -492,7 +492,7 @@ computeMemberData(raw_ostream &StringTable, raw_ostream &SymNames,
Expected<std::vector<unsigned>> Symbols =
getSymbols(Buf, SymNames, HasObject);
if (auto E = Symbols.takeError())
- return E;
+ return std::move(E);
Pos += Header.size() + Data.size() + Padding.size();
Ret.push_back({std::move(*Symbols), std::move(Header), Data, Padding});
diff --git a/llvm/lib/Object/COFFModuleDefinition.cpp b/llvm/lib/Object/COFFModuleDefinition.cpp
index d72a1cf1aafa..8f29f7a658fd 100644
--- a/llvm/lib/Object/COFFModuleDefinition.cpp
+++ b/llvm/lib/Object/COFFModuleDefinition.cpp
@@ -151,7 +151,7 @@ class Parser {
Expected<COFFModuleDefinition> parse() {
do {
if (Error Err = parseOne())
- return Err;
+ return std::move(Err);
} while (Tok.K != Eof);
return Info;
}
diff --git a/llvm/lib/Object/COFFObjectFile.cpp b/llvm/lib/Object/COFFObjectFile.cpp
index bab9a7cc8259..2c0f6dc2b1e9 100644
--- a/llvm/lib/Object/COFFObjectFile.cpp
+++ b/llvm/lib/Object/COFFObjectFile.cpp
@@ -297,7 +297,7 @@ COFFObjectFile::getSectionContents(DataRefImpl Ref) const {
const coff_section *Sec = toSec(Ref);
ArrayRef<uint8_t> Res;
if (Error E = getSectionContents(Sec, Res))
- return E;
+ return std::move(E);
return Res;
}
@@ -1625,7 +1625,7 @@ ObjectFile::createCOFFObjectFile(MemoryBufferRef Object) {
std::unique_ptr<COFFObjectFile> Ret(new COFFObjectFile(Object, EC));
if (EC)
return errorCodeToError(EC);
- return Ret;
+ return std::move(Ret);
}
bool BaseRelocRef::operator==(const BaseRelocRef &Other) const {
@@ -1666,7 +1666,7 @@ std::error_code BaseRelocRef::getRVA(uint32_t &Result) const {
do { \
Error E = (Expr); \
if (E) \
- return E; \
+ return std::move(E); \
} while (0)
Expected<ArrayRef<UTF16>>
@@ -1832,7 +1832,7 @@ ResourceSectionRef::getContents(const coff_resource_data_entry &Entry) {
uint64_t Offset = Entry.DataRVA + Sym->getValue();
ArrayRef<uint8_t> Contents;
if (Error E = Obj->getSectionContents(Section, Contents))
- return E;
+ return std::move(E);
if (Offset + Entry.DataSize > Contents.size())
return createStringError(object_error::parse_failed,
"data outside of section");
diff --git a/llvm/lib/Object/Decompressor.cpp b/llvm/lib/Object/Decompressor.cpp
index 6682e4979edb..11efd857d1a1 100644
--- a/llvm/lib/Object/Decompressor.cpp
+++ b/llvm/lib/Object/Decompressor.cpp
@@ -26,7 +26,7 @@ Expected<Decompressor> Decompressor::create(StringRef Name, StringRef Data,
Error Err = isGnuStyle(Name) ? D.consumeCompressedGnuHeader()
: D.consumeCompressedZLibHeader(Is64Bit, IsLE);
if (Err)
- return Err;
+ return std::move(Err);
return D;
}
diff --git a/llvm/lib/Object/ELFObjectFile.cpp b/llvm/lib/Object/ELFObjectFile.cpp
index 671f7b7e6d91..bf6ffd6c37b9 100644
--- a/llvm/lib/Object/ELFObjectFile.cpp
+++ b/llvm/lib/Object/ELFObjectFile.cpp
@@ -62,7 +62,7 @@ static Expected<std::unique_ptr<ELFObjectFile<ELFT>>>
createPtr(MemoryBufferRef Object) {
auto Ret = ELFObjectFile<ELFT>::create(Object);
if (Error E = Ret.takeError())
- return E;
+ return std::move(E);
return std::make_unique<ELFObjectFile<ELFT>>(std::move(*Ret));
}
diff --git a/llvm/lib/Object/IRObjectFile.cpp b/llvm/lib/Object/IRObjectFile.cpp
index 79e8f4d681dc..636f1521262f 100644
--- a/llvm/lib/Object/IRObjectFile.cpp
+++ b/llvm/lib/Object/IRObjectFile.cpp
@@ -151,5 +151,5 @@ Expected<IRSymtabFile> object::readIRSymtab(MemoryBufferRef MBRef) {
F.Symtab = std::move(FCOrErr->Symtab);
F.Strtab = std::move(FCOrErr->Strtab);
F.TheReader = std::move(FCOrErr->TheReader);
- return F;
+ return std::move(F);
}
diff --git a/llvm/lib/Object/IRSymtab.cpp b/llvm/lib/Object/IRSymtab.cpp
index 3fde16c11546..a92cb02ed290 100644
--- a/llvm/lib/Object/IRSymtab.cpp
+++ b/llvm/lib/Object/IRSymtab.cpp
@@ -363,7 +363,7 @@ static Expected<FileContents> upgrade(ArrayRef<BitcodeModule> BMs) {
StringTableBuilder StrtabBuilder(StringTableBuilder::RAW);
BumpPtrAllocator Alloc;
if (Error E = build(Mods, FC.Symtab, StrtabBuilder, Alloc))
- return E;
+ return std::move(E);
StrtabBuilder.finalizeInOrder();
FC.Strtab.resize(StrtabBuilder.getSize());
@@ -371,7 +371,7 @@ static Expected<FileContents> upgrade(ArrayRef<BitcodeModule> BMs) {
FC.TheReader = {{FC.Symtab.data(), FC.Symtab.size()},
{FC.Strtab.data(), FC.Strtab.size()}};
- return FC;
+ return std::move(FC);
}
Expected<FileContents> irsymtab::readBitcode(const BitcodeFileContents &BFC) {
@@ -405,5 +405,5 @@ Expected<FileContents> irsymtab::readBitcode(const BitcodeFileContents &BFC) {
if (FC.TheReader.getNumModules() != BFC.Mods.size())
return upgrade(std::move(BFC.Mods));
- return FC;
+ return std::move(FC);
}
diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp
index 02e8682149be..8540b7ab03cd 100644
--- a/llvm/lib/Object/MachOObjectFile.cpp
+++ b/llvm/lib/Object/MachOObjectFile.cpp
@@ -1251,8 +1251,8 @@ MachOObjectFile::create(MemoryBufferRef Object, bool IsLittleEndian,
Is64Bits, Err, UniversalCputype,
UniversalIndex));
if (Err)
- return Err;
- return Obj;
+ return std::move(Err);
+ return std::move(Obj);
}
MachOObjectFile::MachOObjectFile(MemoryBufferRef Object, bool IsLittleEndian,
diff --git a/llvm/lib/Object/MachOUniversal.cpp b/llvm/lib/Object/MachOUniversal.cpp
index ba4b631a3abb..a178ecde949e 100644
--- a/llvm/lib/Object/MachOUniversal.cpp
+++ b/llvm/lib/Object/MachOUniversal.cpp
@@ -105,8 +105,8 @@ MachOUniversalBinary::create(MemoryBufferRef Source) {
std::unique_ptr<MachOUniversalBinary> Ret(
new MachOUniversalBinary(Source, Err));
if (Err)
- return Err;
- return Ret;
+ return std::move(Err);
+ return std::move(Ret);
}
MachOUniversalBinary::MachOUniversalBinary(MemoryBufferRef Source, Error &Err)
diff --git a/llvm/lib/Object/ObjectFile.cpp b/llvm/lib/Object/ObjectFile.cpp
index 766c59a38817..098b3d8f8dd0 100644
--- a/llvm/lib/Object/ObjectFile.cpp
+++ b/llvm/lib/Object/ObjectFile.cpp
@@ -182,7 +182,7 @@ ObjectFile::createObjectFile(StringRef ObjectPath) {
Expected<std::unique_ptr<ObjectFile>> ObjOrErr =
createObjectFile(Buffer->getMemBufferRef());
if (Error Err = ObjOrErr.takeError())
- return Err;
+ return std::move(Err);
std::unique_ptr<ObjectFile> Obj = std::move(ObjOrErr.get());
return OwningBinary<ObjectFile>(std::move(Obj), std::move(Buffer));
diff --git a/llvm/lib/Object/SymbolicFile.cpp b/llvm/lib/Object/SymbolicFile.cpp
index 921cb2170d8a..3db4ad9ed14b 100644
--- a/llvm/lib/Object/SymbolicFile.cpp
+++ b/llvm/lib/Object/SymbolicFile.cpp
@@ -82,13 +82,13 @@ SymbolicFile::createSymbolicFile(MemoryBufferRef Object, file_magic Type,
Expected<std::unique_ptr<ObjectFile>> Obj =
ObjectFile::createObjectFile(Object, Type);
if (!Obj || !Context)
- return Obj;
+ return std::move(Obj);
Expected<MemoryBufferRef> BCData =
IRObjectFile::findBitcodeInObject(*Obj->get());
if (!BCData) {
consumeError(BCData.takeError());
- return Obj;
+ return std::move(Obj);
}
return IRObjectFile::create(
diff --git a/llvm/lib/Object/TapiUniversal.cpp b/llvm/lib/Object/TapiUniversal.cpp
index c297e319fcc3..b3273e345a61 100644
--- a/llvm/lib/Object/TapiUniversal.cpp
+++ b/llvm/lib/Object/TapiUniversal.cpp
@@ -49,6 +49,6 @@ TapiUniversal::create(MemoryBufferRef Source) {
Error Err = Error::success();
std::unique_ptr<TapiUniversal> Ret(new TapiUniversal(Source, Err));
if (Err)
- return Err;
- return Ret;
+ return std::move(Err);
+ return std::move(Ret);
}
diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp
index 348cb56df95b..2e42324629f5 100644
--- a/llvm/lib/Object/WasmObjectFile.cpp
+++ b/llvm/lib/Object/WasmObjectFile.cpp
@@ -58,9 +58,9 @@ ObjectFile::createWasmObjectFile(MemoryBufferRef Buffer) {
Error Err = Error::success();
auto ObjectFile = std::make_unique<WasmObjectFile>(Buffer, Err);
if (Err)
- return Err;
+ return std::move(Err);
- return ObjectFile;
+ return std::move(ObjectFile);
}
#define VARINT7_MAX ((1 << 7) - 1)
diff --git a/llvm/lib/Object/WindowsResource.cpp b/llvm/lib/Object/WindowsResource.cpp
index dc1d86ae76a2..0cf9da43ae29 100644
--- a/llvm/lib/Object/WindowsResource.cpp
+++ b/llvm/lib/Object/WindowsResource.cpp
@@ -63,7 +63,7 @@ WindowsResource::createWindowsResource(MemoryBufferRef Source) {
Source.getBufferIdentifier() + ": too small to be a resource file",
object_error::invalid_file_type);
std::unique_ptr<WindowsResource> Ret(new WindowsResource(Source));
- return Ret;
+ return std::move(Ret);
}
Expected<ResourceEntryRef> WindowsResource::getHeadEntry() {
@@ -81,7 +81,7 @@ Expected<ResourceEntryRef>
ResourceEntryRef::create(BinaryStreamRef BSR, const WindowsResource *Owner) {
auto Ref = ResourceEntryRef(BSR, Owner);
if (auto E = Ref.loadNext())
- return E;
+ return std::move(E);
return Ref;
}
@@ -1005,7 +1005,7 @@ writeWindowsResourceCOFF(COFF::MachineTypes MachineType,
Error E = Error::success();
WindowsResourceCOFFWriter Writer(MachineType, Parser, E);
if (E)
- return E;
+ return std::move(E);
return Writer.write(TimeDateStamp);
}
diff --git a/llvm/lib/Object/XCOFFObjectFile.cpp b/llvm/lib/Object/XCOFFObjectFile.cpp
index feb8a19836c3..51fc66101646 100644
--- a/llvm/lib/Object/XCOFFObjectFile.cpp
+++ b/llvm/lib/Object/XCOFFObjectFile.cpp
@@ -604,7 +604,7 @@ XCOFFObjectFile::relocations(const XCOFFSectionHeader32 &Sec) const {
Sec.FileOffsetToRelocationInfo);
auto NumRelocEntriesOrErr = getLogicalNumberOfRelocationEntries(Sec);
if (Error E = NumRelocEntriesOrErr.takeError())
- return E;
+ return std::move(E);
uint32_t NumRelocEntries = NumRelocEntriesOrErr.get();
@@ -613,7 +613,7 @@ XCOFFObjectFile::relocations(const XCOFFSectionHeader32 &Sec) const {
getObject<XCOFFRelocation32>(Data, reinterpret_cast<void *>(RelocAddr),
NumRelocEntries * sizeof(XCOFFRelocation32));
if (Error E = RelocationOrErr.takeError())
- return E;
+ return std::move(E);
const XCOFFRelocation32 *StartReloc = RelocationOrErr.get();
@@ -639,7 +639,7 @@ XCOFFObjectFile::parseStringTable(const XCOFFObjectFile *Obj, uint64_t Offset) {
auto StringTableOrErr =
getObject<char>(Obj->Data, Obj->base() + Offset, Size);
if (Error E = StringTableOrErr.takeError())
- return E;
+ return std::move(E);
const char *StringTablePtr = StringTableOrErr.get();
if (StringTablePtr[Size - 1] != '\0')
@@ -662,7 +662,7 @@ XCOFFObjectFile::create(unsigned Type, MemoryBufferRef MBR) {
auto FileHeaderOrErr =
getObject<void>(Data, Base + CurOffset, Obj->getFileHeaderSize());
if (Error E = FileHeaderOrErr.takeError())
- return E;
+ return std::move(E);
Obj->FileHeader = FileHeaderOrErr.get();
CurOffset += Obj->getFileHeaderSize();
@@ -676,17 +676,17 @@ XCOFFObjectFile::create(unsigned Type, MemoryBufferRef MBR) {
Obj->getNumberOfSections() *
Obj->getSectionHeaderSize());
if (Error E = SecHeadersOrErr.takeError())
- return E;
+ return std::move(E);
Obj->SectionHeaderTable = SecHeadersOrErr.get();
}
// 64-bit object supports only file header and section headers for now.
if (Obj->is64Bit())
- return Obj;
+ return std::move(Obj);
// If there is no symbol table we are done parsing the memory buffer.
if (Obj->getLogicalNumberOfSymbolTableEntries32() == 0)
- return Obj;
+ return std::move(Obj);
// Parse symbol table.
CurOffset = Obj->fileHeader32()->SymbolTableOffset;
@@ -695,7 +695,7 @@ XCOFFObjectFile::create(unsigned Type, MemoryBufferRef MBR) {
auto SymTableOrErr =
getObject<XCOFFSymbolEntry>(Data, Base + CurOffset, SymbolTableSize);
if (Error E = SymTableOrErr.takeError())
- return E;
+ return std::move(E);
Obj->SymbolTblPtr = SymTableOrErr.get();
CurOffset += SymbolTableSize;
@@ -703,10 +703,10 @@ XCOFFObjectFile::create(unsigned Type, MemoryBufferRef MBR) {
Expected<XCOFFStringTable> StringTableOrErr =
parseStringTable(Obj.get(), CurOffset);
if (Error E = StringTableOrErr.takeError())
- return E;
+ return std::move(E);
Obj->StringTable = StringTableOrErr.get();
- return Obj;
+ return std::move(Obj);
}
Expected<std::unique_ptr<ObjectFile>>
diff --git a/llvm/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp b/llvm/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp
index 65843418cdae..02f053bb0e0f 100644
--- a/llvm/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp
+++ b/llvm/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp
@@ -694,11 +694,11 @@ YAMLStringTableSubsection::fromCodeViewSubsection(
StringRef S;
// First item is a single null string, skip it.
if (auto EC = Reader.readCString(S))
- return EC;
+ return std::move(EC);
assert(S.empty());
while (Reader.bytesRemaining() > 0) {
if (auto EC = Reader.readCString(S))
- return EC;
+ return std::move(EC);
Result->Strings.push_back(S);
}
return Result;
@@ -749,7 +749,7 @@ llvm::CodeViewYAML::toCodeViewSubsectionList(
const codeview::StringsAndChecksums &SC) {
std::vector<std::shared_ptr<DebugSubsection>> Result;
if (Subsections.empty())
- return Result;
+ return std::move(Result);
for (const auto &SS : Subsections) {
std::shared_ptr<DebugSubsection> CVS;
@@ -757,7 +757,7 @@ llvm::CodeViewYAML::toCodeViewSubsectionList(
assert(CVS != nullptr);
Result.push_back(std::move(CVS));
}
- return Result;
+ return std::move(Result);
}
namespace {
@@ -892,7 +892,7 @@ YAMLDebugSubsection::fromCodeViewSubection(const StringsAndChecksumsRef &SC,
const DebugSubsectionRecord &SS) {
SubsectionConversionVisitor V;
if (auto EC = visitDebugSubsection(SS, V, SC))
- return EC;
+ return std::move(EC);
return V.Subsection;
}
diff --git a/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp b/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
index 094e298c76a0..95409fdc3300 100644
--- a/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
+++ b/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
@@ -585,7 +585,7 @@ fromCodeViewSymbolImpl(CVSymbol Symbol) {
auto Impl = std::make_shared<SymbolType>(Symbol.kind());
if (auto EC = Impl->fromCodeViewSymbol(Symbol))
- return EC;
+ return std::move(EC);
Result.Symbol = Impl;
return Result;
}
diff --git a/llvm/lib/ObjectYAML/CodeViewYAMLTypes.cpp b/llvm/lib/ObjectYAML/CodeViewYAMLTypes.cpp
index a830e829951e..a5e3ce1e71e8 100644
--- a/llvm/lib/ObjectYAML/CodeViewYAMLTypes.cpp
+++ b/llvm/lib/ObjectYAML/CodeViewYAMLTypes.cpp
@@ -671,7 +671,7 @@ static inline Expected<LeafRecord> fromCodeViewRecordImpl(CVType Type) {
auto Impl = std::make_shared<LeafRecordImpl<T>>(Type.kind());
if (auto EC = Impl->fromCodeViewRecord(Type))
- return EC;
+ return std::move(EC);
Result.Leaf = Impl;
return Result;
}
diff --git a/llvm/lib/ObjectYAML/DWARFEmitter.cpp b/llvm/lib/ObjectYAML/DWARFEmitter.cpp
index db99ad9bf795..b410fed16f09 100644
--- a/llvm/lib/ObjectYAML/DWARFEmitter.cpp
+++ b/llvm/lib/ObjectYAML/DWARFEmitter.cpp
@@ -377,5 +377,5 @@ DWARFYAML::EmitDebugSections(StringRef YAMLString, bool ApplyFixups,
DebugSections);
EmitDebugSectionImpl(DI, &DWARFYAML::EmitDebugAranges, "debug_aranges",
DebugSections);
- return DebugSections;
+ return std::move(DebugSections);
}
diff --git a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
index 6509afa82a5a..9d39b7c63f8f 100644
--- a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
+++ b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
@@ -284,14 +284,14 @@ Expected<std::unique_ptr<CoverageMapping>> CoverageMapping::load(
for (const auto &CoverageReader : CoverageReaders) {
for (auto RecordOrErr : *CoverageReader) {
if (Error E = RecordOrErr.takeError())
- return E;
+ return std::move(E);
const auto &Record = *RecordOrErr;
if (Error E = Coverage->loadFunctionRecord(Record, ProfileReader))
- return E;
+ return std::move(E);
}
}
- return Coverage;
+ return std::move(Coverage);
}
// If E is a no_data_found error, returns success. Otherwise returns E.
@@ -309,7 +309,7 @@ CoverageMapping::load(ArrayRef<StringRef> ObjectFilenames,
StringRef ProfileFilename, ArrayRef<StringRef> Arches) {
auto ProfileReaderOrErr = IndexedInstrProfReader::create(ProfileFilename);
if (Error E = ProfileReaderOrErr.takeError())
- return E;
+ return std::move(E);
auto ProfileReader = std::move(ProfileReaderOrErr.get());
SmallVector<std::unique_ptr<CoverageMappingReader>, 4> Readers;
@@ -326,7 +326,7 @@ CoverageMapping::load(ArrayRef<StringRef> ObjectFilenames,
if (Error E = CoverageReadersOrErr.takeError()) {
E = handleMaybeNoDataFoundError(std::move(E));
if (E)
- return E;
+ return std::move(E);
// E == success (originally a no_data_found error).
continue;
}
diff --git a/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp b/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
index b2132009bb3c..679ff3525eeb 100644
--- a/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
+++ b/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
@@ -321,28 +321,28 @@ Expected<bool> RawCoverageMappingDummyChecker::isDummy() {
// A dummy coverage mapping data consists of just one region with zero count.
uint64_t NumFileMappings;
if (Error Err = readSize(NumFileMappings))
- return Err;
+ return std::move(Err);
if (NumFileMappings != 1)
return false;
// We don't expect any specific value for the filename index, just skip it.
uint64_t FilenameIndex;
if (Error Err =
readIntMax(FilenameIndex, std::numeric_limits<unsigned>::max()))
- return Err;
+ return std::move(Err);
uint64_t NumExpressions;
if (Error Err = readSize(NumExpressions))
- return Err;
+ return std::move(Err);
if (NumExpressions != 0)
return false;
uint64_t NumRegions;
if (Error Err = readSize(NumRegions))
- return Err;
+ return std::move(Err);
if (NumRegions != 1)
return false;
uint64_t EncodedCounterAndRegion;
if (Error Err = readIntMax(EncodedCounterAndRegion,
std::numeric_limits<unsigned>::max()))
- return Err;
+ return std::move(Err);
unsigned Tag = EncodedCounterAndRegion & Counter::EncodingTagMask;
return Tag == Counter::Zero;
}
@@ -494,7 +494,7 @@ class VersionedCovMapFuncRecordReader : public CovMapFuncRecordReader {
size_t FilenamesBegin = Filenames.size();
RawCoverageFilenamesReader Reader(StringRef(Buf, FilenamesSize), Filenames);
if (auto Err = Reader.read())
- return Err;
+ return std::move(Err);
Buf += FilenamesSize;
// We'll read the coverage mapping records in the loop below.
@@ -521,7 +521,7 @@ class VersionedCovMapFuncRecordReader : public CovMapFuncRecordReader {
if (Error Err =
insertFunctionRecordIfNeeded(CFR, Mapping, FilenamesBegin))
- return Err;
+ return std::move(Err);
CFR++;
}
return Buf;
@@ -545,7 +545,7 @@ Expected<std::unique_ptr<CovMapFuncRecordReader>> CovMapFuncRecordReader::get(
case CovMapVersion::Version3:
// Decompress the name data.
if (Error E = P.create(P.getNameData()))
- return E;
+ return std::move(E);
if (Version == CovMapVersion::Version2)
return std::make_unique<VersionedCovMapFuncRecordReader<
CovMapVersion::Version2, IntPtrT, Endian>>(P, R, F);
@@ -597,26 +597,26 @@ BinaryCoverageReader::createCoverageReaderFromBuffer(
readCoverageMappingData<uint32_t, support::endianness::little>(
Reader->ProfileNames, Coverage, Reader->MappingRecords,
Reader->Filenames))
- return E;
+ return std::move(E);
} else if (BytesInAddress == 4 && Endian == support::endianness::big) {
if (Error E = readCoverageMappingData<uint32_t, support::endianness::big>(
Reader->ProfileNames, Coverage, Reader->MappingRecords,
Reader->Filenames))
- return E;
+ return std::move(E);
} else if (BytesInAddress == 8 && Endian == support::endianness::little) {
if (Error E =
readCoverageMappingData<uint64_t, support::endianness::little>(
Reader->ProfileNames, Coverage, Reader->MappingRecords,
Reader->Filenames))
- return E;
+ return std::move(E);
} else if (BytesInAddress == 8 && Endian == support::endianness::big) {
if (Error E = readCoverageMappingData<uint64_t, support::endianness::big>(
Reader->ProfileNames, Coverage, Reader->MappingRecords,
Reader->Filenames))
- return E;
+ return std::move(E);
} else
return make_error<CoverageMapError>(coveragemap_error::malformed);
- return Reader;
+ return std::move(Reader);
}
static Expected<std::unique_ptr<BinaryCoverageReader>>
@@ -643,7 +643,7 @@ loadTestingFormat(StringRef Data) {
return make_error<CoverageMapError>(coveragemap_error::malformed);
InstrProfSymtab ProfileNames;
if (Error E = ProfileNames.create(Data.substr(0, ProfileNamesSize), Address))
- return E;
+ return std::move(E);
StringRef CoverageMapping = Data.substr(ProfileNamesSize);
// Skip the padding bytes because coverage map data has an alignment of 8.
if (CoverageMapping.empty())
@@ -708,12 +708,12 @@ loadBinaryFormat(std::unique_ptr<Binary> Bin, StringRef Arch) {
lookupSection(*OF, getInstrProfSectionName(IPSK_name, ObjFormat,
/*AddSegmentInfo=*/false));
if (auto E = NamesSection.takeError())
- return E;
+ return std::move(E);
auto CoverageSection =
lookupSection(*OF, getInstrProfSectionName(IPSK_covmap, ObjFormat,
/*AddSegmentInfo=*/false));
if (auto E = CoverageSection.takeError())
- return E;
+ return std::move(E);
// Get the contents of the given sections.
auto CoverageMappingOrErr = CoverageSection->getContents();
@@ -722,7 +722,7 @@ loadBinaryFormat(std::unique_ptr<Binary> Bin, StringRef Arch) {
InstrProfSymtab ProfileNames;
if (Error E = ProfileNames.create(*NamesSection))
- return E;
+ return std::move(E);
return BinaryCoverageReader::createCoverageReaderFromBuffer(
CoverageMappingOrErr.get(), std::move(ProfileNames), BytesInAddress,
@@ -741,7 +741,7 @@ BinaryCoverageReader::create(
if (!ReaderOrErr)
return ReaderOrErr.takeError();
Readers.push_back(std::move(ReaderOrErr.get()));
- return Readers;
+ return std::move(Readers);
}
auto BinOrErr = createBinary(ObjectBuffer);
@@ -786,7 +786,7 @@ BinaryCoverageReader::create(
Readers.push_back(std::move(Reader));
}
if (Err)
- return Err;
+ return std::move(Err);
// Thin archives reference object files outside of the archive file, i.e.
// files which reside in memory not owned by the caller. Transfer ownership
@@ -795,14 +795,14 @@ BinaryCoverageReader::create(
for (auto &Buffer : Ar->takeThinBuffers())
ObjectFileBuffers.push_back(std::move(Buffer));
- return Readers;
+ return std::move(Readers);
}
auto ReaderOrErr = loadBinaryFormat(std::move(Bin), Arch);
if (!ReaderOrErr)
return ReaderOrErr.takeError();
Readers.push_back(std::move(ReaderOrErr.get()));
- return Readers;
+ return std::move(Readers);
}
Error BinaryCoverageReader::readNextRecord(CoverageMappingRecord &Record) {
diff --git a/llvm/lib/ProfileData/GCOV.cpp b/llvm/lib/ProfileData/GCOV.cpp
index 6331be3b237b..0c4006d867a6 100644
--- a/llvm/lib/ProfileData/GCOV.cpp
+++ b/llvm/lib/ProfileData/GCOV.cpp
@@ -711,7 +711,7 @@ FileInfo::openCoveragePath(StringRef CoveragePath) {
errs() << EC.message() << "\n";
return std::make_unique<raw_null_ostream>();
}
- return OS;
+ return std::move(OS);
}
/// print - Print source files with collected line count information.
diff --git a/llvm/lib/ProfileData/InstrProf.cpp b/llvm/lib/ProfileData/InstrProf.cpp
index 30d2a0e781d2..1859127b4a2f 100644
--- a/llvm/lib/ProfileData/InstrProf.cpp
+++ b/llvm/lib/ProfileData/InstrProf.cpp
@@ -891,9 +891,9 @@ ValueProfData::getValueProfData(const unsigned char *D,
Error E = VPD->checkIntegrity();
if (E)
- return E;
+ return std::move(E);
- return VPD;
+ return std::move(VPD);
}
void ValueProfData::swapBytesToHost(support::endianness Endianness) {
diff --git a/llvm/lib/ProfileData/InstrProfReader.cpp b/llvm/lib/ProfileData/InstrProfReader.cpp
index d7f987e7f9ee..b904f983dceb 100644
--- a/llvm/lib/ProfileData/InstrProfReader.cpp
+++ b/llvm/lib/ProfileData/InstrProfReader.cpp
@@ -55,7 +55,7 @@ InstrProfReader::create(const Twine &Path) {
// Set up the buffer to read.
auto BufferOrError = setupMemoryBuffer(Path);
if (Error E = BufferOrError.takeError())
- return E;
+ return std::move(E);
return InstrProfReader::create(std::move(BufferOrError.get()));
}
@@ -83,9 +83,9 @@ InstrProfReader::create(std::unique_ptr<MemoryBuffer> Buffer) {
// Initialize the reader and return the result.
if (Error E = initializeReader(*Result))
- return E;
+ return std::move(E);
- return Result;
+ return std::move(Result);
}
Expected<std::unique_ptr<IndexedInstrProfReader>>
@@ -93,7 +93,7 @@ IndexedInstrProfReader::create(const Twine &Path, const Twine &RemappingPath) {
// Set up the buffer to read.
auto BufferOrError = setupMemoryBuffer(Path);
if (Error E = BufferOrError.takeError())
- return E;
+ return std::move(E);
// Set up the remapping buffer if requested.
std::unique_ptr<MemoryBuffer> RemappingBuffer;
@@ -101,7 +101,7 @@ IndexedInstrProfReader::create(const Twine &Path, const Twine &RemappingPath) {
if (!RemappingPathStr.empty()) {
auto RemappingBufferOrError = setupMemoryBuffer(RemappingPathStr);
if (Error E = RemappingBufferOrError.takeError())
- return E;
+ return std::move(E);
RemappingBuffer = std::move(RemappingBufferOrError.get());
}
@@ -124,9 +124,9 @@ IndexedInstrProfReader::create(std::unique_ptr<MemoryBuffer> Buffer,
// Initialize the reader and return the result.
if (Error E = initializeReader(*Result))
- return E;
+ return std::move(E);
- return Result;
+ return std::move(Result);
}
void InstrProfIterator::Increment() {
@@ -874,7 +874,7 @@ IndexedInstrProfReader::getInstrProfRecord(StringRef FuncName,
ArrayRef<NamedInstrProfRecord> Data;
Error Err = Remapper->getRecords(FuncName, Data);
if (Err)
- return Err;
+ return std::move(Err);
// Found it. Look for counters with the right hash.
for (unsigned I = 0, E = Data.size(); I < E; ++I) {
// Check for a match and fill the vector if there is one.
diff --git a/llvm/lib/ProfileData/SampleProfReader.cpp b/llvm/lib/ProfileData/SampleProfReader.cpp
index 5a673931b3f3..6f74cec07b96 100644
--- a/llvm/lib/ProfileData/SampleProfReader.cpp
+++ b/llvm/lib/ProfileData/SampleProfReader.cpp
@@ -1250,7 +1250,7 @@ setupMemoryBuffer(const Twine &Filename) {
if (uint64_t(Buffer->getBufferSize()) > std::numeric_limits<uint32_t>::max())
return sampleprof_error::too_large;
- return Buffer;
+ return std::move(Buffer);
}
/// Create a sample profile reader based on the format of the input file.
@@ -1362,7 +1362,7 @@ SampleProfileReader::create(std::unique_ptr<MemoryBuffer> &B, LLVMContext &C,
return EC;
}
- return Reader;
+ return std::move(Reader);
}
// For text and GCC file formats, we compute the summary after reading the
diff --git a/llvm/lib/ProfileData/SampleProfWriter.cpp b/llvm/lib/ProfileData/SampleProfWriter.cpp
index dbb0f309cadc..8d09af31f94b 100644
--- a/llvm/lib/ProfileData/SampleProfWriter.cpp
+++ b/llvm/lib/ProfileData/SampleProfWriter.cpp
@@ -607,7 +607,7 @@ SampleProfileWriter::create(std::unique_ptr<raw_ostream> &OS,
return EC;
Writer->Format = Format;
- return Writer;
+ return std::move(Writer);
}
void SampleProfileWriter::computeSummary(
diff --git a/llvm/lib/Remarks/BitstreamRemarkParser.cpp b/llvm/lib/Remarks/BitstreamRemarkParser.cpp
index c1fedfbf09a8..25fbea7d31c2 100644
--- a/llvm/lib/Remarks/BitstreamRemarkParser.cpp
+++ b/llvm/lib/Remarks/BitstreamRemarkParser.cpp
@@ -266,7 +266,7 @@ static Expected<bool> isBlock(BitstreamCursor &Stream, unsigned BlockID) {
break;
}
if (Error E = Stream.JumpToBit(PreviousBitNo))
- return E;
+ return std::move(E);
return Result;
}
@@ -316,7 +316,7 @@ remarks::createBitstreamParserFromMeta(
if (Error E = validateMagicNumber(
StringRef(MagicNumber->data(), MagicNumber->size())))
- return E;
+ return std::move(E);
auto Parser =
StrTab ? std::make_unique<BitstreamRemarkParser>(Buf, std::move(*StrTab))
@@ -325,7 +325,7 @@ remarks::createBitstreamParserFromMeta(
if (ExternalFilePrependPath)
Parser->ExternalFilePrependPath = std::string(*ExternalFilePrependPath);
- return Parser;
+ return std::move(Parser);
}
Expected<std::unique_ptr<Remark>> BitstreamRemarkParser::next() {
@@ -334,7 +334,7 @@ Expected<std::unique_ptr<Remark>> BitstreamRemarkParser::next() {
if (!ReadyToParseRemarks) {
if (Error E = parseMeta())
- return E;
+ return std::move(E);
ReadyToParseRemarks = true;
}
@@ -491,7 +491,7 @@ Error BitstreamRemarkParser::processSeparateRemarksMetaMeta(
Expected<std::unique_ptr<Remark>> BitstreamRemarkParser::parseRemark() {
BitstreamRemarkParserHelper RemarkHelper(ParserHelper.Stream);
if (Error E = RemarkHelper.parse())
- return E;
+ return std::move(E);
return processRemark(RemarkHelper);
}
@@ -562,7 +562,7 @@ BitstreamRemarkParser::processRemark(BitstreamRemarkParserHelper &Helper) {
R.Hotness = *Helper.Hotness;
if (!Helper.Args)
- return Result;
+ return std::move(Result);
for (const BitstreamRemarkParserHelper::Argument &Arg : *Helper.Args) {
if (!Arg.KeyIdx)
@@ -600,5 +600,5 @@ BitstreamRemarkParser::processRemark(BitstreamRemarkParserHelper &Helper) {
}
}
- return Result;
+ return std::move(Result);
}
diff --git a/llvm/lib/Remarks/YAMLRemarkParser.cpp b/llvm/lib/Remarks/YAMLRemarkParser.cpp
index a48b2b85d69f..dd834d85676e 100644
--- a/llvm/lib/Remarks/YAMLRemarkParser.cpp
+++ b/llvm/lib/Remarks/YAMLRemarkParser.cpp
@@ -164,7 +164,7 @@ remarks::createYAMLParserFromMeta(StringRef Buf,
: std::make_unique<YAMLRemarkParser>(Buf);
if (SeparateBuf)
Result->SeparateBuf = std::move(SeparateBuf);
- return Result;
+ return std::move(Result);
}
YAMLRemarkParser::YAMLRemarkParser(StringRef Buf)
@@ -190,7 +190,7 @@ Error YAMLRemarkParser::error() {
Expected<std::unique_ptr<Remark>>
YAMLRemarkParser::parseRemark(yaml::Document &RemarkEntry) {
if (Error E = error())
- return E;
+ return std::move(E);
yaml::Node *YAMLRoot = RemarkEntry.getRoot();
if (!YAMLRoot) {
@@ -267,7 +267,7 @@ YAMLRemarkParser::parseRemark(yaml::Document &RemarkEntry) {
return error("Type, Pass, Name or Function missing.",
*RemarkEntry.getRoot());
- return Result;
+ return std::move(Result);
}
Expected<Type> YAMLRemarkParser::parseType(yaml::MappingNode &Node) {
diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp
index 6b72593dae45..03f0bb1f705e 100644
--- a/llvm/lib/Support/APFloat.cpp
+++ b/llvm/lib/Support/APFloat.cpp
@@ -2518,7 +2518,7 @@ IEEEFloat::convertFromDecimalString(StringRef str, roundingMode rounding_mode) {
/* Scan the text. */
StringRef::iterator p = str.begin();
if (Error Err = interpretDecimal(p, str.end(), &D))
- return Err;
+ return std::move(Err);
/* Handle the quick cases. First the case of no significant digits,
i.e. zero, and then exponents that are obviously too large or too
diff --git a/llvm/lib/Support/FileCheck.cpp b/llvm/lib/Support/FileCheck.cpp
index 5c5a510afe5c..23e1ece2113e 100644
--- a/llvm/lib/Support/FileCheck.cpp
+++ b/llvm/lib/Support/FileCheck.cpp
@@ -86,7 +86,7 @@ Expected<uint64_t> BinaryOperation::eval() const {
Err = joinErrors(std::move(Err), LeftOp.takeError());
if (!RightOp)
Err = joinErrors(std::move(Err), RightOp.takeError());
- return Err;
+ return std::move(Err);
}
return EvalBinop(*LeftOp, *RightOp);
@@ -284,7 +284,7 @@ Pattern::parseBinop(StringRef &Expr, std::unique_ptr<ExpressionAST> LeftOp,
FileCheckPatternContext *Context, const SourceMgr &SM) {
Expr = Expr.ltrim(SpaceChars);
if (Expr.empty())
- return LeftOp;
+ return std::move(LeftOp);
// Check if this is a supported operation and select a function to perform
// it.
@@ -425,7 +425,7 @@ Expected<std::unique_ptr<Expression>> Pattern::parseNumericSubstitutionBlock(
DefinedNumericVariable = *ParseResult;
}
- return ExpressionPointer;
+ return std::move(ExpressionPointer);
}
bool Pattern::parsePattern(StringRef PatternStr, StringRef Prefix,
diff --git a/llvm/lib/Support/JSON.cpp b/llvm/lib/Support/JSON.cpp
index d44eafaca727..16b1d11efd08 100644
--- a/llvm/lib/Support/JSON.cpp
+++ b/llvm/lib/Support/JSON.cpp
@@ -513,7 +513,7 @@ Expected<Value> parse(StringRef JSON) {
if (P.checkUTF8())
if (P.parseValue(E))
if (P.assertEnd())
- return E;
+ return std::move(E);
return P.takeError();
}
char ParseError::ID = 0;
diff --git a/llvm/lib/Support/MemoryBuffer.cpp b/llvm/lib/Support/MemoryBuffer.cpp
index a7c7c357fe2f..e4027ca7bbfd 100644
--- a/llvm/lib/Support/MemoryBuffer.cpp
+++ b/llvm/lib/Support/MemoryBuffer.cpp
@@ -128,7 +128,7 @@ getMemBufferCopyImpl(StringRef InputData, const Twine &BufferName) {
if (!Buf)
return make_error_code(errc::not_enough_memory);
memcpy(Buf->getBufferStart(), InputData.data(), InputData.size());
- return Buf;
+ return std::move(Buf);
}
std::unique_ptr<MemoryBuffer>
@@ -398,7 +398,7 @@ getReadWriteFile(const Twine &Filename, uint64_t FileSize, uint64_t MapSize,
Offset, EC));
if (EC)
return EC;
- return Result;
+ return std::move(Result);
}
ErrorOr<std::unique_ptr<WriteThroughMemoryBuffer>>
@@ -450,7 +450,7 @@ getOpenFileImpl(sys::fs::file_t FD, const Twine &Filename, uint64_t FileSize,
new (NamedBufferAlloc(Filename)) MemoryBufferMMapFile<MB>(
RequiresNullTerminator, FD, MapSize, Offset, EC));
if (!EC)
- return Result;
+ return std::move(Result);
}
auto Buf = WritableMemoryBuffer::getNewUninitMemBuffer(MapSize, Filename);
@@ -475,7 +475,7 @@ getOpenFileImpl(sys::fs::file_t FD, const Twine &Filename, uint64_t FileSize,
Offset += *ReadBytes;
}
- return Buf;
+ return std::move(Buf);
}
ErrorOr<std::unique_ptr<MemoryBuffer>>
diff --git a/llvm/lib/Support/Path.cpp b/llvm/lib/Support/Path.cpp
index 85698f1289bf..fa3bf47569e8 100644
--- a/llvm/lib/Support/Path.cpp
+++ b/llvm/lib/Support/Path.cpp
@@ -1264,7 +1264,7 @@ Expected<TempFile> TempFile::create(const Twine &Model, unsigned Mode) {
return errorCodeToError(EC);
}
#endif
- return Ret;
+ return std::move(Ret);
}
}
diff --git a/llvm/lib/Support/YAMLTraits.cpp b/llvm/lib/Support/YAMLTraits.cpp
index de7da63609e1..5f0cedc71829 100644
--- a/llvm/lib/Support/YAMLTraits.cpp
+++ b/llvm/lib/Support/YAMLTraits.cpp
@@ -388,7 +388,7 @@ std::unique_ptr<Input::HNode> Input::createHNodes(Node *N) {
break;
SQHNode->Entries.push_back(std::move(Entry));
}
- return SQHNode;
+ return std::move(SQHNode);
} else if (MappingNode *Map = dyn_cast<MappingNode>(N)) {
auto mapHNode = std::make_unique<MapHNode>(N);
for (KeyValueNode &KVN : *Map) {
@@ -413,7 +413,7 @@ std::unique_ptr<Input::HNode> Input::createHNodes(Node *N) {
break;
mapHNode->Mapping[KeyStr] = std::move(ValueHNode);
}
- return mapHNode;
+ return std::move(mapHNode);
} else if (isa<NullNode>(N)) {
return std::make_unique<EmptyHNode>(N);
} else {
diff --git a/llvm/lib/TableGen/JSONBackend.cpp b/llvm/lib/TableGen/JSONBackend.cpp
index b2e6be6a04f5..196644cda667 100644
--- a/llvm/lib/TableGen/JSONBackend.cpp
+++ b/llvm/lib/TableGen/JSONBackend.cpp
@@ -54,7 +54,7 @@ json::Value JSONEmitter::translateInit(const Init &I) {
json::Array array;
for (unsigned i = 0, limit = Bits->getNumBits(); i < limit; i++)
array.push_back(translateInit(*Bits->getBit(i)));
- return array;
+ return std::move(array);
} else if (auto *Int = dyn_cast<IntInit>(&I)) {
return Int->getValue();
} else if (auto *Str = dyn_cast<StringInit>(&I)) {
@@ -65,7 +65,7 @@ json::Value JSONEmitter::translateInit(const Init &I) {
json::Array array;
for (auto val : *List)
array.push_back(translateInit(*val));
- return array;
+ return std::move(array);
}
// Init subclasses that we return as JSON objects containing a
@@ -79,17 +79,17 @@ json::Value JSONEmitter::translateInit(const Init &I) {
if (auto *Def = dyn_cast<DefInit>(&I)) {
obj["kind"] = "def";
obj["def"] = Def->getDef()->getName();
- return obj;
+ return std::move(obj);
} else if (auto *Var = dyn_cast<VarInit>(&I)) {
obj["kind"] = "var";
obj["var"] = Var->getName();
- return obj;
+ return std::move(obj);
} else if (auto *VarBit = dyn_cast<VarBitInit>(&I)) {
if (auto *Var = dyn_cast<VarInit>(VarBit->getBitVar())) {
obj["kind"] = "varbit";
obj["var"] = Var->getName();
obj["index"] = VarBit->getBitNum();
- return obj;
+ return std::move(obj);
}
} else if (auto *Dag = dyn_cast<DagInit>(&I)) {
obj["kind"] = "dag";
@@ -107,7 +107,7 @@ json::Value JSONEmitter::translateInit(const Init &I) {
args.push_back(std::move(arg));
}
obj["args"] = std::move(args);
- return obj;
+ return std::move(obj);
}
// Final fallback: anything that gets past here is simply given a
@@ -116,7 +116,7 @@ json::Value JSONEmitter::translateInit(const Init &I) {
assert(!I.isConcrete());
obj["kind"] = "complex";
- return obj;
+ return std::move(obj);
}
void JSONEmitter::run(raw_ostream &OS) {
diff --git a/llvm/lib/TextAPI/ELF/TBEHandler.cpp b/llvm/lib/TextAPI/ELF/TBEHandler.cpp
index f1357e1112ad..cb597d8896e8 100644
--- a/llvm/lib/TextAPI/ELF/TBEHandler.cpp
+++ b/llvm/lib/TextAPI/ELF/TBEHandler.cpp
@@ -149,7 +149,7 @@ Expected<std::unique_ptr<ELFStub>> elfabi::readTBEFromBuffer(StringRef Buf) {
if (std::error_code Err = YamlIn.error())
return createStringError(Err, "YAML failed reading as TBE");
- return Stub;
+ return std::move(Stub);
}
Error elfabi::writeTBEToOutputStream(raw_ostream &OS, const ELFStub &Stub) {
diff --git a/llvm/lib/TextAPI/MachO/TextStub.cpp b/llvm/lib/TextAPI/MachO/TextStub.cpp
index 2a99d35a5ab0..cdfe7f47ee61 100644
--- a/llvm/lib/TextAPI/MachO/TextStub.cpp
+++ b/llvm/lib/TextAPI/MachO/TextStub.cpp
@@ -1122,7 +1122,7 @@ TextAPIReader::get(MemoryBufferRef InputBuffer) {
if (YAMLIn.error())
return make_error<StringError>(Ctx.ErrorMessage, YAMLIn.error());
- return File;
+ return std::move(File);
}
Error TextAPIWriter::writeToStream(raw_ostream &OS, const InterfaceFile &File) {
diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp
index a349020b3235..55b5c0377f28 100644
--- a/llvm/lib/Transforms/IPO/FunctionImport.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp
@@ -1154,7 +1154,7 @@ Expected<bool> FunctionImporter::importFunctions(
// If modules were created with lazy metadata loading, materialize it
// now, before linking it (otherwise this will be a noop).
if (Error Err = SrcModule->materializeMetadata())
- return Err;
+ return std::move(Err);
auto &ImportGUIDs = FunctionsToImportPerModule->second;
// Find the globals to import
@@ -1169,7 +1169,7 @@ Expected<bool> FunctionImporter::importFunctions(
<< SrcModule->getSourceFileName() << "\n");
if (Import) {
if (Error Err = F.materialize())
- return Err;
+ return std::move(Err);
if (EnableImportMetadata) {
// Add 'thinlto_src_module' metadata for statistics and debugging.
F.setMetadata(
@@ -1191,7 +1191,7 @@ Expected<bool> FunctionImporter::importFunctions(
<< SrcModule->getSourceFileName() << "\n");
if (Import) {
if (Error Err = GV.materialize())
- return Err;
+ return std::move(Err);
ImportedGVCount += GlobalsToImport.insert(&GV);
}
}
@@ -1205,11 +1205,11 @@ Expected<bool> FunctionImporter::importFunctions(
<< SrcModule->getSourceFileName() << "\n");
if (Import) {
if (Error Err = GA.materialize())
- return Err;
+ return std::move(Err);
// Import alias as a copy of its aliasee.
GlobalObject *Base = GA.getBaseObject();
if (Error Err = Base->materialize())
- return Err;
+ return std::move(Err);
auto *Fn = replaceAliasWithAliasee(SrcModule.get(), &GA);
LLVM_DEBUG(dbgs() << "Is importing aliasee fn " << Base->getGUID()
<< " " << Base->getName() << " from "
diff --git a/llvm/lib/XRay/FDRRecordProducer.cpp b/llvm/lib/XRay/FDRRecordProducer.cpp
index 0a5ece55bee6..479b710444be 100644
--- a/llvm/lib/XRay/FDRRecordProducer.cpp
+++ b/llvm/lib/XRay/FDRRecordProducer.cpp
@@ -101,8 +101,8 @@ FileBasedRecordProducer::findNextBufferExtent() {
R = std::move(MetadataRecordOrErr.get());
RecordInitializer RI(E, OffsetPtr);
if (auto Err = R->apply(RI))
- return Err;
- return R;
+ return std::move(Err);
+ return std::move(R);
}
}
}
@@ -132,7 +132,7 @@ Expected<std::unique_ptr<Record>> FileBasedRecordProducer::produce() {
assert(isa<BufferExtents>(R.get()));
auto BE = cast<BufferExtents>(R.get());
CurrentBufferBytes = BE->size();
- return R;
+ return std::move(R);
}
//
@@ -172,7 +172,7 @@ Expected<std::unique_ptr<Record>> FileBasedRecordProducer::produce() {
RecordInitializer RI(E, OffsetPtr);
if (auto Err = R->apply(RI))
- return Err;
+ return std::move(Err);
// If we encountered a BufferExtents record, we should record the remaining
// bytes for the current buffer, to determine when we should start ignoring
@@ -191,7 +191,7 @@ Expected<std::unique_ptr<Record>> FileBasedRecordProducer::produce() {
CurrentBufferBytes -= OffsetPtr - PreReadOffset;
}
assert(R != nullptr);
- return R;
+ return std::move(R);
}
} // namespace xray
diff --git a/llvm/lib/XRay/FileHeaderReader.cpp b/llvm/lib/XRay/FileHeaderReader.cpp
index e0cb40df2063..6b6daf9deba5 100644
--- a/llvm/lib/XRay/FileHeaderReader.cpp
+++ b/llvm/lib/XRay/FileHeaderReader.cpp
@@ -66,7 +66,7 @@ Expected<XRayFileHeader> readBinaryFormatHeader(DataExtractor &HeaderExtractor,
// Manually advance the offset pointer 16 bytes, after getting a raw memcpy
// from the underlying data.
OffsetPtr += 16;
- return FileHeader;
+ return std::move(FileHeader);
}
} // namespace xray
diff --git a/llvm/lib/XRay/InstrumentationMap.cpp b/llvm/lib/XRay/InstrumentationMap.cpp
index 79c343fe8db7..1e9b69a5f9dc 100644
--- a/llvm/lib/XRay/InstrumentationMap.cpp
+++ b/llvm/lib/XRay/InstrumentationMap.cpp
@@ -232,26 +232,26 @@ llvm::xray::loadInstrumentationMap(StringRef Filename) {
if (!FdOrErr) {
// Report the ELF load error if YAML failed.
consumeError(FdOrErr.takeError());
- return E;
+ return std::move(E);
}
uint64_t FileSize;
if (sys::fs::file_size(Filename, FileSize))
- return E;
+ return std::move(E);
// If the file is empty, we return the original error.
if (FileSize == 0)
- return E;
+ return std::move(E);
// From this point on the errors will be only for the YAML parts, so we
// consume the errors at this point.
consumeError(std::move(E));
if (auto E = loadYAML(*FdOrErr, FileSize, Filename, Map.Sleds,
Map.FunctionAddresses, Map.FunctionIds))
- return E;
+ return std::move(E);
} else if (auto E = loadObj(Filename, *ObjectFileOrError, Map.Sleds,
Map.FunctionAddresses, Map.FunctionIds)) {
- return E;
+ return std::move(E);
}
return Map;
}
diff --git a/llvm/lib/XRay/Profile.cpp b/llvm/lib/XRay/Profile.cpp
index 8aa8eaf9b74b..c1a43632b600 100644
--- a/llvm/lib/XRay/Profile.cpp
+++ b/llvm/lib/XRay/Profile.cpp
@@ -90,7 +90,7 @@ static Expected<std::vector<Profile::FuncID>> readPath(DataExtractor &Extractor,
CurrentOffset = Offset;
Path.push_back(FuncId);
} while (FuncId != 0);
- return Path;
+ return std::move(Path);
}
static Expected<Profile::Data> readData(DataExtractor &Extractor,
@@ -137,7 +137,7 @@ Expected<std::vector<Profile::FuncID>> Profile::expandPath(PathID P) const {
std::vector<Profile::FuncID> Path;
for (auto Node = It->second; Node; Node = Node->Caller)
Path.push_back(Node->Func);
- return Path;
+ return std::move(Path);
}
Profile::PathID Profile::internPath(ArrayRef<FuncID> P) {
@@ -308,7 +308,7 @@ Expected<Profile> loadProfile(StringRef Filename) {
if (auto E =
P.addBlock(Profile::Block{Profile::ThreadID{Header.Thread},
{{P.internPath(Path), std::move(Data)}}}))
- return E;
+ return std::move(E);
}
return P;
@@ -393,7 +393,7 @@ Expected<Profile> profileFromTrace(const Trace &T) {
std::vector<std::pair<Profile::PathID, Profile::Data>>(
PathsData.begin(), PathsData.end()),
}))
- return E;
+ return std::move(E);
}
return P;
diff --git a/llvm/lib/XRay/Trace.cpp b/llvm/lib/XRay/Trace.cpp
index 48c6fc9039a8..4f107e1059cc 100644
--- a/llvm/lib/XRay/Trace.cpp
+++ b/llvm/lib/XRay/Trace.cpp
@@ -443,7 +443,7 @@ Expected<Trace> llvm::xray::loadTrace(const DataExtractor &DE, bool Sort) {
if (Version == 1 || Version == 2 || Version == 3) {
if (auto E = loadNaiveFormatLog(DE.getData(), DE.isLittleEndian(),
T.FileHeader, T.Records))
- return E;
+ return std::move(E);
} else {
return make_error<StringError>(
Twine("Unsupported version for Basic/Naive Mode logging: ") +
@@ -455,7 +455,7 @@ Expected<Trace> llvm::xray::loadTrace(const DataExtractor &DE, bool Sort) {
if (Version >= 1 && Version <= 5) {
if (auto E = loadFDRLog(DE.getData(), DE.isLittleEndian(), T.FileHeader,
T.Records))
- return E;
+ return std::move(E);
} else {
return make_error<StringError>(
Twine("Unsupported version for FDR Mode logging: ") + Twine(Version),
@@ -464,7 +464,7 @@ Expected<Trace> llvm::xray::loadTrace(const DataExtractor &DE, bool Sort) {
break;
default:
if (auto E = loadYAMLLog(DE.getData(), T.FileHeader, T.Records))
- return E;
+ return std::move(E);
}
if (Sort)
@@ -472,5 +472,5 @@ Expected<Trace> llvm::xray::loadTrace(const DataExtractor &DE, bool Sort) {
return L.TSC < R.TSC;
});
- return T;
+ return std::move(T);
}
diff --git a/llvm/tools/bugpoint/ExecutionDriver.cpp b/llvm/tools/bugpoint/ExecutionDriver.cpp
index 0aa58372dc2b..4c83a9598976 100644
--- a/llvm/tools/bugpoint/ExecutionDriver.cpp
+++ b/llvm/tools/bugpoint/ExecutionDriver.cpp
@@ -347,7 +347,7 @@ Expected<std::string> BugDriver::executeProgram(const Module &Program,
OutputFile, AdditionalLinkerArgs,
SharedObjs, Timeout, MemoryLimit);
if (Error E = RetVal.takeError())
- return E;
+ return std::move(E);
if (*RetVal == -1) {
errs() << "<timeout>";
@@ -393,12 +393,12 @@ BugDriver::compileSharedObject(const std::string &BitcodeFile) {
Expected<CC::FileType> FT =
SafeInterpreter->OutputCode(BitcodeFile, OutputFile);
if (Error E = FT.takeError())
- return E;
+ return std::move(E);
std::string SharedObjectFile;
if (Error E = cc->MakeSharedObject(OutputFile, *FT, SharedObjectFile,
AdditionalLinkerArgs))
- return E;
+ return std::move(E);
// Remove the intermediate C file
sys::fs::remove(OutputFile);
@@ -444,7 +444,7 @@ Expected<bool> BugDriver::
diff Program(const Module &Program,
Expected<std::string> Output =
executeProgram(Program, "", BitcodeFile, SharedObject, nullptr);
if (Error E = Output.takeError())
- return E;
+ return std::move(E);
std::string Error;
bool FilesDifferent = false;
diff --git a/llvm/tools/bugpoint/ListReducer.h b/llvm/tools/bugpoint/ListReducer.h
index e9445498b6be..04f2207a31ed 100644
--- a/llvm/tools/bugpoint/ListReducer.h
+++ b/llvm/tools/bugpoint/ListReducer.h
@@ -49,7 +49,7 @@ template <typename ElTy> struct ListReducer {
std::mt19937 randomness(0x6e5ea738); // Seed the random number generator
Expected<TestResult> Result = doTest(TheList, empty);
if (Error E = Result.takeError())
- return E;
+ return std::move(E);
switch (*Result) {
case KeepPrefix:
if (TheList.size() == 1) // we are done, it's the base case and it fails
@@ -122,7 +122,7 @@ template <typename ElTy> struct ListReducer {
Expected<TestResult> Result = doTest(Prefix, Suffix);
if (Error E = Result.takeError())
- return E;
+ return std::move(E);
switch (*Result) {
case KeepSuffix:
// The property still holds. We can just drop the prefix elements, and
@@ -185,7 +185,7 @@ template <typename ElTy> struct ListReducer {
Expected<TestResult> Result = doTest(EmptyList, TestList);
if (Error E = Result.takeError())
- return E;
+ return std::move(E);
if (*Result == KeepSuffix) {
// We can trim down the list!
TheList.swap(TestList);
diff --git a/llvm/tools/bugpoint/Miscompilation.cpp b/llvm/tools/bugpoint/Miscompilation.cpp
index cd5eb19d3afc..e69fe9ff6c15 100644
--- a/llvm/tools/bugpoint/Miscompilation.cpp
+++ b/llvm/tools/bugpoint/Miscompilation.cpp
@@ -82,7 +82,7 @@ ReduceMiscompilingPasses::doTest(std::vector<std::string> &Prefix,
Expected<bool> Diff = BD.
diff Program(BD.getProgram(), BitcodeResult, "",
true /*delete bitcode*/);
if (Error E = Diff.takeError())
- return E;
+ return std::move(E);
if (*Diff) {
outs() << " nope.\n";
if (Suffix.empty()) {
@@ -123,7 +123,7 @@ ReduceMiscompilingPasses::doTest(std::vector<std::string> &Prefix,
// If the prefix maintains the predicate by itself, only keep the prefix!
Diff = BD.
diff Program(BD.getProgram(), BitcodeResult, "", false);
if (Error E = Diff.takeError())
- return E;
+ return std::move(E);
if (*Diff) {
outs() << " nope.\n";
sys::fs::remove(BitcodeResult);
@@ -169,7 +169,7 @@ ReduceMiscompilingPasses::doTest(std::vector<std::string> &Prefix,
Diff = BD.
diff Program(BD.getProgram(), BitcodeResult, "",
true /*delete bitcode*/);
if (Error E = Diff.takeError())
- return E;
+ return std::move(E);
if (*Diff) {
outs() << " nope.\n";
return KeepSuffix;
@@ -200,14 +200,14 @@ class ReduceMiscompilingFunctions : public ListReducer<Function *> {
if (!Suffix.empty()) {
Expected<bool> Ret = TestFuncs(Suffix);
if (Error E = Ret.takeError())
- return E;
+ return std::move(E);
if (*Ret)
return KeepSuffix;
}
if (!Prefix.empty()) {
Expected<bool> Ret = TestFuncs(Prefix);
if (Error E = Ret.takeError())
- return E;
+ return std::move(E);
if (*Ret)
return KeepPrefix;
}
@@ -237,9 +237,9 @@ static Expected<std::unique_ptr<Module>> testMergedProgram(const BugDriver &BD,
// Execute the program.
Expected<bool> Diff = BD.
diff Program(*Merged, "", "", false);
if (Error E = Diff.takeError())
- return E;
+ return std::move(E);
Broken = *Diff;
- return Merged;
+ return std::move(Merged);
}
/// split functions in a Module into two groups: those that are under
@@ -335,7 +335,7 @@ ExtractLoops(BugDriver &BD,
Expected<std::unique_ptr<Module>> New = testMergedProgram(
BD, *ToOptimizeLoopExtracted, *ToNotOptimize, Failure);
if (Error E = New.takeError())
- return E;
+ return std::move(E);
if (!*New)
return false;
@@ -377,7 +377,7 @@ ExtractLoops(BugDriver &BD,
Expected<bool> Result = TestFn(BD, std::move(ToOptimizeLoopExtracted),
std::move(ToNotOptimize));
if (Error E = Result.takeError())
- return E;
+ return std::move(E);
ToOptimizeLoopExtracted = std::move(TOLEBackup);
ToNotOptimize = std::move(TNOBackup);
@@ -462,14 +462,14 @@ class ReduceMiscompiledBlocks : public ListReducer<BasicBlock *> {
if (!Suffix.empty()) {
Expected<bool> Ret = TestFuncs(Suffix);
if (Error E = Ret.takeError())
- return E;
+ return std::move(E);
if (*Ret)
return KeepSuffix;
}
if (!Prefix.empty()) {
Expected<bool> Ret = TestFuncs(Prefix);
if (Error E = Ret.takeError())
- return E;
+ return std::move(E);
if (*Ret)
return KeepPrefix;
}
@@ -556,7 +556,7 @@ ExtractBlocks(BugDriver &BD,
Expected<bool> Ret = ReduceMiscompiledBlocks(BD, TestFn, MiscompiledFunctions)
.TestFuncs(std::vector<BasicBlock *>());
if (Error E = Ret.takeError())
- return E;
+ return std::move(E);
if (*Ret) {
Blocks.clear();
} else {
@@ -564,7 +564,7 @@ ExtractBlocks(BugDriver &BD,
ReduceMiscompiledBlocks(BD, TestFn, MiscompiledFunctions)
.reduceList(Blocks);
if (Error E = Ret.takeError())
- return E;
+ return std::move(E);
if (Blocks.size() == OldSize)
return false;
}
@@ -632,7 +632,7 @@ static Expected<std::vector<Function *>> DebugAMiscompilation(
.reduceList(MiscompiledFunctions);
if (Error E = Ret.takeError()) {
errs() << "\n***Cannot reduce functions: ";
- return E;
+ return std::move(E);
}
}
outs() << "\n*** The following function"
@@ -647,7 +647,7 @@ static Expected<std::vector<Function *>> DebugAMiscompilation(
if (!BugpointIsInterrupted && !DisableLoopExtraction) {
Expected<bool> Ret = ExtractLoops(BD, TestFn, MiscompiledFunctions);
if (Error E = Ret.takeError())
- return E;
+ return std::move(E);
if (*Ret) {
// Okay, we extracted some loops and the problem still appears. See if
// we can eliminate some of the created functions from being candidates.
@@ -658,7 +658,7 @@ static Expected<std::vector<Function *>> DebugAMiscompilation(
Ret = ReduceMiscompilingFunctions(BD, TestFn)
.reduceList(MiscompiledFunctions);
if (Error E = Ret.takeError())
- return E;
+ return std::move(E);
outs() << "\n*** The following function"
<< (MiscompiledFunctions.size() == 1 ? " is" : "s are")
@@ -671,7 +671,7 @@ static Expected<std::vector<Function *>> DebugAMiscompilation(
if (!BugpointIsInterrupted && !DisableBlockExtraction) {
Expected<bool> Ret = ExtractBlocks(BD, TestFn, MiscompiledFunctions);
if (Error E = Ret.takeError())
- return E;
+ return std::move(E);
if (*Ret) {
// Okay, we extracted some blocks and the problem still appears. See if
// we can eliminate some of the created functions from being candidates.
@@ -681,7 +681,7 @@ static Expected<std::vector<Function *>> DebugAMiscompilation(
Ret = ReduceMiscompilingFunctions(BD, TestFn)
.reduceList(MiscompiledFunctions);
if (Error E = Ret.takeError())
- return E;
+ return std::move(E);
outs() << "\n*** The following function"
<< (MiscompiledFunctions.size() == 1 ? " is" : "s are")
@@ -711,7 +711,7 @@ static Expected<bool> TestOptimizer(BugDriver &BD, std::unique_ptr<Module> Test,
BD.EmitProgressBitcode(*Test, "pass-error", false);
BD.setNewProgram(std::move(Test));
if (Error E = BD.debugOptimizerCrash())
- return E;
+ return std::move(E);
return false;
}
outs() << "done.\n";
@@ -720,7 +720,7 @@ static Expected<bool> TestOptimizer(BugDriver &BD, std::unique_ptr<Module> Test,
bool Broken;
auto Result = testMergedProgram(BD, *Optimized, *Safe, Broken);
if (Error E = Result.takeError())
- return E;
+ return std::move(E);
if (auto New = std::move(*Result)) {
outs() << (Broken ? " nope.\n" : " yup.\n");
// Delete the original and set the new program.
@@ -987,7 +987,7 @@ static Expected<bool> TestCodeGenerator(BugDriver &BD,
Expected<std::string> SharedObject =
BD.compileSharedObject(std::string(SafeModuleBC.str()));
if (Error E = SharedObject.takeError())
- return E;
+ return std::move(E);
FileRemover SharedObjectRemover(*SharedObject, !SaveTemps);
@@ -996,7 +996,7 @@ static Expected<bool> TestCodeGenerator(BugDriver &BD,
Expected<bool> Result = BD.
diff Program(
BD.getProgram(), std::string(TestModuleBC.str()), *SharedObject, false);
if (Error E = Result.takeError())
- return E;
+ return std::move(E);
if (*Result)
errs() << ": still failing!\n";
diff --git a/llvm/tools/bugpoint/ToolRunner.cpp b/llvm/tools/bugpoint/ToolRunner.cpp
index 2fc2d9bdf9b6..d880aca044d1 100644
--- a/llvm/tools/bugpoint/ToolRunner.cpp
+++ b/llvm/tools/bugpoint/ToolRunner.cpp
@@ -492,7 +492,7 @@ Expected<int> LLC::ExecuteProgram(const std::string &Bitcode,
OutputCode(Bitcode, OutputAsmFile, Timeout, MemoryLimit);
FileRemover OutFileRemover(OutputAsmFile, !SaveTemps);
if (Error E = FileKind.takeError())
- return E;
+ return std::move(E);
std::vector<std::string> CCArgs(ArgsForCC);
CCArgs.insert(CCArgs.end(), SharedLibs.begin(), SharedLibs.end());
diff --git a/llvm/tools/dsymutil/BinaryHolder.cpp b/llvm/tools/dsymutil/BinaryHolder.cpp
index ba3ecbeb2957..31d32d8d8e80 100644
--- a/llvm/tools/dsymutil/BinaryHolder.cpp
+++ b/llvm/tools/dsymutil/BinaryHolder.cpp
@@ -197,7 +197,7 @@ BinaryHolder::ArchiveEntry::getObjectEntry(StringRef Filename,
}
}
if (Err)
- return Err;
+ return std::move(Err);
}
if (OE.Objects.empty())
@@ -243,7 +243,7 @@ BinaryHolder::getObjectEntry(StringRef Filename, TimestampTy Timestamp) {
auto Err = OE.load(Filename, Verbose);
if (Err) {
ObjectCache.erase(Filename);
- return Err;
+ return std::move(Err);
}
}
diff --git a/llvm/tools/dsymutil/DebugMap.cpp b/llvm/tools/dsymutil/DebugMap.cpp
index f6c3400b49b7..41067106e02c 100644
--- a/llvm/tools/dsymutil/DebugMap.cpp
+++ b/llvm/tools/dsymutil/DebugMap.cpp
@@ -142,7 +142,7 @@ DebugMap::parseYAMLDebugMap(StringRef InputFile, StringRef PrependPath,
return EC;
std::vector<std::unique_ptr<DebugMap>> Result;
Result.push_back(std::move(Res));
- return Result;
+ return std::move(Result);
}
} // end namespace dsymutil
diff --git a/llvm/tools/dsymutil/MachODebugMapParser.cpp b/llvm/tools/dsymutil/MachODebugMapParser.cpp
index 087f514bfcdc..83703fb13f0a 100644
--- a/llvm/tools/dsymutil/MachODebugMapParser.cpp
+++ b/llvm/tools/dsymutil/MachODebugMapParser.cpp
@@ -391,7 +391,7 @@ ErrorOr<std::vector<std::unique_ptr<DebugMap>>> MachODebugMapParser::parse() {
if (shouldLinkArch(Archs, Object->getArchTriple().getArchName()))
Results.push_back(parseOneBinary(*Object, BinaryPath));
- return Results;
+ return std::move(Results);
}
/// Interpret the STAB entries to fill the DebugMap.
diff --git a/llvm/tools/dsymutil/dsymutil.cpp b/llvm/tools/dsymutil/dsymutil.cpp
index fa5ac47ef409..6b2608160aea 100644
--- a/llvm/tools/dsymutil/dsymutil.cpp
+++ b/llvm/tools/dsymutil/dsymutil.cpp
@@ -279,7 +279,7 @@ static Expected<DsymutilOptions> getOptions(opt::InputArgList &Args) {
}
if (Error E = verifyOptions(Options))
- return E;
+ return std::move(E);
return Options;
}
@@ -433,9 +433,9 @@ getOutputFileName(StringRef InputFile, const DsymutilOptions &Options) {
Path = DwarfFile + ".dSYM";
if (!Options.LinkOpts.NoOutput) {
if (auto E = createBundleDir(Path))
- return E;
+ return std::move(E);
if (auto E = createPlistFile(DwarfFile, Path, Options.Toolchain))
- return E;
+ return std::move(E);
}
sys::path::append(Path, "Contents", "Resources");
diff --git a/llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp b/llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
index 3307facf7fad..639a6d1ec02c 100644
--- a/llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
+++ b/llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
@@ -73,14 +73,14 @@ static Expected<std::unique_ptr<MemoryBuffer>> openBitcodeFile(StringRef Path) {
Expected<std::unique_ptr<MemoryBuffer>> MemBufOrErr =
errorOrToExpected(MemoryBuffer::getFileOrSTDIN(Path));
if (Error E = MemBufOrErr.takeError())
- return E;
+ return std::move(E);
std::unique_ptr<MemoryBuffer> MemBuf = std::move(*MemBufOrErr);
if (MemBuf->getBufferSize() & 3)
return reportError(
"Bitcode stream should be a multiple of 4 bytes in length");
- return MemBuf;
+ return std::move(MemBuf);
}
int main(int argc, char **argv) {
diff --git a/llvm/tools/llvm-cfi-verify/lib/FileAnalysis.cpp b/llvm/tools/llvm-cfi-verify/lib/FileAnalysis.cpp
index 8b0d257232f6..d2b4db3b5751 100644
--- a/llvm/tools/llvm-cfi-verify/lib/FileAnalysis.cpp
+++ b/llvm/tools/llvm-cfi-verify/lib/FileAnalysis.cpp
@@ -100,15 +100,15 @@ Expected<FileAnalysis> FileAnalysis::Create(StringRef Filename) {
// Init the rest of the object.
if (auto InitResponse = Analysis.initialiseDisassemblyMembers())
- return InitResponse;
+ return std::move(InitResponse);
if (auto SectionParseResponse = Analysis.parseCodeSections())
- return SectionParseResponse;
+ return std::move(SectionParseResponse);
if (auto SymbolTableParseResponse = Analysis.parseSymbolTable())
- return SymbolTableParseResponse;
+ return std::move(SymbolTableParseResponse);
- return Analysis;
+ return std::move(Analysis);
}
FileAnalysis::FileAnalysis(object::OwningBinary<object::Binary> Binary)
diff --git a/llvm/tools/llvm-cov/SourceCoverageView.cpp b/llvm/tools/llvm-cov/SourceCoverageView.cpp
index c1c3fec709e2..cd7395a1a87d 100644
--- a/llvm/tools/llvm-cov/SourceCoverageView.cpp
+++ b/llvm/tools/llvm-cov/SourceCoverageView.cpp
@@ -69,7 +69,7 @@ CoveragePrinter::createOutputStream(StringRef Path, StringRef Extension,
auto OS = CoveragePrinter::OwnedStream(RawStream);
if (E)
return errorCodeToError(E);
- return OS;
+ return std::move(OS);
}
std::unique_ptr<CoveragePrinter>
diff --git a/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp b/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp
index 70f8f9454768..1363e0a52c11 100644
--- a/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp
+++ b/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp
@@ -295,7 +295,7 @@ CoveragePrinterHTML::createViewFile(StringRef Path, bool InToplevel) {
emitPrelude(*OS.get(), Opts, getPathToStyle(ViewPath));
}
- return OS;
+ return std::move(OS);
}
void CoveragePrinterHTML::closeViewFile(OwnedStream OS) {
diff --git a/llvm/tools/llvm-dwp/llvm-dwp.cpp b/llvm/tools/llvm-dwp/llvm-dwp.cpp
index bd629905fc9d..23513ef8fb4e 100644
--- a/llvm/tools/llvm-dwp/llvm-dwp.cpp
+++ b/llvm/tools/llvm-dwp/llvm-dwp.cpp
@@ -499,7 +499,7 @@ getDWOFilenames(StringRef ExecFilename) {
DWOPaths.push_back(std::move(DWOName));
}
}
- return DWOPaths;
+ return std::move(DWOPaths);
}
static Error write(MCStreamer &Out, ArrayRef<std::string> Inputs) {
diff --git a/llvm/tools/llvm-elfabi/ELFObjHandler.cpp b/llvm/tools/llvm-elfabi/ELFObjHandler.cpp
index 420239a1631f..124fffbb9cf6 100644
--- a/llvm/tools/llvm-elfabi/ELFObjHandler.cpp
+++ b/llvm/tools/llvm-elfabi/ELFObjHandler.cpp
@@ -309,7 +309,7 @@ buildStub(const ELFObjectFile<ELFT> &ElfObj) {
// Collect relevant .dynamic entries.
DynamicEntries DynEnt;
if (Error Err = populateDynamic<ELFT>(DynEnt, *DynTable))
- return Err;
+ return std::move(Err);
// Get pointer to in-memory location of .dynstr section.
Expected<const uint8_t *> DynStrPtr =
@@ -364,7 +364,7 @@ buildStub(const ELFObjectFile<ELFT> &ElfObj) {
"when reading dynamic symbols");
}
- return DestStub;
+ return std::move(DestStub);
}
Expected<std::unique_ptr<ELFStub>> readELFFile(MemoryBufferRef Buf) {
diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
index e93ab457c256..6981aaa46cd9 100644
--- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
+++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
@@ -139,7 +139,7 @@ Expected<InstructionBenchmark> BenchmarkRunner::runConfiguration(
auto Measurements = runMeasurements(Executor);
if (Error E = Measurements.takeError()) {
if (!E.isA<SnippetCrash>())
- return E;
+ return std::move(E);
InstrBenchmark.Error = toString(std::move(E));
return InstrBenchmark;
}
@@ -163,7 +163,7 @@ BenchmarkRunner::writeObjectFile(const BenchmarkCode &BC,
SmallString<256> ResultPath;
if (Error E = errorCodeToError(
sys::fs::createTemporaryFile("snippet", "o", ResultFD, ResultPath)))
- return E;
+ return std::move(E);
raw_fd_ostream OFS(ResultFD, true /*ShouldClose*/);
assembleToStream(State.getExegesisTarget(), State.createTargetMachine(),
BC.LiveIns, BC.Key.RegisterInitialValues, FillFunction, OFS);
diff --git a/llvm/tools/llvm-exegesis/lib/Clustering.cpp b/llvm/tools/llvm-exegesis/lib/Clustering.cpp
index e73d6ec8ec90..33a8e018f515 100644
--- a/llvm/tools/llvm-exegesis/lib/Clustering.cpp
+++ b/llvm/tools/llvm-exegesis/lib/Clustering.cpp
@@ -320,7 +320,7 @@ Expected<InstructionBenchmarkClustering> InstructionBenchmarkClustering::create(
InstructionBenchmarkClustering Clustering(
Points, AnalysisClusteringEpsilon * AnalysisClusteringEpsilon);
if (auto Error = Clustering.validateAndSetup()) {
- return Error;
+ return std::move(Error);
}
if (Clustering.ErrorCluster_.PointIndices.size() == Points.size()) {
return Clustering; // Nothing to cluster.
diff --git a/llvm/tools/llvm-exegesis/lib/LatencyBenchmarkRunner.cpp b/llvm/tools/llvm-exegesis/lib/LatencyBenchmarkRunner.cpp
index 3134d03685e6..83a3f0183e39 100644
--- a/llvm/tools/llvm-exegesis/lib/LatencyBenchmarkRunner.cpp
+++ b/llvm/tools/llvm-exegesis/lib/LatencyBenchmarkRunner.cpp
@@ -49,7 +49,7 @@ Expected<std::vector<BenchmarkMeasure>> LatencyBenchmarkRunner::runMeasurements(
default:
break;
}
- return Result;
+ return std::move(Result);
}
} // namespace exegesis
diff --git a/llvm/tools/llvm-exegesis/lib/SerialSnippetGenerator.cpp b/llvm/tools/llvm-exegesis/lib/SerialSnippetGenerator.cpp
index 9c7f7da1072d..fea6dc95ce82 100644
--- a/llvm/tools/llvm-exegesis/lib/SerialSnippetGenerator.cpp
+++ b/llvm/tools/llvm-exegesis/lib/SerialSnippetGenerator.cpp
@@ -172,7 +172,7 @@ SerialSnippetGenerator::generateCodeTemplates(
if (Results.empty())
return make_error<Failure>(
"No strategy found to make the execution serial");
- return Results;
+ return std::move(Results);
}
} // namespace exegesis
diff --git a/llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp b/llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp
index e7f95d07bf21..21932f416aa7 100644
--- a/llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp
+++ b/llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp
@@ -73,7 +73,7 @@ Expected<std::vector<BenchmarkCode>> SnippetGenerator::generateConfigurations(
BC.Info = CT.Info;
for (InstructionTemplate &IT : CT.Instructions) {
if (auto error = randomizeUnsetVariables(State, ForbiddenRegs, IT))
- return error;
+ return std::move(error);
BC.Key.Instructions.push_back(IT.build());
}
if (CT.ScratchSpacePointerInReg)
@@ -152,7 +152,7 @@ generateSelfAliasingCodeTemplates(const Instruction &Instr) {
setRandomAliasing(SelfAliasing, IT, IT);
}
CT.Instructions.push_back(std::move(IT));
- return Result;
+ return std::move(Result);
}
Expected<std::vector<CodeTemplate>>
@@ -163,7 +163,7 @@ generateUnconstrainedCodeTemplates(const Instruction &Instr, StringRef Msg) {
CT.Info =
std::string(formatv("{0}, repeating an unconstrained assignment", Msg));
CT.Instructions.emplace_back(&Instr);
- return Result;
+ return std::move(Result);
}
std::mt19937 &randomGenerator() {
diff --git a/llvm/tools/llvm-exegesis/lib/UopsBenchmarkRunner.cpp b/llvm/tools/llvm-exegesis/lib/UopsBenchmarkRunner.cpp
index af5b977b4700..b99b1c5e7113 100644
--- a/llvm/tools/llvm-exegesis/lib/UopsBenchmarkRunner.cpp
+++ b/llvm/tools/llvm-exegesis/lib/UopsBenchmarkRunner.cpp
@@ -39,7 +39,7 @@ UopsBenchmarkRunner::runMeasurements(const FunctionExecutor &Executor) const {
Result.push_back(
BenchmarkMeasure::Create("NumMicroOps", *ExpectedCounterValue));
}
- return Result;
+ return std::move(Result);
}
} // namespace exegesis
diff --git a/llvm/tools/llvm-exegesis/lib/X86/Target.cpp b/llvm/tools/llvm-exegesis/lib/X86/Target.cpp
index 876847b8c08c..72553af823f1 100644
--- a/llvm/tools/llvm-exegesis/lib/X86/Target.cpp
+++ b/llvm/tools/llvm-exegesis/lib/X86/Target.cpp
@@ -241,13 +241,13 @@ static Expected<std::vector<CodeTemplate>> generateLEATemplatesCommon(
.str();
Result.push_back(std::move(CT));
if (Result.size() >= Opts.MaxConfigsPerOpcode)
- return Result;
+ return std::move(Result);
}
}
}
}
- return Result;
+ return std::move(Result);
}
namespace {
diff --git a/llvm/tools/llvm-ifs/llvm-ifs.cpp b/llvm/tools/llvm-ifs/llvm-ifs.cpp
index f653c3a94f52..3b0d2ee725ff 100644
--- a/llvm/tools/llvm-ifs/llvm-ifs.cpp
+++ b/llvm/tools/llvm-ifs/llvm-ifs.cpp
@@ -215,7 +215,7 @@ static Expected<std::unique_ptr<IFSStub>> readInputFile(StringRef FilePath) {
if (std::error_code Err = YamlIn.error())
return createStringError(Err, "Failed reading Interface Stub File.");
- return Stub;
+ return std::move(Stub);
}
int writeTbdStub(const llvm::Triple &T, const std::set<IFSSymbol> &Symbols,
diff --git a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
index df04a2e950a3..26bcf46d60a6 100644
--- a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
+++ b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
@@ -238,8 +238,8 @@ class JITLinkSlabAllocator final : public JITLinkMemoryManager {
std::unique_ptr<JITLinkSlabAllocator> Allocator(
new JITLinkSlabAllocator(SlabSize, Err));
if (Err)
- return Err;
- return Allocator;
+ return std::move(Err);
+ return std::move(Allocator);
}
Expected<std::unique_ptr<JITLinkMemoryManager::Allocation>>
diff --git a/llvm/tools/llvm-mca/llvm-mca.cpp b/llvm/tools/llvm-mca/llvm-mca.cpp
index a4b2514bbf93..06c1ce957f74 100644
--- a/llvm/tools/llvm-mca/llvm-mca.cpp
+++ b/llvm/tools/llvm-mca/llvm-mca.cpp
@@ -240,7 +240,7 @@ ErrorOr<std::unique_ptr<ToolOutputFile>> getOutputStream() {
auto Out =
std::make_unique<ToolOutputFile>(OutputFilename, EC, sys::fs::OF_Text);
if (!EC)
- return Out;
+ return std::move(Out);
return EC;
}
} // end of anonymous namespace
diff --git a/llvm/tools/llvm-objcopy/COFF/Reader.cpp b/llvm/tools/llvm-objcopy/COFF/Reader.cpp
index ad612af21fdc..7be9cce2be3d 100644
--- a/llvm/tools/llvm-objcopy/COFF/Reader.cpp
+++ b/llvm/tools/llvm-objcopy/COFF/Reader.cpp
@@ -207,15 +207,15 @@ Expected<std::unique_ptr<Object>> COFFReader::create() const {
}
if (Error E = readExecutableHeaders(*Obj))
- return E;
+ return std::move(E);
if (Error E = readSections(*Obj))
- return E;
+ return std::move(E);
if (Error E = readSymbols(*Obj, IsBigObj))
- return E;
+ return std::move(E);
if (Error E = setSymbolTargets(*Obj))
- return E;
+ return std::move(E);
- return Obj;
+ return std::move(Obj);
}
} // end namespace coff
diff --git a/llvm/tools/llvm-objcopy/CopyConfig.cpp b/llvm/tools/llvm-objcopy/CopyConfig.cpp
index 42bddf7a97ff..69d6180d86e0 100644
--- a/llvm/tools/llvm-objcopy/CopyConfig.cpp
+++ b/llvm/tools/llvm-objcopy/CopyConfig.cpp
@@ -342,7 +342,7 @@ NameOrPattern::create(StringRef Pattern, MatchStyle MS,
// a literal if the error reporting is non-fatal.
if (!GlobOrErr) {
if (Error E = ErrorCallback(GlobOrErr.takeError()))
- return E;
+ return std::move(E);
return create(Pattern, MatchStyle::Literal, ErrorCallback);
}
@@ -572,7 +572,7 @@ parseObjcopyOptions(ArrayRef<const char *> ArgsArr,
for (auto Arg : InputArgs.filtered(OBJCOPY_redefine_symbols))
if (Error E = addSymbolsToRenameFromFile(Config.SymbolsToRename, DC.Alloc,
Arg->getValue()))
- return E;
+ return std::move(E);
for (auto Arg : InputArgs.filtered(OBJCOPY_rename_section)) {
Expected<SectionRename> SR =
@@ -623,15 +623,15 @@ parseObjcopyOptions(ArrayRef<const char *> ArgsArr,
for (auto Arg : InputArgs.filtered(OBJCOPY_remove_section))
if (Error E = Config.ToRemove.addMatcher(NameOrPattern::create(
Arg->getValue(), SectionMatchStyle, ErrorCallback)))
- return E;
+ return std::move(E);
for (auto Arg : InputArgs.filtered(OBJCOPY_keep_section))
if (Error E = Config.KeepSection.addMatcher(NameOrPattern::create(
Arg->getValue(), SectionMatchStyle, ErrorCallback)))
- return E;
+ return std::move(E);
for (auto Arg : InputArgs.filtered(OBJCOPY_only_section))
if (Error E = Config.OnlySection.addMatcher(NameOrPattern::create(
Arg->getValue(), SectionMatchStyle, ErrorCallback)))
- return E;
+ return std::move(E);
for (auto Arg : InputArgs.filtered(OBJCOPY_add_section)) {
StringRef ArgValue(Arg->getValue());
if (!ArgValue.contains('='))
@@ -671,67 +671,67 @@ parseObjcopyOptions(ArrayRef<const char *> ArgsArr,
for (auto Arg : InputArgs.filtered(OBJCOPY_localize_symbol))
if (Error E = Config.SymbolsToLocalize.addMatcher(NameOrPattern::create(
Arg->getValue(), SymbolMatchStyle, ErrorCallback)))
- return E;
+ return std::move(E);
for (auto Arg : InputArgs.filtered(OBJCOPY_localize_symbols))
if (Error E = addSymbolsFromFile(Config.SymbolsToLocalize, DC.Alloc,
Arg->getValue(), SymbolMatchStyle,
ErrorCallback))
- return E;
+ return std::move(E);
for (auto Arg : InputArgs.filtered(OBJCOPY_keep_global_symbol))
if (Error E = Config.SymbolsToKeepGlobal.addMatcher(NameOrPattern::create(
Arg->getValue(), SymbolMatchStyle, ErrorCallback)))
- return E;
+ return std::move(E);
for (auto Arg : InputArgs.filtered(OBJCOPY_keep_global_symbols))
if (Error E = addSymbolsFromFile(Config.SymbolsToKeepGlobal, DC.Alloc,
Arg->getValue(), SymbolMatchStyle,
ErrorCallback))
- return E;
+ return std::move(E);
for (auto Arg : InputArgs.filtered(OBJCOPY_globalize_symbol))
if (Error E = Config.SymbolsToGlobalize.addMatcher(NameOrPattern::create(
Arg->getValue(), SymbolMatchStyle, ErrorCallback)))
- return E;
+ return std::move(E);
for (auto Arg : InputArgs.filtered(OBJCOPY_globalize_symbols))
if (Error E = addSymbolsFromFile(Config.SymbolsToGlobalize, DC.Alloc,
Arg->getValue(), SymbolMatchStyle,
ErrorCallback))
- return E;
+ return std::move(E);
for (auto Arg : InputArgs.filtered(OBJCOPY_weaken_symbol))
if (Error E = Config.SymbolsToWeaken.addMatcher(NameOrPattern::create(
Arg->getValue(), SymbolMatchStyle, ErrorCallback)))
- return E;
+ return std::move(E);
for (auto Arg : InputArgs.filtered(OBJCOPY_weaken_symbols))
if (Error E = addSymbolsFromFile(Config.SymbolsToWeaken, DC.Alloc,
Arg->getValue(), SymbolMatchStyle,
ErrorCallback))
- return E;
+ return std::move(E);
for (auto Arg : InputArgs.filtered(OBJCOPY_strip_symbol))
if (Error E = Config.SymbolsToRemove.addMatcher(NameOrPattern::create(
Arg->getValue(), SymbolMatchStyle, ErrorCallback)))
- return E;
+ return std::move(E);
for (auto Arg : InputArgs.filtered(OBJCOPY_strip_symbols))
if (Error E = addSymbolsFromFile(Config.SymbolsToRemove, DC.Alloc,
Arg->getValue(), SymbolMatchStyle,
ErrorCallback))
- return E;
+ return std::move(E);
for (auto Arg : InputArgs.filtered(OBJCOPY_strip_unneeded_symbol))
if (Error E =
Config.UnneededSymbolsToRemove.addMatcher(NameOrPattern::create(
Arg->getValue(), SymbolMatchStyle, ErrorCallback)))
- return E;
+ return std::move(E);
for (auto Arg : InputArgs.filtered(OBJCOPY_strip_unneeded_symbols))
if (Error E = addSymbolsFromFile(Config.UnneededSymbolsToRemove, DC.Alloc,
Arg->getValue(), SymbolMatchStyle,
ErrorCallback))
- return E;
+ return std::move(E);
for (auto Arg : InputArgs.filtered(OBJCOPY_keep_symbol))
if (Error E = Config.SymbolsToKeep.addMatcher(NameOrPattern::create(
Arg->getValue(), SymbolMatchStyle, ErrorCallback)))
- return E;
+ return std::move(E);
for (auto Arg : InputArgs.filtered(OBJCOPY_keep_symbols))
if (Error E =
addSymbolsFromFile(Config.SymbolsToKeep, DC.Alloc, Arg->getValue(),
SymbolMatchStyle, ErrorCallback))
- return E;
+ return std::move(E);
for (auto Arg : InputArgs.filtered(OBJCOPY_add_symbol))
Config.SymbolsToAdd.push_back(Arg->getValue());
@@ -788,7 +788,7 @@ parseObjcopyOptions(ArrayRef<const char *> ArgsArr,
"--extract-main-partition");
DC.CopyConfigs.push_back(std::move(Config));
- return DC;
+ return std::move(DC);
}
// ParseInstallNameToolOptions returns the config and sets the input arguments.
@@ -839,7 +839,7 @@ parseInstallNameToolOptions(ArrayRef<const char *> ArgsArr) {
Config.OutputFilename = Positional[0];
DC.CopyConfigs.push_back(std::move(Config));
- return DC;
+ return std::move(DC);
}
// ParseStripOptions returns the config and sets the input arguments. If a
@@ -915,22 +915,22 @@ parseStripOptions(ArrayRef<const char *> ArgsArr,
for (auto Arg : InputArgs.filtered(STRIP_keep_section))
if (Error E = Config.KeepSection.addMatcher(NameOrPattern::create(
Arg->getValue(), SectionMatchStyle, ErrorCallback)))
- return E;
+ return std::move(E);
for (auto Arg : InputArgs.filtered(STRIP_remove_section))
if (Error E = Config.ToRemove.addMatcher(NameOrPattern::create(
Arg->getValue(), SectionMatchStyle, ErrorCallback)))
- return E;
+ return std::move(E);
for (auto Arg : InputArgs.filtered(STRIP_strip_symbol))
if (Error E = Config.SymbolsToRemove.addMatcher(NameOrPattern::create(
Arg->getValue(), SymbolMatchStyle, ErrorCallback)))
- return E;
+ return std::move(E);
for (auto Arg : InputArgs.filtered(STRIP_keep_symbol))
if (Error E = Config.SymbolsToKeep.addMatcher(NameOrPattern::create(
Arg->getValue(), SymbolMatchStyle, ErrorCallback)))
- return E;
+ return std::move(E);
if (!InputArgs.hasArg(STRIP_no_strip_all) && !Config.StripDebug &&
!Config.StripUnneeded && Config.DiscardMode == DiscardType::None &&
@@ -965,7 +965,7 @@ parseStripOptions(ArrayRef<const char *> ArgsArr,
if (Error E = ErrorCallback(createStringError(
errc::invalid_argument, "'%s' was already specified",
Filename.str().c_str())))
- return E;
+ return std::move(E);
}
Config.InputFilename = Filename;
Config.OutputFilename = Filename;
@@ -978,7 +978,7 @@ parseStripOptions(ArrayRef<const char *> ArgsArr,
return createStringError(errc::invalid_argument,
"--preserve-dates requires a file");
- return DC;
+ return std::move(DC);
}
} // namespace objcopy
diff --git a/llvm/tools/llvm-objcopy/ELF/Object.cpp b/llvm/tools/llvm-objcopy/ELF/Object.cpp
index 691034f81369..14ac7bba24fa 100644
--- a/llvm/tools/llvm-objcopy/ELF/Object.cpp
+++ b/llvm/tools/llvm-objcopy/ELF/Object.cpp
@@ -277,7 +277,7 @@ Expected<IHexRecord> IHexRecord::parse(StringRef Line) {
"line is too short: %zu chars.", Line.size());
if (Error E = checkChars(Line))
- return E;
+ return std::move(E);
IHexRecord Rec;
size_t DataLen = checkedGetHex<uint8_t>(Line.substr(1, 2));
@@ -293,7 +293,7 @@ Expected<IHexRecord> IHexRecord::parse(StringRef Line) {
if (getChecksum(Line.drop_front(1)) != 0)
return createStringError(errc::invalid_argument, "incorrect checksum.");
if (Error E = checkRecord(Rec))
- return E;
+ return std::move(E);
return Rec;
}
@@ -1665,7 +1665,7 @@ Expected<std::vector<IHexRecord>> IHexReader::parse() const {
if (!HasSections)
return parseError(-1U, "no sections");
- return Records;
+ return std::move(Records);
}
std::unique_ptr<Object> IHexReader::create(bool /*EnsureSymtab*/) const {
diff --git a/llvm/tools/llvm-objcopy/wasm/Reader.cpp b/llvm/tools/llvm-objcopy/wasm/Reader.cpp
index 20443cc22537..13fa84ad8020 100644
--- a/llvm/tools/llvm-objcopy/wasm/Reader.cpp
+++ b/llvm/tools/llvm-objcopy/wasm/Reader.cpp
@@ -25,7 +25,7 @@ Expected<std::unique_ptr<Object>> Reader::create() const {
Obj->Sections.push_back(
{static_cast<uint8_t>(WS.Type), WS.Name, WS.Content});
}
- return Obj;
+ return std::move(Obj);
}
} // end namespace wasm
diff --git a/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp b/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
index 63dc4610c7fb..32448cec88f6 100644
--- a/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
+++ b/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
@@ -429,7 +429,7 @@ static Expected<ModuleDebugStreamRef> getModuleDebugStream(PDBFile &File,
return make_error<RawError>(raw_error_code::corrupt_file,
"Invalid module stream");
- return ModS;
+ return std::move(ModS);
}
template <typename CallbackT>
diff --git a/llvm/tools/llvm-pdbutil/InputFile.cpp b/llvm/tools/llvm-pdbutil/InputFile.cpp
index 7a5dfd32d58a..b316882de64d 100644
--- a/llvm/tools/llvm-pdbutil/InputFile.cpp
+++ b/llvm/tools/llvm-pdbutil/InputFile.cpp
@@ -60,7 +60,7 @@ getModuleDebugStream(PDBFile &File, StringRef &ModuleName, uint32_t Index) {
return make_error<RawError>(raw_error_code::corrupt_file,
"Invalid module stream");
- return ModS;
+ return std::move(ModS);
}
static inline bool isCodeViewDebugSubsection(object::SectionRef Section,
@@ -269,18 +269,18 @@ Expected<InputFile> InputFile::open(StringRef Path, bool AllowUnknownFile) {
IF.CoffObject = std::move(*BinaryOrErr);
IF.PdbOrObj = llvm::cast<COFFObjectFile>(IF.CoffObject.getBinary());
- return IF;
+ return std::move(IF);
}
if (Magic == file_magic::pdb) {
std::unique_ptr<IPDBSession> Session;
if (auto Err = loadDataForPDB(PDB_ReaderType::Native, Path, Session))
- return Err;
+ return std::move(Err);
IF.PdbSession.reset(static_cast<NativeSession *>(Session.release()));
IF.PdbOrObj = &IF.PdbSession->getPDBFile();
- return IF;
+ return std::move(IF);
}
if (!AllowUnknownFile)
@@ -295,7 +295,7 @@ Expected<InputFile> InputFile::open(StringRef Path, bool AllowUnknownFile) {
IF.UnknownFile = std::move(*Result);
IF.PdbOrObj = IF.UnknownFile.get();
- return IF;
+ return std::move(IF);
}
PDBFile &InputFile::pdb() {
diff --git a/llvm/tools/llvm-rc/ResourceScriptParser.cpp b/llvm/tools/llvm-rc/ResourceScriptParser.cpp
index 62adb5125663..36b305645fb8 100644
--- a/llvm/tools/llvm-rc/ResourceScriptParser.cpp
+++ b/llvm/tools/llvm-rc/ResourceScriptParser.cpp
@@ -19,7 +19,7 @@
// Take an expression returning llvm::Error and forward the error if it exists.
#define RETURN_IF_ERROR(Expr) \
if (auto Err = (Expr)) \
- return Err;
+ return std::move(Err);
// Take an expression returning llvm::Expected<T> and assign it to Var or
// forward the error out of the function.
@@ -295,7 +295,7 @@ Expected<SmallVector<RCInt, 8>> RCParser::readIntsWithCommas(size_t MinCount,
auto FailureHandler =
[&](llvm::Error Err) -> Expected<SmallVector<RCInt, 8>> {
if (Result.size() < MinCount)
- return Err;
+ return std::move(Err);
consumeError(std::move(Err));
return Result;
};
@@ -315,7 +315,7 @@ Expected<SmallVector<RCInt, 8>> RCParser::readIntsWithCommas(size_t MinCount,
return FailureHandler(IntResult.takeError());
}
- return Result;
+ return std::move(Result);
}
Expected<uint32_t> RCParser::parseFlags(ArrayRef<StringRef> FlagDesc,
@@ -386,7 +386,7 @@ RCParser::parseOptionalStatements(OptStmtType StmtsType) {
Result.addStmt(std::move(*SingleParse));
}
- return Result;
+ return std::move(Result);
}
Expected<std::unique_ptr<OptionalStmt>>
@@ -442,7 +442,7 @@ RCParser::ParseType RCParser::parseAcceleratorsResource() {
Accels->addAccelerator(*EventResult, *IDResult, *FlagsResult);
}
- return Accels;
+ return std::move(Accels);
}
RCParser::ParseType RCParser::parseCursorResource() {
@@ -484,7 +484,7 @@ RCParser::ParseType RCParser::parseDialogResource(bool IsExtended) {
Dialog->addControl(std::move(*ControlDefResult));
}
- return Dialog;
+ return std::move(Dialog);
}
RCParser::ParseType RCParser::parseUserDefinedResource(IntOrString Type) {
@@ -679,7 +679,7 @@ Expected<MenuDefinitionList> RCParser::parseMenuItemsList() {
std::make_unique<MenuItem>(*CaptionResult, MenuResult, *FlagsResult));
}
- return List;
+ return std::move(List);
}
RCParser::ParseType RCParser::parseStringTableResource() {
@@ -702,7 +702,7 @@ RCParser::ParseType RCParser::parseStringTableResource() {
Table->addString(*IDResult, *StrResult);
}
- return Table;
+ return std::move(Table);
}
Expected<std::unique_ptr<VersionInfoBlock>>
@@ -718,7 +718,7 @@ RCParser::parseVersionInfoBlockContents(StringRef BlockName) {
consume(); // Consume BlockEnd.
- return Contents;
+ return std::move(Contents);
}
Expected<std::unique_ptr<VersionInfoStmt>> RCParser::parseVersionInfoStmt() {
diff --git a/llvm/tools/llvm-rc/ResourceScriptToken.cpp b/llvm/tools/llvm-rc/ResourceScriptToken.cpp
index 3c88d904a993..175374788769 100644
--- a/llvm/tools/llvm-rc/ResourceScriptToken.cpp
+++ b/llvm/tools/llvm-rc/ResourceScriptToken.cpp
@@ -170,7 +170,7 @@ Expected<std::vector<RCToken>> Tokenizer::run() {
const size_t TokenStart = Pos;
if (Error TokenError = consumeToken(TokenKind))
- return TokenError;
+ return std::move(TokenError);
// Comments are just deleted, don't bother saving them.
if (TokenKind == Kind::LineComment || TokenKind == Kind::StartComment)
diff --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp
index eda064a11622..4dd4e4129c24 100644
--- a/llvm/tools/llvm-readobj/ELFDumper.cpp
+++ b/llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -1087,7 +1087,7 @@ ELFDumper<ELFT>::getSymbolVersionByIndex(uint32_t SymbolVersionIndex,
// Lookup this symbol in the version table.
if (Error E = LoadVersionMap())
- return E;
+ return std::move(E);
if (VersionIndex >= VersionMap.size() || !VersionMap[VersionIndex])
return createError("SHT_GNU_versym section refers to a version index " +
Twine(VersionIndex) + " which is missing");
diff --git a/llvm/tools/obj2yaml/elf2yaml.cpp b/llvm/tools/obj2yaml/elf2yaml.cpp
index b6a8395f237c..d399b95c1cfb 100644
--- a/llvm/tools/obj2yaml/elf2yaml.cpp
+++ b/llvm/tools/obj2yaml/elf2yaml.cpp
@@ -218,13 +218,13 @@ template <class ELFT> Expected<ELFYAML::Object *> ELFDumper<ELFT>::dump() {
if (SymTab) {
Y->Symbols.emplace();
if (Error E = dumpSymbols(SymTab, *Y->Symbols))
- return E;
+ return std::move(E);
}
if (DynSymTab) {
Y->DynamicSymbols.emplace();
if (Error E = dumpSymbols(DynSymTab, *Y->DynamicSymbols))
- return E;
+ return std::move(E);
}
for (const Elf_Shdr &Sec : Sections) {
@@ -563,7 +563,7 @@ Expected<ELFYAML::StackSizesSection *>
ELFDumper<ELFT>::dumpStackSizesSection(const Elf_Shdr *Shdr) {
auto S = std::make_unique<ELFYAML::StackSizesSection>();
if (Error E = dumpCommonSection(Shdr, *S))
- return E;
+ return std::move(E);
auto ContentOrErr = Obj.getSectionContents(Shdr);
if (!ContentOrErr)
@@ -596,7 +596,7 @@ Expected<ELFYAML::AddrsigSection *>
ELFDumper<ELFT>::dumpAddrsigSection(const Elf_Shdr *Shdr) {
auto S = std::make_unique<ELFYAML::AddrsigSection>();
if (Error E = dumpCommonSection(Shdr, *S))
- return E;
+ return std::move(E);
auto ContentOrErr = Obj.getSectionContents(Shdr);
if (!ContentOrErr)
@@ -637,7 +637,7 @@ Expected<ELFYAML::LinkerOptionsSection *>
ELFDumper<ELFT>::dumpLinkerOptionsSection(const Elf_Shdr *Shdr) {
auto S = std::make_unique<ELFYAML::LinkerOptionsSection>();
if (Error E = dumpCommonSection(Shdr, *S))
- return E;
+ return std::move(E);
auto ContentOrErr = Obj.getSectionContents(Shdr);
if (!ContentOrErr)
@@ -668,7 +668,7 @@ Expected<ELFYAML::DependentLibrariesSection *>
ELFDumper<ELFT>::dumpDependentLibrariesSection(const Elf_Shdr *Shdr) {
auto DL = std::make_unique<ELFYAML::DependentLibrariesSection>();
if (Error E = dumpCommonSection(Shdr, *DL))
- return E;
+ return std::move(E);
Expected<ArrayRef<uint8_t>> ContentOrErr = Obj.getSectionContents(Shdr);
if (!ContentOrErr)
@@ -695,7 +695,7 @@ Expected<ELFYAML::CallGraphProfileSection *>
ELFDumper<ELFT>::dumpCallGraphProfileSection(const Elf_Shdr *Shdr) {
auto S = std::make_unique<ELFYAML::CallGraphProfileSection>();
if (Error E = dumpCommonSection(Shdr, *S))
- return E;
+ return std::move(E);
Expected<ArrayRef<uint8_t>> ContentOrErr = Obj.getSectionContents(Shdr);
if (!ContentOrErr)
@@ -751,7 +751,7 @@ Expected<ELFYAML::DynamicSection *>
ELFDumper<ELFT>::dumpDynamicSection(const Elf_Shdr *Shdr) {
auto S = std::make_unique<ELFYAML::DynamicSection>();
if (Error E = dumpCommonSection(Shdr, *S))
- return E;
+ return std::move(E);
auto DynTagsOrErr = Obj.template getSectionContentsAsArray<Elf_Dyn>(Shdr);
if (!DynTagsOrErr)
@@ -768,7 +768,7 @@ Expected<ELFYAML::RelocationSection *>
ELFDumper<ELFT>::dumpRelocSection(const Elf_Shdr *Shdr) {
auto S = std::make_unique<ELFYAML::RelocationSection>();
if (auto E = dumpCommonRelocationSection(Shdr, *S))
- return E;
+ return std::move(E);
auto SymTabOrErr = Obj.getSection(Shdr->sh_link);
if (!SymTabOrErr)
@@ -782,7 +782,7 @@ ELFDumper<ELFT>::dumpRelocSection(const Elf_Shdr *Shdr) {
for (const Elf_Rel &Rel : *Rels) {
ELFYAML::Relocation R;
if (Error E = dumpRelocation(&Rel, SymTab, R))
- return E;
+ return std::move(E);
S->Relocations.push_back(R);
}
} else {
@@ -792,7 +792,7 @@ ELFDumper<ELFT>::dumpRelocSection(const Elf_Shdr *Shdr) {
for (const Elf_Rela &Rel : *Rels) {
ELFYAML::Relocation R;
if (Error E = dumpRelocation(&Rel, SymTab, R))
- return E;
+ return std::move(E);
R.Addend = Rel.r_addend;
S->Relocations.push_back(R);
}
@@ -806,7 +806,7 @@ Expected<ELFYAML::RelrSection *>
ELFDumper<ELFT>::dumpRelrSection(const Elf_Shdr *Shdr) {
auto S = std::make_unique<ELFYAML::RelrSection>();
if (auto E = dumpCommonSection(Shdr, *S))
- return E;
+ return std::move(E);
if (Expected<ArrayRef<Elf_Relr>> Relrs = Obj.relrs(Shdr)) {
S->Entries.emplace();
@@ -830,7 +830,7 @@ Expected<ELFYAML::RawContentSection *>
ELFDumper<ELFT>::dumpContentSection(const Elf_Shdr *Shdr) {
auto S = std::make_unique<ELFYAML::RawContentSection>();
if (Error E = dumpCommonSection(Shdr, *S))
- return E;
+ return std::move(E);
unsigned SecIndex = Shdr - &Sections[0];
if (SecIndex != 0 || Shdr->sh_type != ELF::SHT_NULL) {
@@ -854,7 +854,7 @@ Expected<ELFYAML::SymtabShndxSection *>
ELFDumper<ELFT>::dumpSymtabShndxSection(const Elf_Shdr *Shdr) {
auto S = std::make_unique<ELFYAML::SymtabShndxSection>();
if (Error E = dumpCommonSection(Shdr, *S))
- return E;
+ return std::move(E);
auto EntriesOrErr = Obj.template getSectionContentsAsArray<Elf_Word>(Shdr);
if (!EntriesOrErr)
@@ -869,7 +869,7 @@ Expected<ELFYAML::NoBitsSection *>
ELFDumper<ELFT>::dumpNoBitsSection(const Elf_Shdr *Shdr) {
auto S = std::make_unique<ELFYAML::NoBitsSection>();
if (Error E = dumpCommonSection(Shdr, *S))
- return E;
+ return std::move(E);
S->Size = Shdr->sh_size;
return S.release();
@@ -880,7 +880,7 @@ Expected<ELFYAML::NoteSection *>
ELFDumper<ELFT>::dumpNoteSection(const Elf_Shdr *Shdr) {
auto S = std::make_unique<ELFYAML::NoteSection>();
if (Error E = dumpCommonSection(Shdr, *S))
- return E;
+ return std::move(E);
auto ContentOrErr = Obj.getSectionContents(Shdr);
if (!ContentOrErr)
@@ -916,7 +916,7 @@ Expected<ELFYAML::HashSection *>
ELFDumper<ELFT>::dumpHashSection(const Elf_Shdr *Shdr) {
auto S = std::make_unique<ELFYAML::HashSection>();
if (Error E = dumpCommonSection(Shdr, *S))
- return E;
+ return std::move(E);
auto ContentOrErr = Obj.getSectionContents(Shdr);
if (!ContentOrErr)
@@ -957,7 +957,7 @@ Expected<ELFYAML::GnuHashSection *>
ELFDumper<ELFT>::dumpGnuHashSection(const Elf_Shdr *Shdr) {
auto S = std::make_unique<ELFYAML::GnuHashSection>();
if (Error E = dumpCommonSection(Shdr, *S))
- return E;
+ return std::move(E);
auto ContentOrErr = Obj.getSectionContents(Shdr);
if (!ContentOrErr)
@@ -1011,7 +1011,7 @@ ELFDumper<ELFT>::dumpVerdefSection(const Elf_Shdr *Shdr) {
auto S = std::make_unique<ELFYAML::VerdefSection>();
if (Error E = dumpCommonSection(Shdr, *S))
- return E;
+ return std::move(E);
S->Info = Shdr->sh_info;
@@ -1062,7 +1062,7 @@ ELFDumper<ELFT>::dumpSymverSection(const Elf_Shdr *Shdr) {
auto S = std::make_unique<ELFYAML::SymverSection>();
if (Error E = dumpCommonSection(Shdr, *S))
- return E;
+ return std::move(E);
auto VersionsOrErr = Obj.template getSectionContentsAsArray<Elf_Half>(Shdr);
if (!VersionsOrErr)
@@ -1081,7 +1081,7 @@ ELFDumper<ELFT>::dumpVerneedSection(const Elf_Shdr *Shdr) {
auto S = std::make_unique<ELFYAML::VerneedSection>();
if (Error E = dumpCommonSection(Shdr, *S))
- return E;
+ return std::move(E);
S->Info = Shdr->sh_info;
@@ -1154,7 +1154,7 @@ template <class ELFT>
Expected<ELFYAML::Group *> ELFDumper<ELFT>::dumpGroup(const Elf_Shdr *Shdr) {
auto S = std::make_unique<ELFYAML::Group>();
if (Error E = dumpCommonSection(Shdr, *S))
- return E;
+ return std::move(E);
// Get symbol with index sh_info. This symbol's name is the signature of the group.
Expected<StringRef> SymbolName = getSymbolName(Shdr->sh_link, Shdr->sh_info);
@@ -1190,7 +1190,7 @@ ELFDumper<ELFT>::dumpMipsABIFlags(const Elf_Shdr *Shdr) {
"Section type is not SHT_MIPS_ABIFLAGS");
auto S = std::make_unique<ELFYAML::MipsABIFlags>();
if (Error E = dumpCommonSection(Shdr, *S))
- return E;
+ return std::move(E);
auto ContentOrErr = Obj.getSectionContents(Shdr);
if (!ContentOrErr)
diff --git a/llvm/tools/obj2yaml/macho2yaml.cpp b/llvm/tools/obj2yaml/macho2yaml.cpp
index aff2d9442c3c..0ee8814d35ab 100644
--- a/llvm/tools/obj2yaml/macho2yaml.cpp
+++ b/llvm/tools/obj2yaml/macho2yaml.cpp
@@ -198,8 +198,8 @@ Expected<std::unique_ptr<MachOYAML::Object>> MachODumper::dump() {
std::unique_ptr<DWARFContext> DICtx = DWARFContext::create(Obj);
if (auto Err = dwarf2yaml(*DICtx, Y->DWARF))
- return Err;
- return Y;
+ return std::move(Err);
+ return std::move(Y);
}
void MachODumper::dumpHeader(std::unique_ptr<MachOYAML::Object> &Y) {
diff --git a/llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp b/llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp
index a9f2d3fff036..31a4247e27d0 100644
--- a/llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp
@@ -56,7 +56,7 @@ class MockObjectLayer {
if (auto Sym = KV.second(Name, ExportedSymbolsOnly))
return Sym;
else if (auto Err = Sym.takeError())
- return Err;
+ return std::move(Err);
}
return JITSymbol(nullptr);
}
diff --git a/llvm/utils/TableGen/GlobalISelEmitter.cpp b/llvm/utils/TableGen/GlobalISelEmitter.cpp
index 726e4ab73f00..9a2f1a1b5ea0 100644
--- a/llvm/utils/TableGen/GlobalISelEmitter.cpp
+++ b/llvm/utils/TableGen/GlobalISelEmitter.cpp
@@ -3817,7 +3817,7 @@ Expected<InstructionMatcher &> GlobalISelEmitter::createAndImportSelDAGMatcher(
if (auto Error =
importChildMatcher(Rule, InsnMatcher, SrcChild, OperandIsAPointer,
OperandIsImmArg, OpIdx++, TempOpIdx))
- return Error;
+ return std::move(Error);
}
}
@@ -4083,7 +4083,7 @@ Expected<action_iterator> GlobalISelEmitter::importExplicitUseRenderer(
auto InsertPtOrError = createAndImportSubInstructionRenderer(
++InsertPt, Rule, DstChild, TempRegID);
if (auto Error = InsertPtOrError.takeError())
- return Error;
+ return std::move(Error);
return InsertPtOrError.get();
}
@@ -4162,7 +4162,7 @@ Expected<BuildMIAction &> GlobalISelEmitter::createAndImportInstructionRenderer(
const TreePatternNode *Dst) {
auto InsertPtOrError = createInstructionRenderer(M.actions_end(), M, Dst);
if (auto Error = InsertPtOrError.takeError())
- return Error;
+ return std::move(Error);
action_iterator InsertPt = InsertPtOrError.get();
BuildMIAction &DstMIBuilder = *static_cast<BuildMIAction *>(InsertPt->get());
@@ -4182,7 +4182,7 @@ Expected<BuildMIAction &> GlobalISelEmitter::createAndImportInstructionRenderer(
if (auto Error = importExplicitUseRenderers(InsertPt, M, DstMIBuilder, Dst)
.takeError())
- return Error;
+ return std::move(Error);
return DstMIBuilder;
}
@@ -4196,7 +4196,7 @@ GlobalISelEmitter::createAndImportSubInstructionRenderer(
// TODO: Assert there's exactly one result.
if (auto Error = InsertPtOrError.takeError())
- return Error;
+ return std::move(Error);
BuildMIAction &DstMIBuilder =
*static_cast<BuildMIAction *>(InsertPtOrError.get()->get());
@@ -4207,7 +4207,7 @@ GlobalISelEmitter::createAndImportSubInstructionRenderer(
InsertPtOrError =
importExplicitUseRenderers(InsertPtOrError.get(), M, DstMIBuilder, Dst);
if (auto Error = InsertPtOrError.takeError())
- return Error;
+ return std::move(Error);
// We need to make sure that when we import an INSERT_SUBREG as a
// subinstruction that it ends up being constrained to the correct super
@@ -4347,7 +4347,7 @@ Expected<action_iterator> GlobalISelEmitter::importExplicitUseRenderers(
auto InsertPtOrError = createAndImportSubInstructionRenderer(
++InsertPt, M, ValChild, TempRegID);
if (auto Error = InsertPtOrError.takeError())
- return Error;
+ return std::move(Error);
DstMIBuilder.addRenderer<TempRegRenderer>(TempRegID, false, SubIdx);
return InsertPt;
@@ -4397,7 +4397,7 @@ Expected<action_iterator> GlobalISelEmitter::importExplicitUseRenderers(
auto InsertPtOrError =
importExplicitUseRenderer(InsertPt, M, DstMIBuilder, ValChild);
if (auto Error = InsertPtOrError.takeError())
- return Error;
+ return std::move(Error);
InsertPt = InsertPtOrError.get();
DstMIBuilder.addRenderer<SubRegIndexRenderer>(SubIdx);
}
@@ -4458,7 +4458,7 @@ Expected<action_iterator> GlobalISelEmitter::importExplicitUseRenderers(
DagInit *DefaultOps = DstIOperand.Rec->getValueAsDag("DefaultOps");
if (auto Error = importDefaultOperandRenderers(
InsertPt, M, DstMIBuilder, DefaultOps))
- return Error;
+ return std::move(Error);
++NumDefaultOps;
continue;
}
@@ -4466,7 +4466,7 @@ Expected<action_iterator> GlobalISelEmitter::importExplicitUseRenderers(
auto InsertPtOrError = importExplicitUseRenderer(InsertPt, M, DstMIBuilder,
Dst->getChild(Child));
if (auto Error = InsertPtOrError.takeError())
- return Error;
+ return std::move(Error);
InsertPt = InsertPtOrError.get();
++Child;
}
@@ -4667,7 +4667,7 @@ Expected<RuleMatcher> GlobalISelEmitter::runOnPattern(const PatternToMatch &P) {
llvm::to_string(*P.getDstPattern()));
if (auto Error = importRulePredicates(M, P.getPredicates()))
- return Error;
+ return std::move(Error);
// Next, analyze the pattern operators.
TreePatternNode *Src = P.getSrcPattern();
@@ -4707,7 +4707,7 @@ Expected<RuleMatcher> GlobalISelEmitter::runOnPattern(const PatternToMatch &P) {
auto InsnMatcherOrError =
createAndImportSelDAGMatcher(M, InsnMatcherTemp, Src, TempOpIdx);
if (auto Error = InsnMatcherOrError.takeError())
- return Error;
+ return std::move(Error);
InstructionMatcher &InsnMatcher = InsnMatcherOrError.get();
if (Dst->isLeaf()) {
@@ -4735,7 +4735,7 @@ Expected<RuleMatcher> GlobalISelEmitter::runOnPattern(const PatternToMatch &P) {
// We're done with this pattern! It's eligible for GISel emission; return
// it.
++NumPatternImported;
- return M;
+ return std::move(M);
}
return failedImport("Dst pattern root isn't a known leaf");
@@ -4823,13 +4823,13 @@ Expected<RuleMatcher> GlobalISelEmitter::runOnPattern(const PatternToMatch &P) {
auto DstMIBuilderOrError =
createAndImportInstructionRenderer(M, InsnMatcher, Src, Dst);
if (auto Error = DstMIBuilderOrError.takeError())
- return Error;
+ return std::move(Error);
BuildMIAction &DstMIBuilder = DstMIBuilderOrError.get();
// Render the implicit defs.
// These are only added to the root of the result.
if (auto Error = importImplicitDefRenderers(DstMIBuilder, P.getDstRegs()))
- return Error;
+ return std::move(Error);
DstMIBuilder.chooseInsnToMutate(M);
@@ -4850,7 +4850,7 @@ Expected<RuleMatcher> GlobalISelEmitter::runOnPattern(const PatternToMatch &P) {
// We're done with this pattern! It's eligible for GISel emission; return
// it.
++NumPatternImported;
- return M;
+ return std::move(M);
}
if (DstIName == "EXTRACT_SUBREG") {
@@ -4886,7 +4886,7 @@ Expected<RuleMatcher> GlobalISelEmitter::runOnPattern(const PatternToMatch &P) {
// We're done with this pattern! It's eligible for GISel emission; return
// it.
++NumPatternImported;
- return M;
+ return std::move(M);
}
if (DstIName == "INSERT_SUBREG") {
@@ -4907,7 +4907,7 @@ Expected<RuleMatcher> GlobalISelEmitter::runOnPattern(const PatternToMatch &P) {
M.addAction<ConstrainOperandToRegClassAction>(0, 1, **SuperClass);
M.addAction<ConstrainOperandToRegClassAction>(0, 2, **SubClass);
++NumPatternImported;
- return M;
+ return std::move(M);
}
if (DstIName == "SUBREG_TO_REG") {
@@ -4931,14 +4931,14 @@ Expected<RuleMatcher> GlobalISelEmitter::runOnPattern(const PatternToMatch &P) {
M.addAction<ConstrainOperandToRegClassAction>(0, 0, **SuperClass);
M.addAction<ConstrainOperandToRegClassAction>(0, 2, **SubClass);
++NumPatternImported;
- return M;
+ return std::move(M);
}
M.addAction<ConstrainOperandsToDefinitionAction>(0);
// We're done with this pattern! It's eligible for GISel emission; return it.
++NumPatternImported;
- return M;
+ return std::move(M);
}
// Emit imm predicate table and an enum to reference them with.
More information about the llvm-commits
mailing list