summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-12-14 14:01:23 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-12-14 14:01:41 (GMT)
commit15dcb41f202c2d2123ce47f7afb06e9adc735101 (patch)
tree97072c4ecb27f4e81dbff8d5bab824a936b4b789 /Source
parent7ca90d04fc3c476a90ff679ecf6c87ee5c449f72 (diff)
parent6d15754814e2b7cc53402267f2b1ce6f61e631e8 (diff)
downloadCMake-15dcb41f202c2d2123ce47f7afb06e9adc735101.zip
CMake-15dcb41f202c2d2123ce47f7afb06e9adc735101.tar.gz
CMake-15dcb41f202c2d2123ce47f7afb06e9adc735101.tar.bz2
Merge topic 'vectorfix'
6d15754814 Make vector operations more efficient Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Acked-by: Alex <leha-bot@yandex.ru> Merge-request: !8010
Diffstat (limited to 'Source')
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx1
-rw-r--r--Source/cmCMakePresetsGraphReadJSON.cxx4
-rw-r--r--Source/cmFileAPICodemodel.cxx1
-rw-r--r--Source/cmFileLockPool.cxx4
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx1
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx4
-rw-r--r--Source/cmQtAutoGenInitializer.cxx3
-rw-r--r--Source/cmTarget.cxx4
-rw-r--r--Source/cmUVProcessChain.cxx1
9 files changed, 12 insertions, 11 deletions
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index f7c6a9c..5c48cbf 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -73,6 +73,7 @@ public:
bool StartProcess()
{
std::vector<const char*> args;
+ args.reserve(this->CommandLineStrings.size());
for (std::string const& cl : this->CommandLineStrings) {
args.push_back(cl.c_str());
}
diff --git a/Source/cmCMakePresetsGraphReadJSON.cxx b/Source/cmCMakePresetsGraphReadJSON.cxx
index eec53c1..a96ab58 100644
--- a/Source/cmCMakePresetsGraphReadJSON.cxx
+++ b/Source/cmCMakePresetsGraphReadJSON.cxx
@@ -518,9 +518,7 @@ cmCMakePresetsGraph::ReadFileResult cmCMakePresetsGraph::ReadJSONFile(
PresetPair<ConfigurePreset> presetPair;
presetPair.Unexpanded = preset;
presetPair.Expanded = cm::nullopt;
- if (!this->ConfigurePresets
- .emplace(std::make_pair(preset.Name, presetPair))
- .second) {
+ if (!this->ConfigurePresets.emplace(preset.Name, presetPair).second) {
return ReadFileResult::DUPLICATE_PRESETS;
}
diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx
index 56221a5..d3683d4 100644
--- a/Source/cmFileAPICodemodel.cxx
+++ b/Source/cmFileAPICodemodel.cxx
@@ -448,6 +448,7 @@ class Target
JBTs<T> ToJBTs(BTs<T> const& bts)
{
std::vector<JBTIndex> ids;
+ ids.reserve(bts.Backtraces.size());
for (cmListFileBacktrace const& backtrace : bts.Backtraces) {
ids.emplace_back(this->Backtraces.Add(backtrace));
}
diff --git a/Source/cmFileLockPool.cxx b/Source/cmFileLockPool.cxx
index 99f6885..c23a99c 100644
--- a/Source/cmFileLockPool.cxx
+++ b/Source/cmFileLockPool.cxx
@@ -15,7 +15,7 @@ cmFileLockPool::~cmFileLockPool() = default;
void cmFileLockPool::PushFunctionScope()
{
- this->FunctionScopes.push_back(ScopePool());
+ this->FunctionScopes.emplace_back();
}
void cmFileLockPool::PopFunctionScope()
@@ -26,7 +26,7 @@ void cmFileLockPool::PopFunctionScope()
void cmFileLockPool::PushFileScope()
{
- this->FileScopes.push_back(ScopePool());
+ this->FileScopes.emplace_back();
}
void cmFileLockPool::PopFileScope()
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index cfe4c7c..c24b1e3 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -2098,6 +2098,7 @@ void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os)
}
std::vector<std::string> byproducts;
+ byproducts.reserve(this->CrossConfigs.size());
for (auto const& config : this->CrossConfigs) {
byproducts.push_back(
this->BuildAlias(GetByproductsForCleanTargetName(), config));
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 6751efd..a9a0fd5 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -3623,7 +3623,7 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
}
// Add a pair of config and item to target-item map
auto& itemVector = targetItemMap[libName];
- itemVector.emplace_back(ConfigItemPair(configName, &libItem));
+ itemVector.emplace_back(configName, &libItem);
// Add product file-name to a lib-product map
auto productName =
cmSystemTools::GetFilenameName(libItem.Value.Value);
@@ -4381,7 +4381,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
cmXCodeObject* config =
this->CreateObject(cmXCodeObject::XCBuildConfiguration);
config->AddAttribute("name", this->CreateString(name));
- configs.push_back(std::make_pair(name, config));
+ configs.emplace_back(name, config);
}
if (defaultConfigName.empty()) {
defaultConfigName = "Debug";
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 6f78a46..66e591e 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -970,8 +970,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
uiHeader, uiHeaderGenex, cmStrCat(this->Dir.Build, "/include"_s),
uiHeaderFilePath);
- this->Uic.UiHeaders.emplace_back(
- std::make_pair(uiHeader, uiHeaderGenex));
+ this->Uic.UiHeaders.emplace_back(uiHeader, uiHeaderGenex);
} else {
// Register skipped .ui file
this->Uic.SkipUi.insert(fullPath);
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index d73e7cf..37f9e98 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2661,9 +2661,9 @@ cmFileSet* cmTarget::GetFileSet(const std::string& name)
std::pair<cmFileSet*, bool> cmTarget::GetOrCreateFileSet(
const std::string& name, const std::string& type, cmFileSetVisibility vis)
{
- auto result = this->impl->FileSets.emplace(std::make_pair(
+ auto result = this->impl->FileSets.emplace(
name,
- cmFileSet(*this->GetMakefile()->GetCMakeInstance(), name, type, vis)));
+ cmFileSet(*this->GetMakefile()->GetCMakeInstance(), name, type, vis));
if (result.second) {
auto bt = this->impl->Makefile->GetBacktrace();
if (type == this->impl->HeadersFileSets.TypeName) {
diff --git a/Source/cmUVProcessChain.cxx b/Source/cmUVProcessChain.cxx
index 6040fd8..3faf2f6 100644
--- a/Source/cmUVProcessChain.cxx
+++ b/Source/cmUVProcessChain.cxx
@@ -241,6 +241,7 @@ bool cmUVProcessChain::InternalData::AddCommand(
options.file = config.Arguments[0].c_str();
std::vector<const char*> arguments;
+ arguments.reserve(config.Arguments.size());
for (auto const& arg : config.Arguments) {
arguments.push_back(arg.c_str());
}