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:
Roman Lebedev 2023-07-03 12:18:31 +03:00 committed by GitHub
parent fed73374d7
commit edb0d3d46d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -1362,6 +1362,8 @@ class LambdaBenchmark : public Benchmark {
inline internal::Benchmark* RegisterBenchmark(const std::string& name,
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(
::new internal::FunctionBenchmark(name, fn));
}
@ -1371,6 +1373,8 @@ template <class Lambda>
internal::Benchmark* RegisterBenchmark(const std::string& name, Lambda&& fn) {
using BenchType =
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(
::new BenchType(name, std::forward<Lambda>(fn)));
}