aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/bugpoint/ExecutionDriver.cpp8
-rw-r--r--llvm/tools/bugpoint/ListReducer.h6
-rw-r--r--llvm/tools/bugpoint/Miscompilation.cpp44
-rw-r--r--llvm/tools/bugpoint/ToolRunner.cpp2
-rw-r--r--llvm/tools/dsymutil/BinaryHolder.cpp4
-rw-r--r--llvm/tools/dsymutil/DebugMap.cpp2
-rw-r--r--llvm/tools/dsymutil/MachODebugMapParser.cpp2
-rw-r--r--llvm/tools/dsymutil/dsymutil.cpp6
-rw-r--r--llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp4
-rw-r--r--llvm/tools/llvm-cfi-verify/lib/FileAnalysis.cpp8
-rw-r--r--llvm/tools/llvm-cov/SourceCoverageView.cpp2
-rw-r--r--llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp2
-rw-r--r--llvm/tools/llvm-dwp/llvm-dwp.cpp2
-rw-r--r--llvm/tools/llvm-elfabi/ELFObjHandler.cpp4
-rw-r--r--llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp4
-rw-r--r--llvm/tools/llvm-exegesis/lib/Clustering.cpp2
-rw-r--r--llvm/tools/llvm-exegesis/lib/LatencyBenchmarkRunner.cpp2
-rw-r--r--llvm/tools/llvm-exegesis/lib/SerialSnippetGenerator.cpp2
-rw-r--r--llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp6
-rw-r--r--llvm/tools/llvm-exegesis/lib/UopsBenchmarkRunner.cpp2
-rw-r--r--llvm/tools/llvm-exegesis/lib/X86/Target.cpp4
-rw-r--r--llvm/tools/llvm-ifs/llvm-ifs.cpp2
-rw-r--r--llvm/tools/llvm-jitlink/llvm-jitlink.cpp4
-rw-r--r--llvm/tools/llvm-mca/llvm-mca.cpp2
-rw-r--r--llvm/tools/llvm-objcopy/COFF/Reader.cpp10
-rw-r--r--llvm/tools/llvm-objcopy/CopyConfig.cpp54
-rw-r--r--llvm/tools/llvm-objcopy/ELF/Object.cpp6
-rw-r--r--llvm/tools/llvm-objcopy/wasm/Reader.cpp2
-rw-r--r--llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp2
-rw-r--r--llvm/tools/llvm-pdbutil/InputFile.cpp10
-rw-r--r--llvm/tools/llvm-rc/ResourceScriptParser.cpp18
-rw-r--r--llvm/tools/llvm-rc/ResourceScriptToken.cpp2
-rw-r--r--llvm/tools/llvm-readobj/ELFDumper.cpp2
-rw-r--r--llvm/tools/obj2yaml/elf2yaml.cpp46
-rw-r--r--llvm/tools/obj2yaml/macho2yaml.cpp4
35 files changed, 141 insertions, 141 deletions
diff --git a/llvm/tools/bugpoint/ExecutionDriver.cpp b/llvm/tools/bugpoint/ExecutionDriver.cpp
index 0aa5837..4c83a95 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::diffProgram(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 e944549..04f2207 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 cd5eb19..e69fe9f 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.diffProgram(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.diffProgram(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.diffProgram(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 @@ public:
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.diffProgram(*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 @@ public:
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.diffProgram(
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 2fc2d9b..d880aca 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 ba3ecbe..31d32d8 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 f6c3400..4106710 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 087f514..83703fb 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 fa5ac47..6b26081 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 3307fac..639a6d1 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 8b0d257..d2b4db3b5 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 c1c3fec..cd7395a 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 70f8f94..1363e0a 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 bd62990..23513ef 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 420239a..124fffb 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 e93ab45..6981aaa 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 e73d6ec..33a8e01 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 3134d03..83a3f01 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 9c7f7da..fea6dc9 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 e7f95d0..21932f4 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 af5b977..b99b1c5 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 876847b..72553af 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 f653c3a..3b0d2ee 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 df04a2e..26bcf46 100644
--- a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
+++ b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
@@ -238,8 +238,8 @@ public:
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 a4b2514..06c1ce9 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 ad612af..7be9cce 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 42bddf7..69d6180 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 691034f..14ac7bb 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 20443cc..13fa84a 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 63dc461..32448ce 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 7a5dfd3..b316882 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 62adb51..36b3056 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 3c88d90..1753747 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 eda064a..4dd4e41 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 b6a8395..d399b95 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 aff2d94..0ee8814 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) {