//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include #include #include #include #include "benchmark/benchmark.h" #include "test_macros.h" namespace internal { template struct EnumValue : std::integral_constant(I)> { static std::string name() { return std::string("_") + D::Names[I]; } }; template constexpr auto makeEnumValueTuple(std::index_sequence) { return std::make_tuple(EnumValue{}...); } template static auto skip(const B& Bench, int) -> decltype(Bench.skip()) { return Bench.skip(); } template static auto skip(const B& Bench, char) { return false; } template void makeBenchmarkFromValuesImpl(const Args& A, std::index_sequence) { for (auto& V : A) { B Bench{std::get(V)...}; if (!internal::skip(Bench, 0)) { benchmark::RegisterBenchmark(Bench.name().c_str(), [=](benchmark::State& S) { Bench.run(S); }); } } } template void makeBenchmarkFromValues(const std::vector >& A) { makeBenchmarkFromValuesImpl(A, std::index_sequence_for()); } template