//===- FormatVariadicBM.cpp - formatv() benchmark ---------- --------------===// // // 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 "benchmark/benchmark.h" #include "llvm/Support/FormatVariadic.h" #include <algorithm> #include <string> #include <vector> usingnamespacellvm; usingnamespacestd; // Generate a list of format strings that have `NumReplacements` replacements // by permuting the replacements and some literal text. static vector<string> getFormatStrings(int NumReplacements) { … } // Generate the set of formats to exercise outside the benchmark code. static const vector<vector<string>> Formats = …; // Benchmark formatv() for a variety of format strings and 1-5 replacements. static void BM_FormatVariadic(benchmark::State &state) { … } BENCHMARK(…); BENCHMARK_MAIN(…);