1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-19 11:18:40 +08:00

instrumentation: Use auto for variables holding closures

This commit is contained in:
Martin Duffy
2025-02-17 10:21:31 -05:00
committed by Brad King
parent d75ccd9f8d
commit 45d3ffaa95
3 changed files with 6 additions and 9 deletions

View File

@@ -10,7 +10,6 @@
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <functional>
#include <initializer_list>
#include <iostream>
#include <map>
@@ -2725,7 +2724,7 @@ int cmCTest::ExecuteTests(std::vector<std::string> const& args)
handler.SetVerbose(this->Impl->Verbose);
cmInstrumentation instrumentation(this->GetBinaryDir());
std::function<int()> processHandler = [&handler]() {
auto processHandler = [&handler]() -> int {
return handler.ProcessHandler();
};
int ret = instrumentation.InstrumentCommand("ctest", args, processHandler);

View File

@@ -2624,7 +2624,7 @@ int cmake::ActualConfigure()
cmSystemTools::Error(this->Instrumentation->errorMsg);
return 1;
}
std::function<int()> doConfigure = [this]() -> int {
auto doConfigure = [this]() -> int {
this->GlobalGenerator->Configure();
return 0;
};
@@ -3023,7 +3023,7 @@ int cmake::Generate()
auto startTime = std::chrono::steady_clock::now();
#if !defined(CMAKE_BOOTSTRAP)
auto profilingRAII = this->CreateProfilingEntry("project", "generate");
std::function<int()> doGenerate = [this]() -> int {
auto doGenerate = [this]() -> int {
if (!this->GlobalGenerator->Compute()) {
return -1;
}
@@ -3975,9 +3975,8 @@ int cmake::Build(int jobs, std::string dir, std::vector<std::string> targets,
// are being executed to the `output` parameter. If CMake is verbose, print
// this out.
std::ostream& verbose_ostr = verbose ? std::cout : ostr;
std::function<int()> doBuild = [this, jobs, dir, projName, targets,
&verbose_ostr, config, buildOptions, verbose,
nativeOptions]() {
auto doBuild = [this, jobs, dir, projName, targets, &verbose_ostr, config,
buildOptions, verbose, nativeOptions]() -> int {
return this->GlobalGenerator->Build(
jobs, "", dir, projName, targets, verbose_ostr, "", config, buildOptions,
verbose, cmDuration::zero(), cmSystemTools::OUTPUT_PASSTHROUGH,

View File

@@ -971,8 +971,7 @@ int do_install(int ac, char const* const* av)
}
}
std::function<int()> doInstall = [&handler, &verbose, &jobs,
&instrumentation]() -> int {
auto doInstall = [&handler, &verbose, &jobs, &instrumentation]() -> int {
int ret_ = 0;
if (handler.IsParallel()) {
ret_ = handler.Install(jobs, instrumentation);