mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-16 20:36:35 +00:00

Pulled the latest (b000672), which adds an option to disable -Werror, which caused issues previously (see for instance https://reviews.llvm.org/D112012) Applied https://github.com/google/benchmark/pull/1305 to unblock, as this issue is causing downstream buildbot failures. The only change is in llvm/CMakeLists.txt, where we set BENCHMARK_ENABLE_WERROR to have the same value as LLVM_ENABLE_WERROR. This patch also introduces a convenience script to pull benchmark from upstream. Differential Revision: https://reviews.llvm.org/D115684
29 lines
482 B
C++
29 lines
482 B
C++
|
|
#include <cassert>
|
|
#include <memory>
|
|
|
|
#include "benchmark/benchmark.h"
|
|
|
|
template <typename T>
|
|
class MyFixture : public ::benchmark::Fixture {
|
|
public:
|
|
MyFixture() : data(0) {}
|
|
|
|
T data;
|
|
};
|
|
|
|
BENCHMARK_TEMPLATE_F(MyFixture, Foo, int)(benchmark::State& st) {
|
|
for (auto _ : st) {
|
|
data += 1;
|
|
}
|
|
}
|
|
|
|
BENCHMARK_TEMPLATE_DEFINE_F(MyFixture, Bar, double)(benchmark::State& st) {
|
|
for (auto _ : st) {
|
|
data += 1.0;
|
|
}
|
|
}
|
|
BENCHMARK_REGISTER_F(MyFixture, Bar);
|
|
|
|
BENCHMARK_MAIN();
|