From 2cae68ecbef7d570be52af67032ca74da315e0b3 Mon Sep 17 00:00:00 2001 From: AJIOB Date: Tue, 23 Sep 2025 15:42:18 +0300 Subject: [PATCH] Source: Minor optimizations --- Source/cmGeneratorTarget.cxx | 2 +- Source/cmGeneratorTarget_Options.cxx | 8 ++++---- Source/cmIDEOptions.cxx | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 753b1c54cd..9b87bb47fd 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -81,7 +81,7 @@ static void CreatePropertyGeneratorExpressions( bool evaluateForBuildsystem = false) { for (auto const& entry : entries) { - items.push_back(cmGeneratorTarget::TargetPropertyEntry::Create( + items.emplace_back(cmGeneratorTarget::TargetPropertyEntry::Create( cmakeInstance, entry, evaluateForBuildsystem)); } } diff --git a/Source/cmGeneratorTarget_Options.cxx b/Source/cmGeneratorTarget_Options.cxx index 012e6457c7..e588967644 100644 --- a/Source/cmGeneratorTarget_Options.cxx +++ b/Source/cmGeneratorTarget_Options.cxx @@ -76,15 +76,15 @@ void processOptions(cmGeneratorTarget const* tgt, options.emplace_back(opt, entry.Backtrace); } if (debugOptions) { - usedOptions += " * " + opt + "\n"; + usedOptions += cmStrCat(" * ", opt, '\n'); } } } if (!usedOptions.empty()) { tgt->GetLocalGenerator()->GetCMakeInstance()->IssueMessage( MessageType::LOG, - std::string("Used ") + logName + std::string(" for target ") + - tgt->GetName() + ":\n" + usedOptions, + cmStrCat("Used ", logName, " for target ", tgt->GetName(), ":\n", + usedOptions), entry.Backtrace); } } @@ -305,7 +305,7 @@ void cmGeneratorTarget::GetCompileDefinitions( { std::vector> tmp = this->GetCompileDefinitions(config, language); - result.reserve(tmp.size()); + result.reserve(result.size() + tmp.size()); for (BT& v : tmp) { result.emplace_back(std::move(v.Value)); } diff --git a/Source/cmIDEOptions.cxx b/Source/cmIDEOptions.cxx index 9e485461bd..1a6d88c90e 100644 --- a/Source/cmIDEOptions.cxx +++ b/Source/cmIDEOptions.cxx @@ -62,7 +62,7 @@ void cmIDEOptions::HandleFlag(std::string const& flag) this->DoingDefine = true; } else { // Store this definition. - this->Defines.push_back(flag.substr(2)); + this->Defines.emplace_back(flag.substr(2)); } return; } @@ -73,7 +73,7 @@ void cmIDEOptions::HandleFlag(std::string const& flag) this->DoingInclude = true; } else { // Store this include directory. - this->Includes.push_back(flag.substr(2)); + this->Includes.emplace_back(flag.substr(2)); } return; }