mirror of https://github.com/google/benchmark.git
Suppress intentional potential memory leak as detected by clang static analysis (#1618)
https://github.com/google/benchmark/issues/1513 Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
This commit is contained in:
parent
fed73374d7
commit
edb0d3d46d
|
@ -1362,6 +1362,8 @@ class LambdaBenchmark : public Benchmark {
|
||||||
|
|
||||||
inline internal::Benchmark* RegisterBenchmark(const std::string& name,
|
inline internal::Benchmark* RegisterBenchmark(const std::string& name,
|
||||||
internal::Function* fn) {
|
internal::Function* fn) {
|
||||||
|
// FIXME: this should be a `std::make_unique<>()` but we don't have C++14.
|
||||||
|
// codechecker_intentional [cplusplus.NewDeleteLeaks]
|
||||||
return internal::RegisterBenchmarkInternal(
|
return internal::RegisterBenchmarkInternal(
|
||||||
::new internal::FunctionBenchmark(name, fn));
|
::new internal::FunctionBenchmark(name, fn));
|
||||||
}
|
}
|
||||||
|
@ -1371,6 +1373,8 @@ template <class Lambda>
|
||||||
internal::Benchmark* RegisterBenchmark(const std::string& name, Lambda&& fn) {
|
internal::Benchmark* RegisterBenchmark(const std::string& name, Lambda&& fn) {
|
||||||
using BenchType =
|
using BenchType =
|
||||||
internal::LambdaBenchmark<typename std::decay<Lambda>::type>;
|
internal::LambdaBenchmark<typename std::decay<Lambda>::type>;
|
||||||
|
// FIXME: this should be a `std::make_unique<>()` but we don't have C++14.
|
||||||
|
// codechecker_intentional [cplusplus.NewDeleteLeaks]
|
||||||
return internal::RegisterBenchmarkInternal(
|
return internal::RegisterBenchmarkInternal(
|
||||||
::new BenchType(name, std::forward<Lambda>(fn)));
|
::new BenchType(name, std::forward<Lambda>(fn)));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue