[llvm] r332388 - Use perfect forwarding to deduplicate code in unit test. NFC.
Benjamin Kramer via llvm-commits
llvm-commits at lists.llvm.org
Tue May 15 13:08:15 PDT 2018
Author: d0k
Date: Tue May 15 13:08:15 2018
New Revision: 332388
URL: http://llvm.org/viewvc/llvm-project?rev=332388&view=rev
Log:
Use perfect forwarding to deduplicate code in unit test. NFC.
Modified:
llvm/trunk/unittests/Support/CommandLineTest.cpp
Modified: llvm/trunk/unittests/Support/CommandLineTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/CommandLineTest.cpp?rev=332388&r1=332387&r2=332388&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/CommandLineTest.cpp (original)
+++ llvm/trunk/unittests/Support/CommandLineTest.cpp Tue May 15 13:08:15 2018
@@ -54,28 +54,8 @@ class TempEnvVar {
template <typename T, typename Base = cl::opt<T>>
class StackOption : public Base {
public:
- // One option...
- template<class M0t>
- explicit StackOption(const M0t &M0) : Base(M0) {}
-
- // Two options...
- template<class M0t, class M1t>
- StackOption(const M0t &M0, const M1t &M1) : Base(M0, M1) {}
-
- // Three options...
- template<class M0t, class M1t, class M2t>
- StackOption(const M0t &M0, const M1t &M1, const M2t &M2) : Base(M0, M1, M2) {}
-
- // Four options...
- template<class M0t, class M1t, class M2t, class M3t>
- StackOption(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3)
- : Base(M0, M1, M2, M3) {}
-
- // Five options...
- template <class M0t, class M1t, class M2t, class M3t, class M4t>
- StackOption(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3,
- const M4t &M4)
- : Base(M0, M1, M2, M3, M4) {}
+ template <class... Ts>
+ explicit StackOption(Ts &&... Ms) : Base(std::forward<Ts>(Ms)...) {}
~StackOption() override { this->removeArgument(); }
More information about the llvm-commits
mailing list