1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-21 18:22:53 +01:00

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

View File

@ -209,7 +209,7 @@ public:
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 @@ public:
// 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 @@ public:
// 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);
}
}

View File

@ -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);
}

View File

@ -48,7 +48,7 @@ public:
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;
}

View File

@ -60,7 +60,7 @@ public:
T Record(K);
CVType CVT(Data);
if (auto EC = deserializeAs<T>(CVT, Record))
return EC;
return std::move(EC);
return Record;
}

View File

@ -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;
}

View File

@ -233,7 +233,7 @@ private:
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 @@ public:
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 @@ private:
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 @@ private:
} 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 @@ private:
SetSymbolResolver(K, std::move(Resolver));
if (auto Err = BaseLayer.addModule(std::move(K), std::move(M)))
return Err;
return std::move(Err);
return K;
}

View File

@ -80,8 +80,8 @@ public:
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 @@ public:
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 @@ public:
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:

View File

@ -262,13 +262,13 @@ public:
/// 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:

View File

@ -57,13 +57,13 @@ private:
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");

View File

@ -101,9 +101,9 @@ public:
new LocalLazyCallThroughManager(ES, ErrorHandlerAddr));
if (auto Err = LLCTM->init<ORCABI>())
return Err;
return std::move(Err);
return LLCTM;
return std::move(LLCTM);
}
};

View File

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

View File

@ -457,7 +457,7 @@ public:
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 @@ public:
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 @@ public:
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 @@ public:
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 @@ public:
// 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);

View File

@ -265,7 +265,7 @@ private:
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 @@ private:
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

View File

@ -1528,20 +1528,20 @@ public:
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);
}
}

View File

@ -276,7 +276,7 @@ private:
// 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 @@ public:
if (auto Sym = KV.second->getSymbol(Name, ExportedSymbolsOnly))
return Sym;
else if (auto Err = Sym.takeError())
return Err;
return std::move(Err);
return nullptr;
}

View File

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

View File

@ -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();

View File

@ -77,7 +77,7 @@ public:
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 @@ public:
if (ReadErr != coveragemap_error::success) {
auto E = make_error<CoverageMapError>(ReadErr);
ReadErr = coveragemap_error::success;
return E;
return std::move(E);
}
return &Record;
}

View File

@ -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();
}

View File

@ -98,7 +98,7 @@ public:
IsTaskInFlight = true;
}
}
return F;
return std::move(F);
}
private:

View File

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

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:

View File

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

View File

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

View File

@ -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;
}

View File

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

View File

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

View File

@ -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) {

View File

@ -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);
}
}

View File

@ -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;
}

View File

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

View File

@ -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;
}

View File

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

View File

@ -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);
}

View File

@ -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;
}

View File

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

View File

@ -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);

View File

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

View File

@ -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));

View File

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

View File

@ -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");

View File

@ -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);
}

View File

@ -102,7 +102,7 @@ private:
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);

View File

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

View File

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

View File

@ -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) {

View File

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

View File

@ -305,7 +305,7 @@ public:
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 @@ public:
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 @@ public:
*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 @@ public:
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 @@ public:
return AddrOrErr.takeError();
} else if (auto Err = Sym.takeError()) {
// Lookup failure - report error.
return Err;
return std::move(Err);
}
// Symbol not found. Return 0.

View File

@ -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);
}

View File

@ -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";

View File

@ -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;
}

View File

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

View File

@ -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);
}

View File

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

View File

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

View File

@ -40,7 +40,7 @@ Expected<unsigned> Pipeline::run() {
do {
notifyCycleBegin();
if (Error Err = runCycle())
return Err;
return std::move(Err);
notifyCycleEnd();
++Cycles;
} while (hasWorkToProcess());

View File

@ -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;
}

View File

@ -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});

View File

@ -151,7 +151,7 @@ public:
Expected<COFFModuleDefinition> parse() {
do {
if (Error Err = parseOne())
return Err;
return std::move(Err);
} while (Tok.K != Eof);
return Info;
}

View File

@ -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");

View File

@ -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;
}

View File

@ -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));
}

View File

@ -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);
}

View File

@ -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);
}

View File

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

View File

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

View File

@ -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));

View File

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

View File

@ -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);
}

View File

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

View File

@ -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);
}

View File

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

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -377,5 +377,5 @@ DWARFYAML::EmitDebugSections(StringRef YAMLString, bool ApplyFixups,
DebugSections);
EmitDebugSectionImpl(DI, &DWARFYAML::EmitDebugAranges, "debug_aranges",
DebugSections);
return DebugSections;
return std::move(DebugSections);
}

View File

@ -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;
}

View File

@ -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 @@ public:
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 @@ public:
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) {

View File

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

View File

@ -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) {

View File

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

View File

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

View File

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

View File

@ -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);
}

View File

@ -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) {

View File

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

View File

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

View File

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

View File

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

View File

@ -1264,7 +1264,7 @@ Expected<TempFile> TempFile::create(const Twine &Model, unsigned Mode) {
return errorCodeToError(EC);
}
#endif
return Ret;
return std::move(Ret);
}
}

View File

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

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

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

View File

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

View File

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

View File

@ -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;
}

View File

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

View File

@ -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);
}

Some files were not shown because too many files have changed in this diff Show More