unsigned BitsLeft = NumBits - BitsInCurWord;
if (Error fillResult = fillCurWord())
- return fillResult;
+ return std::move(fillResult);
// If we run out of data, abort.
if (BitsLeft > BitsInCurWord)
// 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;
}
// 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);
}
}
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);
}
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;
}
T Record(K);
CVType CVT(Data);
if (auto EC = deserializeAs<T>(CVT, Record))
- return EC;
+ return std::move(EC);
return Record;
}
if (Error E =
List.extract(Data, getHeaderOffset(), End, &Offset,
Header.getSectionName(), Header.getListTypeString()))
- return E;
+ return std::move(E);
ListMap[StartingOffset] = List;
return List;
}
if (auto Sym = BaseLayer.findSymbolIn(BLK, Name, ExportedSymbolsOnly))
return Sym;
else if (auto Err = Sym.takeError())
- return Err;
+ return std::move(Err);
return nullptr;
}
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);
}
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;
};
} else
return FnBodyAddrOrErr.takeError();
} else if (auto Err = FnBodySym.takeError())
- return Err;
+ return std::move(Err);
else
llvm_unreachable("Function not emitted for partition");
}
SetSymbolResolver(K, std::move(Resolver));
if (auto Err = BaseLayer.addModule(std::move(K), std::move(M)))
- return Err;
+ return std::move(Err);
return K;
}
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.
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();
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:
/// 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:
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");
new LocalLazyCallThroughManager(ES, ErrorHandlerAddr));
if (auto Err = LLCTM->init<ORCABI>())
- return Err;
+ return std::move(Err);
- return LLCTM;
+ return std::move(LLCTM);
}
};
if (!Sym.getFlags().isStrong())
Result.insert(S);
} else if (auto Err = Sym.takeError())
- return Err;
+ return std::move(Err);
}
return Result;
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();
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
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));
}
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);
}
// 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);
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)));
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
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);
}
}
// 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();
};
}
if (auto Sym = KV.second->getSymbol(Name, ExportedSymbolsOnly))
return Sym;
else if (auto Err = Sym.takeError())
- return Err;
+ return std::move(Err);
return nullptr;
}
": 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)
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();
if (ReadErr != coveragemap_error::success) {
auto E = make_error<CoverageMapError>(ReadErr);
ReadErr = coveragemap_error::success;
- return E;
+ return std::move(E);
}
return Record;
}
if (ReadErr != coveragemap_error::success) {
auto E = make_error<CoverageMapError>(ReadErr);
ReadErr = coveragemap_error::success;
- return E;
+ return std::move(E);
}
return &Record;
}
if (auto Err = handleErrors(ValOrErr.takeError(),
std::forward<HandlerTs>(Handlers)...))
- return Err;
+ return std::move(Err);
return RecoveryPath();
}
IsTaskInFlight = true;
}
}
- return F;
+ return std::move(F);
}
private:
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;
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.
/// "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;
// 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))
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.
// Ignore other sub-blocks.
if (Error Err = Stream.SkipBlock())
- return Err;
+ return std::move(Err);
continue;
case BitstreamEntry::Record:
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;
// Ignore other sub-blocks.
if (Error Err = Stream.SkipBlock())
- return Err;
+ return std::move(Err);
continue;
case BitstreamEntry::Record:
// 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();
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) {
case BitstreamEntry::SubBlock:
if (Error Err = Stream.SkipBlock())
- return Err;
+ return std::move(Err);
break;
case BitstreamEntry::Record:
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();
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),
}
if (Error Err = Stream.SkipBlock())
- return Err;
+ return std::move(Err);
continue;
}
case BitstreamEntry::Record:
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)
}
if (Error JumpFailed = Stream.JumpToBit(ModuleBit))
- return JumpFailed;
+ return std::move(JumpFailed);
auto *R = new BitcodeReader(std::move(Stream), Strtab, ProducerIdentification,
Context);
// 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>>
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) {
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();
// Ignore other sub-blocks.
if (Error Err = Stream.SkipBlock())
- return Err;
+ return std::move(Err);
continue;
case BitstreamEntry::Record:
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 =
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))
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);
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;
// 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))
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:
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);
break;
case BitCodeAbbrevOp::Char6:
if (Error Err = JumpToBit(GetCurrentBitNo() + NumElts * 6))
- return Err;
+ return std::move(Err);
break;
}
continue;
// Skip over the blob.
if (Error Err = JumpToBit(NewEnd))
- return Err;
+ return std::move(Err);
}
return Code;
}
// 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.
Expected<Optional<BitstreamBlockInfo>>
BitstreamCursor::ReadBlockInfoBlock(bool ReadBlockInfoNames) {
if (llvm::Error Err = EnterSubBlock(bitc::BLOCKINFO_BLOCK_ID))
- return Err;
+ return std::move(Err);
BitstreamBlockInfo NewBlockInfo;
case llvm::BitstreamEntry::Error:
return None;
case llvm::BitstreamEntry::EndBlock:
- return NewBlockInfo;
+ return std::move(NewBlockInfo);
case llvm::BitstreamEntry::Record:
// The interesting case.
break;
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.
Reader.setOffset(Offset);
StringRef Result;
if (auto EC = Reader.readCString(Result))
- return EC;
+ return std::move(EC);
return Result;
}
if (!AttrEncOr)
return AttrEncOr.takeError();
if (isSentinel(*AttrEncOr))
- return Result;
+ return std::move(Result);
Result.emplace_back(*AttrEncOr);
}
return createStringError(errc::io_error,
"Error extracting index attribute values.");
}
- return E;
+ return std::move(E);
}
DWARFDebugNames::NameTableEntry
if (Pos.second) {
if (Error Err =
LT->parse(DebugLineData, &Offset, Ctx, U, RecoverableErrorCallback))
- return Err;
+ return std::move(Err);
return LT;
}
return LT;
}
ListTableType Table;
if (Error E = Table.extractHeaderAndOffsets(DA, &Offset))
- return E;
+ return std::move(E);
return Table;
}
if (getVersion() <= 4) {
DWARFDebugRangeList RangeList;
if (Error E = extractRangeList(Offset, RangeList))
- return E;
+ return std::move(E);
return RangeList.getAbsoluteRanges(getBaseAddress());
}
if (RngListTable) {
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);
}
}
}
Offset += InfoLength;
}
- return FI;
+ return std::move(FI);
}
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,
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,
llvm::Error Err = InlineInfo::lookup(GR, *InlineInfoData, FuncAddr, Addr,
LR.Locations);
if (Err)
- return Err;
+ return std::move(Err);
return LR;
}
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
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;
}
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.
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,
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;
}
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()) {
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);
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);
}
Names.setOffset(FileOffset);
StringRef Name;
if (auto EC = Names.readCString(Name))
- return EC;
+ return std::move(EC);
return Name;
}
continue;
if (auto EC = Result.initialize(SS.getRecordData()))
- return EC;
+ return std::move(EC);
return Result;
}
return Result;
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);
ArrayRef<uint8_t> Result;
if (auto EC = Buffer->readBytes(StreamBlockOffset, NumBytes, Result))
- return EC;
+ return std::move(EC);
return Result;
}
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;
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;
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;
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;
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;
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;
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;
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);
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;
T Deserialized;
if (auto E = TypeDeserializer::deserializeAs(const_cast<CVType &>(Rec),
Deserialized))
- return E;
+ return std::move(E);
return getHashForUdt(Deserialized, Rec.data());
}
T Deserialized;
if (auto E = TypeDeserializer::deserializeAs(const_cast<CVType &>(Rec),
Deserialized))
- return E;
+ return std::move(E);
ClassOptions Opts = Deserialized.getOptions();
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));
Uniquify(Fs);
Uniquify(Os);
- return res;
+ return std::move(res);
}
SymbolizableObjectFile::SymbolizableObjectFile(const ObjectFile *Obj,
uint8_t *NextField = &AugInfo.Fields[0];
if (auto Err = RecordReader.readInteger(NextChar))
- return Err;
+ return std::move(Err);
while (NextChar != 0) {
switch (NextChar) {
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) +
}
if (auto Err = RecordReader.readInteger(NextChar))
- return Err;
+ return std::move(Err);
}
- return AugInfo;
+ return std::move(AugInfo);
}
Expected<JITTargetAddress>
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");
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);
}
Optional<CompileOnDemandLayer::GlobalValueSet>
CompileOnDemandLayer::compileRequested(GlobalValueSet Requested) {
- return Requested;
+ return std::move(Requested);
}
Optional<CompileOnDemandLayer::GlobalValueSet>
SymbolFlags[Mangle(GV->getName())] =
JITSymbolFlags::fromGlobalValue(*GV);
if (auto Err = R.defineMaterializing(SymbolFlags))
- return Err;
+ return std::move(Err);
}
expandPartition(*GVsToExtract);
Expected<SimpleCompiler::CompileResult> SimpleCompiler::operator()(Module &M) {
CompileResult CachedObject = tryToLoadFromObjectCache(M);
if (CachedObject)
- return CachedObject;
+ return std::move(CachedObject);
SmallVector<char, 0> ObjBufferSV;
return Obj.takeError();
notifyObjectCompiled(M, *ObjBuffer);
- return ObjBuffer;
+ return std::move(ObjBuffer);
}
SimpleCompiler::CompileResult
// 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);
});
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)");
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
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
return errorCodeToError(EC);
DumpStream.write(Obj->getBufferStart(), Obj->getBufferSize());
- return Obj;
+ return std::move(Obj);
}
StringRef DumpObjects::getBufferIdentifier(MemoryBuffer &B) {
new StaticLibraryDefinitionGenerator(L, std::move(ArchiveBuffer), Err));
if (Err)
- return Err;
+ return std::move(Err);
- return ADG;
+ return std::move(ADG);
}
Error StaticLibraryDefinitionGenerator::tryToGenerate(
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);
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);
*this, ExternalResolver, ExternalResolverCtx);
if (auto Err = ObjectLayer.addObject(K, std::move(ObjBuffer)))
- return Err;
+ return std::move(Err);
KeyLayers[K] = detail::createGenericLayer(ObjectLayer);
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.
return AddrOrErr.takeError();
} else if (auto Err = Sym.takeError()) {
// Lookup failure - report error.
- return Err;
+ return std::move(Err);
}
// Symbol not found. Return 0.
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.
}
}
- return Result;
+ return std::move(Result);
}
CodeSize, CodeAlign,
RODataSize, RODataAlign,
RWDataSize, RWDataAlign))
- return Err;
+ return std::move(Err);
MemMgr.reserveAllocationSpace(CodeSize, CodeAlign, RODataSize, RODataAlign,
RWDataSize, RWDataAlign);
}
// 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;
// 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");
// 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";
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>
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);
++SI;
}
- return Obj;
+ return std::move(Obj);
}
static OwningBinary<ObjectFile>
// 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.
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;
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;
}
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,
File->Mods = FOrErr->Mods;
File->Strtab = std::move(FOrErr->Strtab);
- return File;
+ return std::move(File);
}
StringRef InputFile::getName() const {
Mod.M = std::move(*MOrErr);
if (Error Err = M.materializeMetadata())
- return Err;
+ return std::move(Err);
UpgradeDebugInfo(M);
ModuleSymbolTable SymTab;
for (GlobalValue &GV : M.global_values())
handleNonPrevailingComdat(GV, NonPrevailingComdats);
assert(MsymI == MsymE);
- return Mod;
+ return std::move(Mod);
}
Error LTO::linkRegularLTO(RegularLTOState::AddedModule Mod,
auto ResultOrErr = llvm::setupLLVMOptimizationRemarks(
Context, Filename, RemarksPasses, RemarksFormat, RemarksWithHotness);
if (Error E = ResultOrErr.takeError())
- return E;
+ return std::move(E);
if (*ResultOrErr)
(*ResultOrErr)->keep();
return errorCodeToError(EC);
StatsFile->keep();
- return StatsFile;
+ return std::move(StatsFile);
}
Ret->parseSymbols();
Ret->parseMetadata();
- return Ret;
+ return std::move(Ret);
}
/// Create a MemoryBuffer from a memory range with an optional name.
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);
// 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();
// 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.
++WriteIndex;
}
- return NewIS;
+ return std::move(NewIS);
}
} // namespace mca
} // namespace llvm
do {
notifyCycleBegin();
if (Error Err = runCycle())
- return Err;
+ return std::move(Err);
notifyCycleEnd();
++Cycles;
} while (hasWorkToProcess());
Error Err = Error::success();
Child Ret(Parent, NextLoc, &Err);
if (Err)
- return Err;
+ return std::move(Err);
return Ret;
}
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) {
Error Err = Error::success();
Child C(Parent, Loc, &Err);
if (Err)
- return Err;
+ return std::move(Err);
return C;
}
return AccessModeOrErr.takeError();
M.Perms = AccessModeOrErr.get();
}
- return M;
+ return std::move(M);
}
Expected<NewArchiveMember> NewArchiveMember::getFile(StringRef FileName,
M.GID = Status.getGroup();
M.Perms = Status.permissions();
}
- return M;
+ return std::move(M);
}
template <typename T>
continue;
Ret.push_back(SymNames.tell());
if (Error E = S.printName(SymNames))
- return E;
+ return std::move(E);
SymNames << '\0';
}
return Ret;
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});
Expected<COFFModuleDefinition> parse() {
do {
if (Error Err = parseOne())
- return Err;
+ return std::move(Err);
} while (Tok.K != Eof);
return Info;
}
const coff_section *Sec = toSec(Ref);
ArrayRef<uint8_t> Res;
if (Error E = getSectionContents(Sec, Res))
- return E;
+ return std::move(E);
return Res;
}
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 {
do { \
Error E = (Expr); \
if (E) \
- return E; \
+ return std::move(E); \
} while (0)
Expected<ArrayRef<UTF16>>
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");
Error Err = isGnuStyle(Name) ? D.consumeCompressedGnuHeader()
: D.consumeCompressedZLibHeader(Is64Bit, IsLE);
if (Err)
- return Err;
+ return std::move(Err);
return D;
}
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));
}
F.Symtab = std::move(FCOrErr->Symtab);
F.Strtab = std::move(FCOrErr->Strtab);
F.TheReader = std::move(FCOrErr->TheReader);
- return F;
+ return std::move(F);
}
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());
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) {
if (FC.TheReader.getNumModules() != BFC.Mods.size())
return upgrade(std::move(BFC.Mods));
- return FC;
+ return std::move(FC);
}
Is64Bits, Err, UniversalCputype,
UniversalIndex));
if (Err)
- return Err;
- return Obj;
+ return std::move(Err);
+ return std::move(Obj);
}
MachOObjectFile::MachOObjectFile(MemoryBufferRef Object, bool IsLittleEndian,
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)
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));
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(
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);
}
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)
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() {
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;
}
Error E = Error::success();
WindowsResourceCOFFWriter Writer(MachineType, Parser, E);
if (E)
- return E;
+ return std::move(E);
return Writer.write(TimeDateStamp);
}
Sec.FileOffsetToRelocationInfo);
auto NumRelocEntriesOrErr = getLogicalNumberOfRelocationEntries(Sec);
if (Error E = NumRelocEntriesOrErr.takeError())
- return E;
+ return std::move(E);
uint32_t NumRelocEntries = NumRelocEntriesOrErr.get();
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();
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')
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();
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;
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;
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>>
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;
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;
assert(CVS != nullptr);
Result.push_back(std::move(CVS));
}
- return Result;
+ return std::move(Result);
}
namespace {
const DebugSubsectionRecord &SS) {
SubsectionConversionVisitor V;
if (auto EC = visitDebugSubsection(SS, V, SC))
- return EC;
+ return std::move(EC);
return V.Subsection;
}
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;
}
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;
}
DebugSections);
EmitDebugSectionImpl(DI, &DWARFYAML::EmitDebugAranges, "debug_aranges",
DebugSections);
- return DebugSections;
+ return std::move(DebugSections);
}
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.
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;
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;
}
// 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;
}
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.
if (Error Err =
insertFunctionRecordIfNeeded(CFR, Mapping, FilenamesBegin))
- return Err;
+ return std::move(Err);
CFR++;
}
return Buf;
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);
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>>
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())
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();
InstrProfSymtab ProfileNames;
if (Error E = ProfileNames.create(*NamesSection))
- return E;
+ return std::move(E);
return BinaryCoverageReader::createCoverageReaderFromBuffer(
CoverageMappingOrErr.get(), std::move(ProfileNames), BytesInAddress,
if (!ReaderOrErr)
return ReaderOrErr.takeError();
Readers.push_back(std::move(ReaderOrErr.get()));
- return Readers;
+ return std::move(Readers);
}
auto BinOrErr = createBinary(ObjectBuffer);
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
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) {
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.
Error E = VPD->checkIntegrity();
if (E)
- return E;
+ return std::move(E);
- return VPD;
+ return std::move(VPD);
}
void ValueProfData::swapBytesToHost(support::endianness Endianness) {
// 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()));
}
// 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>>
// 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;
if (!RemappingPathStr.empty()) {
auto RemappingBufferOrError = setupMemoryBuffer(RemappingPathStr);
if (Error E = RemappingBufferOrError.takeError())
- return E;
+ return std::move(E);
RemappingBuffer = std::move(RemappingBufferOrError.get());
}
// 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() {
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.
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.
return EC;
}
- return Reader;
+ return std::move(Reader);
}
// For text and GCC file formats, we compute the summary after reading the
return EC;
Writer->Format = Format;
- return Writer;
+ return std::move(Writer);
}
void SampleProfileWriter::computeSummary(
break;
}
if (Error E = Stream.JumpToBit(PreviousBitNo))
- return E;
+ return std::move(E);
return Result;
}
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))
if (ExternalFilePrependPath)
Parser->ExternalFilePrependPath = std::string(*ExternalFilePrependPath);
- return Parser;
+ return std::move(Parser);
}
Expected<std::unique_ptr<Remark>> BitstreamRemarkParser::next() {
if (!ReadyToParseRemarks) {
if (Error E = parseMeta())
- return E;
+ return std::move(E);
ReadyToParseRemarks = true;
}
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);
}
R.Hotness = *Helper.Hotness;
if (!Helper.Args)
- return Result;
+ return std::move(Result);
for (const BitstreamRemarkParserHelper::Argument &Arg : *Helper.Args) {
if (!Arg.KeyIdx)
}
}
- return Result;
+ return std::move(Result);
}
: std::make_unique<YAMLRemarkParser>(Buf);
if (SeparateBuf)
Result->SeparateBuf = std::move(SeparateBuf);
- return Result;
+ return std::move(Result);
}
YAMLRemarkParser::YAMLRemarkParser(StringRef Buf)
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) {
return error("Type, Pass, Name or Function missing.",
*RemarkEntry.getRoot());
- return Result;
+ return std::move(Result);
}
Expected<Type> YAMLRemarkParser::parseType(yaml::MappingNode &Node) {
/* 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
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);
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.
DefinedNumericVariable = *ParseResult;
}
- return ExpressionPointer;
+ return std::move(ExpressionPointer);
}
bool Pattern::parsePattern(StringRef PatternStr, StringRef Prefix,
if (P.checkUTF8())
if (P.parseValue(E))
if (P.assertEnd())
- return E;
+ return std::move(E);
return P.takeError();
}
char ParseError::ID = 0;
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>
Offset, EC));
if (EC)
return EC;
- return Result;
+ return std::move(Result);
}
ErrorOr<std::unique_ptr<WriteThroughMemoryBuffer>>
new (NamedBufferAlloc(Filename)) MemoryBufferMMapFile<MB>(
RequiresNullTerminator, FD, MapSize, Offset, EC));
if (!EC)
- return Result;
+ return std::move(Result);
}
auto Buf = WritableMemoryBuffer::getNewUninitMemBuffer(MapSize, Filename);
Offset += *ReadBytes;
}
- return Buf;
+ return std::move(Buf);
}
ErrorOr<std::unique_ptr<MemoryBuffer>>
return errorCodeToError(EC);
}
#endif
- return Ret;
+ return std::move(Ret);
}
}
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) {
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 {
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)) {
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
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";
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
assert(!I.isConcrete());
obj["kind"] = "complex";
- return obj;
+ return std::move(obj);
}
void JSONEmitter::run(raw_ostream &OS) {
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) {
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) {
// 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
<< 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(
<< SrcModule->getSourceFileName() << "\n");
if (Import) {
if (Error Err = GV.materialize())
- return Err;
+ return std::move(Err);
ImportedGVCount += GlobalsToImport.insert(&GV);
}
}
<< 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 "
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);
}
}
}
assert(isa<BufferExtents>(R.get()));
auto BE = cast<BufferExtents>(R.get());
CurrentBufferBytes = BE->size();
- return R;
+ return std::move(R);
}
//
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
CurrentBufferBytes -= OffsetPtr - PreReadOffset;
}
assert(R != nullptr);
- return R;
+ return std::move(R);
}
} // namespace xray
// 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
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;
}
CurrentOffset = Offset;
Path.push_back(FuncId);
} while (FuncId != 0);
- return Path;
+ return std::move(Path);
}
static Expected<Profile::Data> readData(DataExtractor &Extractor,
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) {
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;
std::vector<std::pair<Profile::PathID, Profile::Data>>(
PathsData.begin(), PathsData.end()),
}))
- return E;
+ return std::move(E);
}
return P;
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: ") +
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),
break;
default:
if (auto E = loadYAMLLog(DE.getData(), T.FileHeader, T.Records))
- return E;
+ return std::move(E);
}
if (Sort)
return L.TSC < R.TSC;
});
- return T;
+ return std::move(T);
}
OutputFile, AdditionalLinkerArgs,
SharedObjs, Timeout, MemoryLimit);
if (Error E = RetVal.takeError())
- return E;
+ return std::move(E);
if (*RetVal == -1) {
errs() << "<timeout>";
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);
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;
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
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
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);
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()) {
// 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);
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;
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;
}
// 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
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;
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);
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;
}
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 {
ReduceMiscompiledBlocks(BD, TestFn, MiscompiledFunctions)
.reduceList(Blocks);
if (Error E = Ret.takeError())
- return E;
+ return std::move(E);
if (Blocks.size() == OldSize)
return false;
}
.reduceList(MiscompiledFunctions);
if (Error E = Ret.takeError()) {
errs() << "\n***Cannot reduce functions: ";
- return E;
+ return std::move(E);
}
}
outs() << "\n*** The following function"
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.
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")
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.
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")
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";
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.
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);
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";
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());
}
}
if (Err)
- return Err;
+ return std::move(Err);
}
if (OE.Objects.empty())
auto Err = OE.load(Filename, Verbose);
if (Err) {
ObjectCache.erase(Filename);
- return Err;
+ return std::move(Err);
}
}
return EC;
std::vector<std::unique_ptr<DebugMap>> Result;
Result.push_back(std::move(Res));
- return Result;
+ return std::move(Result);
}
} // end namespace dsymutil
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.
}
if (Error E = verifyOptions(Options))
- return E;
+ return std::move(E);
return 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");
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) {
// 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)
auto OS = CoveragePrinter::OwnedStream(RawStream);
if (E)
return errorCodeToError(E);
- return OS;
+ return std::move(OS);
}
std::unique_ptr<CoveragePrinter>
emitPrelude(*OS.get(), Opts, getPathToStyle(ViewPath));
}
- return OS;
+ return std::move(OS);
}
void CoveragePrinterHTML::closeViewFile(OwnedStream OS) {
DWOPaths.push_back(std::move(DWOName));
}
}
- return DWOPaths;
+ return std::move(DWOPaths);
}
static Error write(MCStreamer &Out, ArrayRef<std::string> Inputs) {
// 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 =
"when reading dynamic symbols");
}
- return DestStub;
+ return std::move(DestStub);
}
Expected<std::unique_ptr<ELFStub>> readELFFile(MemoryBufferRef Buf) {
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;
}
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);
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.
default:
break;
}
- return Result;
+ return std::move(Result);
}
} // namespace exegesis
if (Results.empty())
return make_error<Failure>(
"No strategy found to make the execution serial");
- return Results;
+ return std::move(Results);
}
} // namespace exegesis
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)
setRandomAliasing(SelfAliasing, IT, IT);
}
CT.Instructions.push_back(std::move(IT));
- return Result;
+ return std::move(Result);
}
Expected<std::vector<CodeTemplate>>
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() {
Result.push_back(
BenchmarkMeasure::Create("NumMicroOps", *ExpectedCounterValue));
}
- return Result;
+ return std::move(Result);
}
} // namespace exegesis
.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 {
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,
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>>
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
}
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
// 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);
}
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 =
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('='))
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());
"--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.
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
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 &&
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;
return createStringError(errc::invalid_argument,
"--preserve-dates requires a file");
- return DC;
+ return std::move(DC);
}
} // namespace objcopy
"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));
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;
}
if (!HasSections)
return parseError(-1U, "no sections");
- return Records;
+ return std::move(Records);
}
std::unique_ptr<Object> IHexReader::create(bool /*EnsureSymtab*/) const {
Obj->Sections.push_back(
{static_cast<uint8_t>(WS.Type), WS.Name, WS.Content});
}
- return Obj;
+ return std::move(Obj);
}
} // end namespace wasm
return make_error<RawError>(raw_error_code::corrupt_file,
"Invalid module stream");
- return ModS;
+ return std::move(ModS);
}
template <typename CallbackT>
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,
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)
IF.UnknownFile = std::move(*Result);
IF.PdbOrObj = IF.UnknownFile.get();
- return IF;
+ return std::move(IF);
}
PDBFile &InputFile::pdb() {
// 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.
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;
};
return FailureHandler(IntResult.takeError());
}
- return Result;
+ return std::move(Result);
}
Expected<uint32_t> RCParser::parseFlags(ArrayRef<StringRef> FlagDesc,
Result.addStmt(std::move(*SingleParse));
}
- return Result;
+ return std::move(Result);
}
Expected<std::unique_ptr<OptionalStmt>>
Accels->addAccelerator(*EventResult, *IDResult, *FlagsResult);
}
- return Accels;
+ return std::move(Accels);
}
RCParser::ParseType RCParser::parseCursorResource() {
Dialog->addControl(std::move(*ControlDefResult));
}
- return Dialog;
+ return std::move(Dialog);
}
RCParser::ParseType RCParser::parseUserDefinedResource(IntOrString Type) {
std::make_unique<MenuItem>(*CaptionResult, MenuResult, *FlagsResult));
}
- return List;
+ return std::move(List);
}
RCParser::ParseType RCParser::parseStringTableResource() {
Table->addString(*IDResult, *StrResult);
}
- return Table;
+ return std::move(Table);
}
Expected<std::unique_ptr<VersionInfoBlock>>
consume(); // Consume BlockEnd.
- return Contents;
+ return std::move(Contents);
}
Expected<std::unique_ptr<VersionInfoStmt>> RCParser::parseVersionInfoStmt() {
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)
// 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");
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) {
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)
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)
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)
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)
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)
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)
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)
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 {
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);
}
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();
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) {
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)
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();
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)
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)
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)
auto S = std::make_unique<ELFYAML::VerdefSection>();
if (Error E = dumpCommonSection(Shdr, *S))
- return E;
+ return std::move(E);
S->Info = Shdr->sh_info;
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)
auto S = std::make_unique<ELFYAML::VerneedSection>();
if (Error E = dumpCommonSection(Shdr, *S))
- return E;
+ return std::move(E);
S->Info = Shdr->sh_info;
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);
"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)
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) {
if (auto Sym = KV.second(Name, ExportedSymbolsOnly))
return Sym;
else if (auto Err = Sym.takeError())
- return Err;
+ return std::move(Err);
}
return JITSymbol(nullptr);
}
if (auto Error =
importChildMatcher(Rule, InsnMatcher, SrcChild, OperandIsAPointer,
OperandIsImmArg, OpIdx++, TempOpIdx))
- return Error;
+ return std::move(Error);
}
}
auto InsertPtOrError = createAndImportSubInstructionRenderer(
++InsertPt, Rule, DstChild, TempRegID);
if (auto Error = InsertPtOrError.takeError())
- return Error;
+ return std::move(Error);
return InsertPtOrError.get();
}
const TreePatternNode *Dst) {
auto InsertPtOrError = createInstructionRenderer(M.actions_end(), M, Dst);
if (auto Error = InsertPtOrError.takeError())
- return Error;
+ return std::move(Error);
action_iterator InsertPt = InsertPtOrError.get();
BuildMIAction &DstMIBuilder = *static_cast<BuildMIAction *>(InsertPt->get());
if (auto Error = importExplicitUseRenderers(InsertPt, M, DstMIBuilder, Dst)
.takeError())
- return Error;
+ return std::move(Error);
return DstMIBuilder;
}
// TODO: Assert there's exactly one result.
if (auto Error = InsertPtOrError.takeError())
- return Error;
+ return std::move(Error);
BuildMIAction &DstMIBuilder =
*static_cast<BuildMIAction *>(InsertPtOrError.get()->get());
InsertPtOrError =
importExplicitUseRenderers(InsertPtOrError.get(), M, DstMIBuilder, Dst);
if (auto Error = InsertPtOrError.takeError())
- return Error;
+ return std::move(Error);
// We need to make sure that when we import an INSERT_SUBREG as a
// subinstruction that it ends up being constrained to the correct super
auto InsertPtOrError = createAndImportSubInstructionRenderer(
++InsertPt, M, ValChild, TempRegID);
if (auto Error = InsertPtOrError.takeError())
- return Error;
+ return std::move(Error);
DstMIBuilder.addRenderer<TempRegRenderer>(TempRegID, false, SubIdx);
return InsertPt;
auto InsertPtOrError =
importExplicitUseRenderer(InsertPt, M, DstMIBuilder, ValChild);
if (auto Error = InsertPtOrError.takeError())
- return Error;
+ return std::move(Error);
InsertPt = InsertPtOrError.get();
DstMIBuilder.addRenderer<SubRegIndexRenderer>(SubIdx);
}
DagInit *DefaultOps = DstIOperand.Rec->getValueAsDag("DefaultOps");
if (auto Error = importDefaultOperandRenderers(
InsertPt, M, DstMIBuilder, DefaultOps))
- return Error;
+ return std::move(Error);
++NumDefaultOps;
continue;
}
auto InsertPtOrError = importExplicitUseRenderer(InsertPt, M, DstMIBuilder,
Dst->getChild(Child));
if (auto Error = InsertPtOrError.takeError())
- return Error;
+ return std::move(Error);
InsertPt = InsertPtOrError.get();
++Child;
}
llvm::to_string(*P.getDstPattern()));
if (auto Error = importRulePredicates(M, P.getPredicates()))
- return Error;
+ return std::move(Error);
// Next, analyze the pattern operators.
TreePatternNode *Src = P.getSrcPattern();
auto InsnMatcherOrError =
createAndImportSelDAGMatcher(M, InsnMatcherTemp, Src, TempOpIdx);
if (auto Error = InsnMatcherOrError.takeError())
- return Error;
+ return std::move(Error);
InstructionMatcher &InsnMatcher = InsnMatcherOrError.get();
if (Dst->isLeaf()) {
// We're done with this pattern! It's eligible for GISel emission; return
// it.
++NumPatternImported;
- return M;
+ return std::move(M);
}
return failedImport("Dst pattern root isn't a known leaf");
auto DstMIBuilderOrError =
createAndImportInstructionRenderer(M, InsnMatcher, Src, Dst);
if (auto Error = DstMIBuilderOrError.takeError())
- return Error;
+ return std::move(Error);
BuildMIAction &DstMIBuilder = DstMIBuilderOrError.get();
// Render the implicit defs.
// These are only added to the root of the result.
if (auto Error = importImplicitDefRenderers(DstMIBuilder, P.getDstRegs()))
- return Error;
+ return std::move(Error);
DstMIBuilder.chooseInsnToMutate(M);
// We're done with this pattern! It's eligible for GISel emission; return
// it.
++NumPatternImported;
- return M;
+ return std::move(M);
}
if (DstIName == "EXTRACT_SUBREG") {
// We're done with this pattern! It's eligible for GISel emission; return
// it.
++NumPatternImported;
- return M;
+ return std::move(M);
}
if (DstIName == "INSERT_SUBREG") {
M.addAction<ConstrainOperandToRegClassAction>(0, 1, **SuperClass);
M.addAction<ConstrainOperandToRegClassAction>(0, 2, **SubClass);
++NumPatternImported;
- return M;
+ return std::move(M);
}
if (DstIName == "SUBREG_TO_REG") {
M.addAction<ConstrainOperandToRegClassAction>(0, 0, **SuperClass);
M.addAction<ConstrainOperandToRegClassAction>(0, 2, **SubClass);
++NumPatternImported;
- return M;
+ return std::move(M);
}
M.addAction<ConstrainOperandsToDefinitionAction>(0);
// We're done with this pattern! It's eligible for GISel emission; return it.
++NumPatternImported;
- return M;
+ return std::move(M);
}
// Emit imm predicate table and an enum to reference them with.