Skip to content

Commit c55cf4a

Browse files
committed
Revert "Remove redundant "std::move"s in return statements"
The build failed with error: call to deleted constructor of 'llvm::Error' errors. This reverts commit 1c2241a.
1 parent 5ad62d3 commit c55cf4a

File tree

137 files changed

+506
-506
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+506
-506
lines changed

llvm/include/llvm/Bitstream/BitstreamReader.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ class SimpleBitstreamCursor {
209209
unsigned BitsLeft = NumBits - BitsInCurWord;
210210

211211
if (Error fillResult = fillCurWord())
212-
return fillResult;
212+
return std::move(fillResult);
213213

214214
// If we run out of data, abort.
215215
if (BitsLeft > BitsInCurWord)
@@ -425,7 +425,7 @@ class BitstreamCursor : SimpleBitstreamCursor {
425425
// We read and accumulate abbrev's, the client can't do anything with
426426
// them anyway.
427427
if (Error Err = ReadAbbrevRecord())
428-
return Err;
428+
return std::move(Err);
429429
continue;
430430
}
431431

@@ -448,7 +448,7 @@ class BitstreamCursor : SimpleBitstreamCursor {
448448

449449
// If we found a sub-block, just skip over it and check the next entry.
450450
if (Error Err = SkipBlock())
451-
return Err;
451+
return std::move(Err);
452452
}
453453
}
454454

llvm/include/llvm/DebugInfo/CodeView/CVRecord.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,14 @@ inline Expected<CVRecord<Kind>> readCVRecordFromStream(BinaryStreamRef Stream,
100100
Reader.setOffset(Offset);
101101

102102
if (auto EC = Reader.readObject(Prefix))
103-
return EC;
103+
return std::move(EC);
104104
if (Prefix->RecordLen < 2)
105105
return make_error<CodeViewError>(cv_error_code::corrupt_record);
106106

107107
Reader.setOffset(Offset);
108108
ArrayRef<uint8_t> RawData;
109109
if (auto EC = Reader.readBytes(RawData, Prefix->RecordLen + sizeof(uint16_t)))
110-
return EC;
110+
return std::move(EC);
111111
return codeview::CVRecord<Kind>(RawData);
112112
}
113113

llvm/include/llvm/DebugInfo/CodeView/SymbolDeserializer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class SymbolDeserializer : public SymbolVisitorCallbacks {
4848
template <typename T> static Expected<T> deserializeAs(CVSymbol Symbol) {
4949
T Record(static_cast<SymbolRecordKind>(Symbol.kind()));
5050
if (auto EC = deserializeAs<T>(Symbol, Record))
51-
return EC;
51+
return std::move(EC);
5252
return Record;
5353
}
5454

llvm/include/llvm/DebugInfo/CodeView/TypeDeserializer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class TypeDeserializer : public TypeVisitorCallbacks {
6060
T Record(K);
6161
CVType CVT(Data);
6262
if (auto EC = deserializeAs<T>(CVT, Record))
63-
return EC;
63+
return std::move(EC);
6464
return Record;
6565
}
6666

llvm/include/llvm/DebugInfo/DWARF/DWARFListTable.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ DWARFListTableBase<DWARFListType>::findList(DWARFDataExtractor Data,
280280
if (Error E =
281281
List.extract(Data, getHeaderOffset(), End, &Offset,
282282
Header.getSectionName(), Header.getListTypeString()))
283-
return E;
283+
return std::move(E);
284284
ListMap[StartingOffset] = List;
285285
return List;
286286
}

llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ class LegacyCompileOnDemandLayer {
233233
if (auto Sym = BaseLayer.findSymbolIn(BLK, Name, ExportedSymbolsOnly))
234234
return Sym;
235235
else if (auto Err = Sym.takeError())
236-
return Err;
236+
return std::move(Err);
237237
return nullptr;
238238
}
239239

@@ -342,7 +342,7 @@ class LegacyCompileOnDemandLayer {
342342
findSymbolIn(KV.first, std::string(Name), ExportedSymbolsOnly))
343343
return Sym;
344344
else if (auto Err = Sym.takeError())
345-
return Err;
345+
return std::move(Err);
346346
}
347347
return BaseLayer.findSymbol(std::string(Name), ExportedSymbolsOnly);
348348
}
@@ -518,7 +518,7 @@ class LegacyCompileOnDemandLayer {
518518
if (auto Sym = LD.findSymbol(BaseLayer, std::string(Name), false))
519519
return Sym;
520520
else if (auto Err = Sym.takeError())
521-
return Err;
521+
return std::move(Err);
522522

523523
return nullptr;
524524
};
@@ -611,7 +611,7 @@ class LegacyCompileOnDemandLayer {
611611
} else
612612
return FnBodyAddrOrErr.takeError();
613613
} else if (auto Err = FnBodySym.takeError())
614-
return Err;
614+
return std::move(Err);
615615
else
616616
llvm_unreachable("Function not emitted for partition");
617617
}
@@ -729,7 +729,7 @@ class LegacyCompileOnDemandLayer {
729729
SetSymbolResolver(K, std::move(Resolver));
730730

731731
if (auto Err = BaseLayer.addModule(std::move(K), std::move(M)))
732-
return Err;
732+
return std::move(Err);
733733

734734
return K;
735735
}

llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ template <typename ORCABI> class LocalTrampolinePool : public TrampolinePool {
8080
new LocalTrampolinePool(std::move(GetTrampolineLanding), Err));
8181

8282
if (Err)
83-
return Err;
84-
return LTP;
83+
return std::move(Err);
84+
return std::move(LTP);
8585
}
8686

8787
/// Get a free trampoline. Returns an error if one can not be provided (e.g.
@@ -90,7 +90,7 @@ template <typename ORCABI> class LocalTrampolinePool : public TrampolinePool {
9090
std::lock_guard<std::mutex> Lock(LTPMutex);
9191
if (AvailableTrampolines.empty()) {
9292
if (auto Err = grow())
93-
return Err;
93+
return std::move(Err);
9494
}
9595
assert(!AvailableTrampolines.empty() && "Failed to grow trampoline pool");
9696
auto TrampolineAddr = AvailableTrampolines.back();
@@ -229,8 +229,8 @@ class LocalJITCompileCallbackManager : public JITCompileCallbackManager {
229229
auto CCMgr = std::unique_ptr<LocalJITCompileCallbackManager>(
230230
new LocalJITCompileCallbackManager(ES, ErrorHandlerAddress, Err));
231231
if (Err)
232-
return Err;
233-
return CCMgr;
232+
return std::move(Err);
233+
return std::move(CCMgr);
234234
}
235235

236236
private:

llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -262,13 +262,13 @@ class LLJITBuilderSetters {
262262
/// Create an instance of the JIT.
263263
Expected<std::unique_ptr<JITType>> create() {
264264
if (auto Err = impl().prepareForConstruction())
265-
return Err;
265+
return std::move(Err);
266266

267267
Error Err = Error::success();
268268
std::unique_ptr<JITType> J(new JITType(impl(), Err));
269269
if (Err)
270-
return Err;
271-
return J;
270+
return std::move(Err);
271+
return std::move(J);
272272
}
273273

274274
protected:

llvm/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ template <typename BaseLayerT> class LazyEmittingLayer {
5757
else if (this->EmitState == NotEmitted) {
5858
this->EmitState = Emitting;
5959
if (auto Err = this->emitToBaseLayer(B))
60-
return Err;
60+
return std::move(Err);
6161
this->EmitState = Emitted;
6262
}
6363
if (auto Sym = B.findSymbolIn(K, Name, ExportedSymbolsOnly))
6464
return Sym.getAddress();
6565
else if (auto Err = Sym.takeError())
66-
return Err;
66+
return std::move(Err);
6767
else
6868
llvm_unreachable("Successful symbol lookup should return "
6969
"definition address here");

llvm/include/llvm/ExecutionEngine/Orc/LazyReexports.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ class LocalLazyCallThroughManager : public LazyCallThroughManager {
101101
new LocalLazyCallThroughManager(ES, ErrorHandlerAddr));
102102

103103
if (auto Err = LLCTM->init<ORCABI>())
104-
return Err;
104+
return std::move(Err);
105105

106-
return LLCTM;
106+
return std::move(LLCTM);
107107
}
108108
};
109109

llvm/include/llvm/ExecutionEngine/Orc/Legacy.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ getResponsibilitySetWithLegacyFn(const SymbolNameSet &Symbols,
123123
if (!Sym.getFlags().isStrong())
124124
Result.insert(S);
125125
} else if (auto Err = Sym.takeError())
126-
return Err;
126+
return std::move(Err);
127127
}
128128

129129
return Result;

llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ class OrcRemoteTargetClient
457457
std::lock_guard<std::mutex> Lock(RTPMutex);
458458
if (AvailableTrampolines.empty()) {
459459
if (auto Err = grow())
460-
return Err;
460+
return std::move(Err);
461461
}
462462
assert(!AvailableTrampolines.empty() && "Failed to grow trampoline pool");
463463
auto TrampolineAddr = AvailableTrampolines.back();
@@ -506,8 +506,8 @@ class OrcRemoteTargetClient
506506
auto Client = std::unique_ptr<OrcRemoteTargetClient>(
507507
new OrcRemoteTargetClient(Channel, ES, Err));
508508
if (Err)
509-
return Err;
510-
return Client;
509+
return std::move(Err);
510+
return std::move(Client);
511511
}
512512

513513
/// Call the int(void) function at the given address in the target and return
@@ -541,7 +541,7 @@ class OrcRemoteTargetClient
541541
createRemoteMemoryManager() {
542542
auto Id = AllocatorIds.getNext();
543543
if (auto Err = callB<mem::CreateRemoteAllocator>(Id))
544-
return Err;
544+
return std::move(Err);
545545
return std::unique_ptr<RemoteRTDyldMemoryManager>(
546546
new RemoteRTDyldMemoryManager(*this, Id));
547547
}
@@ -552,7 +552,7 @@ class OrcRemoteTargetClient
552552
createIndirectStubsManager() {
553553
auto Id = IndirectStubOwnerIds.getNext();
554554
if (auto Err = callB<stubs::CreateIndirectStubsOwner>(Id))
555-
return Err;
555+
return std::move(Err);
556556
return std::make_unique<RemoteIndirectStubsManager>(*this, Id);
557557
}
558558

@@ -562,7 +562,7 @@ class OrcRemoteTargetClient
562562

563563
// Emit the resolver block on the JIT server.
564564
if (auto Err = callB<stubs::EmitResolverBlock>())
565-
return Err;
565+
return std::move(Err);
566566

567567
// Create the callback manager.
568568
CallbackManager.emplace(*this, ES, ErrorHandlerAddress);

llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetServer.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ class OrcRemoteTargetServer
265265
typename TargetT::IndirectStubsInfo IS;
266266
if (auto Err =
267267
TargetT::emitIndirectStubsBlock(IS, NumStubsRequired, nullptr))
268-
return Err;
268+
return std::move(Err);
269269

270270
JITTargetAddress StubsBase = static_cast<JITTargetAddress>(
271271
reinterpret_cast<uintptr_t>(IS.getStub(0)));
@@ -382,7 +382,7 @@ class OrcRemoteTargetServer
382382
auto &Allocator = I->second;
383383
void *LocalAllocAddr = nullptr;
384384
if (auto Err = Allocator.allocate(LocalAllocAddr, Size, Align))
385-
return Err;
385+
return std::move(Err);
386386

387387
LLVM_DEBUG(dbgs() << " Allocator " << Id << " reserved " << LocalAllocAddr
388388
<< " (" << Size << " bytes, alignment " << Align

llvm/include/llvm/ExecutionEngine/Orc/RPC/RPCUtils.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -1528,20 +1528,20 @@ class SingleThreadedRPCEndpoint
15281528
Args...)) {
15291529
detail::ResultTraits<typename Func::ReturnType>::consumeAbandoned(
15301530
std::move(Result));
1531-
return Err;
1531+
return std::move(Err);
15321532
}
15331533

15341534
if (auto Err = this->C.send()) {
15351535
detail::ResultTraits<typename Func::ReturnType>::consumeAbandoned(
15361536
std::move(Result));
1537-
return Err;
1537+
return std::move(Err);
15381538
}
15391539

15401540
while (!ReceivedResponse) {
15411541
if (auto Err = this->handleOne()) {
15421542
detail::ResultTraits<typename Func::ReturnType>::consumeAbandoned(
15431543
std::move(Result));
1544-
return Err;
1544+
return std::move(Err);
15451545
}
15461546
}
15471547

llvm/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ class LegacyRTDyldObjectLinkingLayer : public LegacyRTDyldObjectLinkingLayerBase
276276
// and its execution, so we need to double check.
277277
if (!this->Finalized)
278278
if (auto Err = this->finalize())
279-
return Err;
279+
return std::move(Err);
280280
return this->getSymbol(Name, false).getAddress();
281281
};
282282
}
@@ -430,7 +430,7 @@ class LegacyRTDyldObjectLinkingLayer : public LegacyRTDyldObjectLinkingLayerBase
430430
if (auto Sym = KV.second->getSymbol(Name, ExportedSymbolsOnly))
431431
return Sym;
432432
else if (auto Err = Sym.takeError())
433-
return Err;
433+
return std::move(Err);
434434

435435
return nullptr;
436436
}

llvm/include/llvm/Object/ELF.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ ELFFile<ELFT>::getStringTable(const Elf_Shdr *Section,
601601
": expected SHT_STRTAB, but got " +
602602
object::getELFSectionTypeName(
603603
getHeader()->e_machine, Section->sh_type)))
604-
return E;
604+
return std::move(E);
605605

606606
auto V = getSectionContentsAsArray<char>(Section);
607607
if (!V)

llvm/include/llvm/Object/ELFObjectFile.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ Expected<ELFObjectFile<ELFT>>
948948
ELFObjectFile<ELFT>::create(MemoryBufferRef Object) {
949949
auto EFOrErr = ELFFile<ELFT>::create(Object.getBuffer());
950950
if (Error E = EFOrErr.takeError())
951-
return E;
951+
return std::move(E);
952952
auto EF = std::move(*EFOrErr);
953953

954954
auto SectionsOrErr = EF.sections();

llvm/include/llvm/ProfileData/Coverage/CoverageMappingReader.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@ class CoverageMappingIterator
7777
if (ReadErr != coveragemap_error::success) {
7878
auto E = make_error<CoverageMapError>(ReadErr);
7979
ReadErr = coveragemap_error::success;
80-
return E;
80+
return std::move(E);
8181
}
8282
return Record;
8383
}
8484
Expected<CoverageMappingRecord *> operator->() {
8585
if (ReadErr != coveragemap_error::success) {
8686
auto E = make_error<CoverageMapError>(ReadErr);
8787
ReadErr = coveragemap_error::success;
88-
return E;
88+
return std::move(E);
8989
}
9090
return &Record;
9191
}

llvm/include/llvm/Support/Error.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@ Expected<T> handleExpected(Expected<T> ValOrErr, RecoveryFtor &&RecoveryPath,
963963

964964
if (auto Err = handleErrors(ValOrErr.takeError(),
965965
std::forward<HandlerTs>(Handlers)...))
966-
return Err;
966+
return std::move(Err);
967967

968968
return RecoveryPath();
969969
}

llvm/include/llvm/Support/TaskQueue.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class TaskQueue {
9898
IsTaskInFlight = true;
9999
}
100100
}
101-
return F;
101+
return std::move(F);
102102
}
103103

104104
private:

0 commit comments

Comments
 (0)