summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalXCodeGenerator.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/cmGlobalXCodeGenerator.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/cmGlobalXCodeGenerator.cxx')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 0e94de5..d57e2d1 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -13,6 +13,7 @@
#include <utility>
#include <cm/memory>
+#include <cm/optional>
#include <cmext/algorithm>
#include <cmext/string_view>
@@ -2280,11 +2281,11 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(
}
makefileStream << "\n";
- if (const char* comment = ccg.GetComment()) {
+ if (cm::optional<std::string> comment = ccg.GetComment()) {
std::string echo_cmd =
cmStrCat("echo ",
(this->CurrentLocalGenerator->EscapeForShell(
- comment, ccg.GetCC().GetEscapeAllowMakeVars())));
+ *comment, ccg.GetCC().GetEscapeAllowMakeVars())));
makefileStream << "\t" << echo_cmd << "\n";
}