summaryrefslogtreecommitdiffstats
path: root/Source/cmCustomCommandGenerator.cxx
diff options
context:
space:
mode:
authorPeter Würth <wuerth.peter@freenet.de>2022-11-17 11:12:26 (GMT)
committerPeter Würth <wuerth.peter@freenet.de>2022-11-19 12:32:56 (GMT)
commit60a5a39022c8c2504173d635732110b2550b7f91 (patch)
treefa0ef8f4a0512f483200d526a0b2c205e5857b37 /Source/cmCustomCommandGenerator.cxx
parentd8c8e61633328b4e2247ce381e22ddc71dd0fbbf (diff)
downloadCMake-60a5a39022c8c2504173d635732110b2550b7f91.zip
CMake-60a5a39022c8c2504173d635732110b2550b7f91.tar.gz
CMake-60a5a39022c8c2504173d635732110b2550b7f91.tar.bz2
cmCustomCommandGenerator: refactor GetComment to return std::string
Refactoring was done because EvaluateComment leaked memory.
Diffstat (limited to 'Source/cmCustomCommandGenerator.cxx')
-rw-r--r--Source/cmCustomCommandGenerator.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index 57b009a..54f0bab 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -463,9 +463,12 @@ std::string cmCustomCommandGenerator::GetInternalDepfile() const
return this->ComputeInternalDepfile(this->OutputConfig, depfile);
}
-const char* cmCustomCommandGenerator::GetComment() const
+cm::optional<std::string> cmCustomCommandGenerator::GetComment() const
{
- return this->CC->GetComment();
+ if (const char* comment = this->CC->GetComment()) {
+ return comment;
+ }
+ return cm::nullopt;
}
std::string cmCustomCommandGenerator::GetWorkingDirectory() const