diff --git a/include/llvm/ADT/VariadicFunction.h b/include/llvm/ADT/VariadicFunction.h index 00ae347dc73..a9a0dc6b6e2 100644 --- a/include/llvm/ADT/VariadicFunction.h +++ b/include/llvm/ADT/VariadicFunction.h @@ -103,10 +103,7 @@ namespace llvm { /// fixed leading arguments and up-to 32 optional arguments. template )> -class VariadicFunction { - public: - VariadicFunction() {} - +struct VariadicFunction { ResultT operator()() const { return Func(ArrayRef()); } @@ -153,10 +150,7 @@ class VariadicFunction { template )> -class VariadicFunction1 { - public: - VariadicFunction1() {} - +struct VariadicFunction1 { ResultT operator()(Param0T P0) const { return Func(P0, ArrayRef()); } @@ -203,10 +197,7 @@ class VariadicFunction1 { template )> -class VariadicFunction2 { - public: - VariadicFunction2() {} - +struct VariadicFunction2 { ResultT operator()(Param0T P0, Param1T P1) const { return Func(P0, P1, ArrayRef()); } @@ -255,10 +246,7 @@ class VariadicFunction2 { template )> -class VariadicFunction3 { - public: - VariadicFunction3() {} - +struct VariadicFunction3 { ResultT operator()(Param0T P0, Param1T P1, Param2T P2) const { return Func(P0, P1, P2, ArrayRef()); } diff --git a/unittests/ADT/VariadicFunctionTest.cpp b/unittests/ADT/VariadicFunctionTest.cpp index 3cd63d277bd..cde31205966 100644 --- a/unittests/ADT/VariadicFunctionTest.cpp +++ b/unittests/ADT/VariadicFunctionTest.cpp @@ -22,7 +22,7 @@ std::string StringCatImpl(ArrayRef Args) { S += *Args[i]; return S; } -const VariadicFunction StringCat; +const VariadicFunction StringCat = {}; TEST(VariadicFunctionTest, WorksForClassTypes) { EXPECT_EQ("", StringCat()); @@ -45,7 +45,7 @@ long SumImpl(ArrayRef Args) { Result += *Args[i]; return Result; } -const VariadicFunction Sum; +const VariadicFunction Sum = {}; TEST(VariadicFunctionTest, WorksForPrimitiveTypes) { EXPECT_EQ(0, Sum()); @@ -65,7 +65,7 @@ int StringAppendImpl(std::string *Dest, ArrayRef Args) { return Chars; } const VariadicFunction1 StringAppend; + StringAppendImpl> StringAppend = {}; TEST(VariadicFunction1Test, Works) { std::string S0("hi"); @@ -93,7 +93,7 @@ void CountInRangeImpl(int *NumInRange, int Low, int High, ++(*NumInRange); } const VariadicFunction3 CountInRange; + CountInRangeImpl> CountInRange = {}; TEST(VariadicFunction3Test, Works) { int N = -1;