From d4144b9c0a1a8a8f3a24ff33fc2582bb319d73ac Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 27 Jul 2023 14:43:10 -0400 Subject: strings: use `emplace_back` with `cmStrCat` arguments --- Source/CPack/cmCPackInnoSetupGenerator.cxx | 8 ++++---- Source/cmExportBuildFileGenerator.cxx | 4 ++-- Source/cmExportInstallFileGenerator.cxx | 4 ++-- Source/cmGlobalGhsMultiGenerator.cxx | 2 +- Source/cmGlobalVisualStudio10Generator.cxx | 6 +++--- Source/cmGlobalVisualStudio12Generator.cxx | 4 ++-- Source/cmGlobalVisualStudio14Generator.cxx | 4 ++-- Source/cmGlobalVisualStudio9Generator.cxx | 8 ++++---- Source/cmGlobalVisualStudioVersionedGenerator.cxx | 4 ++-- Source/cmNinjaTargetGenerator.cxx | 3 ++- Source/cmQtAutoMocUic.cxx | 2 +- Source/cmVisualStudio10TargetGenerator.cxx | 2 +- 12 files changed, 26 insertions(+), 25 deletions(-) diff --git a/Source/CPack/cmCPackInnoSetupGenerator.cxx b/Source/CPack/cmCPackInnoSetupGenerator.cxx index ada9a5b..b8bf070 100644 --- a/Source/CPack/cmCPackInnoSetupGenerator.cxx +++ b/Source/CPack/cmCPackInnoSetupGenerator.cxx @@ -106,7 +106,7 @@ int cmCPackInnoSetupGenerator::PackageFiles() const cmList extraScripts(GetOption("CPACK_INNOSETUP_EXTRA_SCRIPTS")); for (const std::string& i : extraScripts) { - includeDirectives.push_back(cmStrCat( + includeDirectives.emplace_back(cmStrCat( "#include ", QuotePath(cmSystemTools::CollapseFullPath(i, toplevel)))); } } @@ -142,7 +142,7 @@ int cmCPackInnoSetupGenerator::PackageFiles() const cmList codeFiles(GetOption("CPACK_INNOSETUP_CODE_FILES")); for (const std::string& i : codeFiles) { - codeIncludes.push_back(cmStrCat( + codeIncludes.emplace_back(cmStrCat( "#include ", QuotePath(cmSystemTools::CollapseFullPath(i, toplevel)))); } } @@ -781,7 +781,7 @@ bool cmCPackInnoSetupGenerator::ConfigureISScript() // Create internal variables std::vector setupSection; for (const auto& i : setupDirectives) { - setupSection.push_back(cmStrCat(i.first, '=', TranslateBool(i.second))); + setupSection.emplace_back(cmStrCat(i.first, '=', TranslateBool(i.second))); } // Also create comments if the sections are empty @@ -1082,7 +1082,7 @@ std::string cmCPackInnoSetupGenerator::ISKeyValueLine( std::vector keys; for (const char* i : availableKeys) { if (params.count(i)) { - keys.push_back(cmStrCat(i, ": ", params.at(i))); + keys.emplace_back(cmStrCat(i, ": ", params.at(i))); } } diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index 8d3960c..fd35786 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -419,7 +419,7 @@ std::string cmExportBuildFileGenerator::GetFileSetDirectories( resultVector.push_back( cmStrCat("\"$<$:", dest, ">\"")); } else { - resultVector.push_back(cmStrCat('"', dest, '"')); + resultVector.emplace_back(cmStrCat('"', dest, '"')); break; } } @@ -478,7 +478,7 @@ std::string cmExportBuildFileGenerator::GetFileSetFiles(cmGeneratorTarget* gte, resultVector.push_back( cmStrCat("\"$<$:", escapedFile, ">\"")); } else { - resultVector.push_back(cmStrCat('"', escapedFile, '"')); + resultVector.emplace_back(cmStrCat('"', escapedFile, '"')); } } } diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 264c947..6cf3a09 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -616,7 +616,7 @@ std::string cmExportInstallFileGenerator::GetFileSetDirectories( resultVector.push_back( cmStrCat("\"$<$:", dest, ">\"")); } else { - resultVector.push_back(cmStrCat('"', dest, '"')); + resultVector.emplace_back(cmStrCat('"', dest, '"')); break; } } @@ -690,7 +690,7 @@ std::string cmExportInstallFileGenerator::GetFileSetFiles( resultVector.push_back( cmStrCat("\"$<$:", escapedFile, ">\"")); } else { - resultVector.push_back(cmStrCat('"', escapedFile, '"')); + resultVector.emplace_back(cmStrCat('"', escapedFile, '"')); } } } diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 2453bfc..4ba53ec 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -670,7 +670,7 @@ bool cmGlobalGhsMultiGenerator::AddCheckTarget() } // Add the cache file. - listFiles.push_back(cmStrCat( + listFiles.emplace_back(cmStrCat( this->GetCMakeInstance()->GetHomeOutputDirectory(), "/CMakeCache.txt")); // Print not implemented warning. diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 41cd807..7a852f8 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -975,9 +975,9 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf) std::vector cmd; cmd.push_back(this->GetMSBuildCommand()); cmd.push_back(vcxproj); - cmd.push_back("/p:Configuration=Debug"); - cmd.push_back(cmStrCat("/p:Platform=", this->GetPlatformName())); - cmd.push_back(cmStrCat("/p:VisualStudioVersion=", this->GetIDEVersion())); + cmd.emplace_back("/p:Configuration=Debug"); + cmd.emplace_back(cmStrCat("/p:Platform=", this->GetPlatformName())); + cmd.emplace_back(cmStrCat("/p:VisualStudioVersion=", this->GetIDEVersion())); std::string out; int ret = 0; cmsys::RegularExpression regex("\n *VCTargetsPath=([^%\r\n]+)[\r\n]"); diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index 6c72c5d..1f1a2c3 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -80,8 +80,8 @@ public: std::vector GetGeneratorNamesWithPlatform() const override { std::vector names; - names.push_back(cmStrCat(vs12generatorName, " ARM")); - names.push_back(cmStrCat(vs12generatorName, " Win64")); + names.emplace_back(cmStrCat(vs12generatorName, " ARM")); + names.emplace_back(cmStrCat(vs12generatorName, " Win64")); return names; } diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index 1350945..9f1926d 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -82,8 +82,8 @@ public: std::vector GetGeneratorNamesWithPlatform() const override { std::vector names; - names.push_back(cmStrCat(vs14generatorName, " ARM")); - names.push_back(cmStrCat(vs14generatorName, " Win64")); + names.emplace_back(cmStrCat(vs14generatorName, " ARM")); + names.emplace_back(cmStrCat(vs14generatorName, " Win64")); return names; } diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index 462db2a..de2153d 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -72,21 +72,21 @@ public: std::vector GetGeneratorNames() const override { std::vector names; - names.push_back(vs9generatorName); + names.emplace_back(vs9generatorName); return names; } std::vector GetGeneratorNamesWithPlatform() const override { std::vector names; - names.push_back(cmStrCat(vs9generatorName, " Win64")); - names.push_back(cmStrCat(vs9generatorName, " IA64")); + names.emplace_back(cmStrCat(vs9generatorName, " Win64")); + names.emplace_back(cmStrCat(vs9generatorName, " IA64")); cmVisualStudioWCEPlatformParser parser; parser.ParseVersion("9.0"); const std::vector& availablePlatforms = parser.GetAvailablePlatforms(); for (std::string const& i : availablePlatforms) { - names.push_back(cmStrCat("Visual Studio 9 2008 ", i)); + names.emplace_back(cmStrCat("Visual Studio 9 2008 ", i)); } return names; } diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index 938e4a3..52e6d42 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -265,8 +265,8 @@ public: std::vector GetGeneratorNamesWithPlatform() const override { std::vector names; - names.push_back(cmStrCat(vs15generatorName, " ARM")); - names.push_back(cmStrCat(vs15generatorName, " Win64")); + names.emplace_back(cmStrCat(vs15generatorName, " ARM")); + names.emplace_back(cmStrCat(vs15generatorName, " Win64")); return names; } diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index d712d71..4837ee6 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -1052,7 +1052,8 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements( for (std::string const& l : this->GetLinkedTargetDirectories(language, config)) { - build.ImplicitDeps.push_back(cmStrCat(l, '/', language, "Modules.json")); + build.ImplicitDeps.emplace_back( + cmStrCat(l, '/', language, "Modules.json")); } this->GetGlobalGenerator()->WriteBuild(this->GetImplFileStream(fileConfig), diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx index a101a81..62b5172 100644 --- a/Source/cmQtAutoMocUic.cxx +++ b/Source/cmQtAutoMocUic.cxx @@ -2116,7 +2116,7 @@ void cmQtAutoMocUicT::JobCompileMocT::MaybeWriteMocResponseFile( cmd.resize(1); // Specify response file - cmd.push_back(cmStrCat('@', responseFile)); + cmd.emplace_back(cmStrCat('@', responseFile)); } #else static_cast(outputFile); diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 6e12402..5ba9332 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -4356,7 +4356,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( // first just full path linkDirs.push_back(d); // next path with configuration type Debug, Release, etc - linkDirs.push_back(cmStrCat(d, "/$(Configuration)")); + linkDirs.emplace_back(cmStrCat(d, "/$(Configuration)")); } linkDirs.push_back("%(AdditionalLibraryDirectories)"); linkOptions.AddFlag("AdditionalLibraryDirectories", linkDirs); -- cgit v0.12