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 1c2241a793.
This commit is contained in:
Bill Wendling
2020-02-10 07:06:45 -08:00
parent 5ad62d3b7f
commit c55cf4afa9
137 changed files with 506 additions and 506 deletions

View File

@@ -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: