[NFC] Use fold expressions to replace discarded initializer_lists (#83693)
This commit is contained in:
parent
60fbd60501
commit
f505a92fc2
@ -302,10 +302,7 @@ bool ByteCodeEmitter::emitOp(Opcode Op, const Tys &... Args, const SourceInfo &S
|
||||
if (SI)
|
||||
SrcMap.emplace_back(Code.size(), SI);
|
||||
|
||||
// The initializer list forces the expression to be evaluated
|
||||
// for each argument in the variadic template, in order.
|
||||
(void)std::initializer_list<int>{(emit(P, Code, Args, Success), 0)...};
|
||||
|
||||
(..., emit(P, Code, Args, Success));
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
@ -412,20 +412,15 @@ public:
|
||||
private:
|
||||
std::tuple<SLSBLRThunkInserter> TIs;
|
||||
|
||||
// FIXME: When LLVM moves to C++17, these can become folds
|
||||
template <typename... ThunkInserterT>
|
||||
static void initTIs(Module &M,
|
||||
std::tuple<ThunkInserterT...> &ThunkInserters) {
|
||||
(void)std::initializer_list<int>{
|
||||
(std::get<ThunkInserterT>(ThunkInserters).init(M), 0)...};
|
||||
(..., std::get<ThunkInserterT>(ThunkInserters).init(M));
|
||||
}
|
||||
template <typename... ThunkInserterT>
|
||||
static bool runTIs(MachineModuleInfo &MMI, MachineFunction &MF,
|
||||
std::tuple<ThunkInserterT...> &ThunkInserters) {
|
||||
bool Modified = false;
|
||||
(void)std::initializer_list<int>{
|
||||
Modified |= std::get<ThunkInserterT>(ThunkInserters).run(MMI, MF)...};
|
||||
return Modified;
|
||||
return (0 | ... | std::get<ThunkInserterT>(ThunkInserters).run(MMI, MF));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -404,20 +404,15 @@ public:
|
||||
private:
|
||||
std::tuple<SLSBLRThunkInserter> TIs;
|
||||
|
||||
// FIXME: When LLVM moves to C++17, these can become folds
|
||||
template <typename... ThunkInserterT>
|
||||
static void initTIs(Module &M,
|
||||
std::tuple<ThunkInserterT...> &ThunkInserters) {
|
||||
(void)std::initializer_list<int>{
|
||||
(std::get<ThunkInserterT>(ThunkInserters).init(M), 0)...};
|
||||
(..., std::get<ThunkInserterT>(ThunkInserters).init(M));
|
||||
}
|
||||
template <typename... ThunkInserterT>
|
||||
static bool runTIs(MachineModuleInfo &MMI, MachineFunction &MF,
|
||||
std::tuple<ThunkInserterT...> &ThunkInserters) {
|
||||
bool Modified = false;
|
||||
(void)std::initializer_list<int>{
|
||||
Modified |= std::get<ThunkInserterT>(ThunkInserters).run(MMI, MF)...};
|
||||
return Modified;
|
||||
return (0 | ... | std::get<ThunkInserterT>(ThunkInserters).run(MMI, MF));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -118,20 +118,15 @@ public:
|
||||
private:
|
||||
std::tuple<RetpolineThunkInserter, LVIThunkInserter> TIs;
|
||||
|
||||
// FIXME: When LLVM moves to C++17, these can become folds
|
||||
template <typename... ThunkInserterT>
|
||||
static void initTIs(Module &M,
|
||||
std::tuple<ThunkInserterT...> &ThunkInserters) {
|
||||
(void)std::initializer_list<int>{
|
||||
(std::get<ThunkInserterT>(ThunkInserters).init(M), 0)...};
|
||||
(..., std::get<ThunkInserterT>(ThunkInserters).init(M));
|
||||
}
|
||||
template <typename... ThunkInserterT>
|
||||
static bool runTIs(MachineModuleInfo &MMI, MachineFunction &MF,
|
||||
std::tuple<ThunkInserterT...> &ThunkInserters) {
|
||||
bool Modified = false;
|
||||
(void)std::initializer_list<int>{
|
||||
Modified |= std::get<ThunkInserterT>(ThunkInserters).run(MMI, MF)...};
|
||||
return Modified;
|
||||
return (0 | ... | std::get<ThunkInserterT>(ThunkInserters).run(MMI, MF));
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user