summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2022-10-25 18:30:25 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2022-10-26 21:54:08 (GMT)
commit3d6a8d7eac588e42ae60231409fc763a6bc41e9b (patch)
treef6ed617d3f41c61caa5a6a4228b5b6f4c4981ded /Source/cmMakefile.cxx
parentfd57ced75a72cd73d2fd01ec0dd9c5cd552f029d (diff)
downloadCMake-3d6a8d7eac588e42ae60231409fc763a6bc41e9b.zip
CMake-3d6a8d7eac588e42ae60231409fc763a6bc41e9b.tar.gz
CMake-3d6a8d7eac588e42ae60231409fc763a6bc41e9b.tar.bz2
cmMakefileProfilingData: Refactor to use RAII
And add a more generic StartEntry() method.
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r--Source/cmMakefile.cxx13
1 files changed, 6 insertions, 7 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 90a38be..2091f27 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -375,19 +375,15 @@ public:
++this->Makefile->RecursionDepth;
this->Makefile->ExecutionStatusStack.push_back(&status);
#if !defined(CMAKE_BOOTSTRAP)
- if (this->Makefile->GetCMakeInstance()->IsProfilingEnabled()) {
- this->Makefile->GetCMakeInstance()->GetProfilingOutput().StartEntry(lff,
- lfc);
- }
+ this->ProfilingDataRAII =
+ this->Makefile->GetCMakeInstance()->CreateProfilingEntry(lff, lfc);
#endif
}
~cmMakefileCall()
{
#if !defined(CMAKE_BOOTSTRAP)
- if (this->Makefile->GetCMakeInstance()->IsProfilingEnabled()) {
- this->Makefile->GetCMakeInstance()->GetProfilingOutput().StopEntry();
- }
+ this->ProfilingDataRAII.reset();
#endif
this->Makefile->ExecutionStatusStack.pop_back();
--this->Makefile->RecursionDepth;
@@ -399,6 +395,9 @@ public:
private:
cmMakefile* Makefile;
+#if !defined(CMAKE_BOOTSTRAP)
+ cm::optional<cmMakefileProfilingData::RAII> ProfilingDataRAII;
+#endif
};
void cmMakefile::OnExecuteCommand(std::function<void()> callback)