diff --git a/clang/lib/AST/Interp/ByteCodeEmitter.cpp b/clang/lib/AST/Interp/ByteCodeEmitter.cpp index e1b954fcc68486..4fbfc0930fbaa1 100644 --- a/clang/lib/AST/Interp/ByteCodeEmitter.cpp +++ b/clang/lib/AST/Interp/ByteCodeEmitter.cpp @@ -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{(emit(P, Code, Args, Success), 0)...}; - + (..., emit(P, Code, Args, Success)); return Success; } diff --git a/llvm/lib/Target/AArch64/AArch64SLSHardening.cpp b/llvm/lib/Target/AArch64/AArch64SLSHardening.cpp index 76dd5a2d713ebb..ce3bc0b1837558 100644 --- a/llvm/lib/Target/AArch64/AArch64SLSHardening.cpp +++ b/llvm/lib/Target/AArch64/AArch64SLSHardening.cpp @@ -412,20 +412,15 @@ class AArch64IndirectThunks : public MachineFunctionPass { private: std::tuple TIs; - // FIXME: When LLVM moves to C++17, these can become folds template static void initTIs(Module &M, std::tuple &ThunkInserters) { - (void)std::initializer_list{ - (std::get(ThunkInserters).init(M), 0)...}; + (..., std::get(ThunkInserters).init(M)); } template static bool runTIs(MachineModuleInfo &MMI, MachineFunction &MF, std::tuple &ThunkInserters) { - bool Modified = false; - (void)std::initializer_list{ - Modified |= std::get(ThunkInserters).run(MMI, MF)...}; - return Modified; + return (0 | ... | std::get(ThunkInserters).run(MMI, MF)); } }; diff --git a/llvm/lib/Target/ARM/ARMSLSHardening.cpp b/llvm/lib/Target/ARM/ARMSLSHardening.cpp index 23d72b34902d0e..d9ff14ead60e27 100644 --- a/llvm/lib/Target/ARM/ARMSLSHardening.cpp +++ b/llvm/lib/Target/ARM/ARMSLSHardening.cpp @@ -404,20 +404,15 @@ class ARMIndirectThunks : public MachineFunctionPass { private: std::tuple TIs; - // FIXME: When LLVM moves to C++17, these can become folds template static void initTIs(Module &M, std::tuple &ThunkInserters) { - (void)std::initializer_list{ - (std::get(ThunkInserters).init(M), 0)...}; + (..., std::get(ThunkInserters).init(M)); } template static bool runTIs(MachineModuleInfo &MMI, MachineFunction &MF, std::tuple &ThunkInserters) { - bool Modified = false; - (void)std::initializer_list{ - Modified |= std::get(ThunkInserters).run(MMI, MF)...}; - return Modified; + return (0 | ... | std::get(ThunkInserters).run(MMI, MF)); } }; diff --git a/llvm/lib/Target/X86/X86IndirectThunks.cpp b/llvm/lib/Target/X86/X86IndirectThunks.cpp index 9db667900bffb3..ecc52600f75933 100644 --- a/llvm/lib/Target/X86/X86IndirectThunks.cpp +++ b/llvm/lib/Target/X86/X86IndirectThunks.cpp @@ -118,20 +118,15 @@ class X86IndirectThunks : public MachineFunctionPass { private: std::tuple TIs; - // FIXME: When LLVM moves to C++17, these can become folds template static void initTIs(Module &M, std::tuple &ThunkInserters) { - (void)std::initializer_list{ - (std::get(ThunkInserters).init(M), 0)...}; + (..., std::get(ThunkInserters).init(M)); } template static bool runTIs(MachineModuleInfo &MMI, MachineFunction &MF, std::tuple &ThunkInserters) { - bool Modified = false; - (void)std::initializer_list{ - Modified |= std::get(ThunkInserters).run(MMI, MF)...}; - return Modified; + return (0 | ... | std::get(ThunkInserters).run(MMI, MF)); } };