From c85bb007df37aad9f20355cdf4d7ca9af562cb20 Mon Sep 17 00:00:00 2001 From: Pavel Solodovnikov Date: Thu, 25 Jan 2018 16:59:33 +0300 Subject: Reduce allocation of temporary values on heap. - Use `std::move` while inserting temporary results into vectors. - Change `push_back` to `emplace_back` where appropriate. --- Source/CPack/IFW/cmCPackIFWInstaller.cxx | 2 +- Source/CPack/cmCPackArchiveGenerator.cxx | 8 +-- Source/CPack/cmCPackDebGenerator.cxx | 4 +- Source/CPack/cmCPackGenerator.cxx | 6 +- Source/CPack/cmCPackNSISGenerator.cxx | 2 +- Source/CPack/cpack.cxx | 2 +- Source/CTest/cmCTestBuildAndTestHandler.cxx | 15 ++-- Source/CTest/cmCTestBuildHandler.cxx | 9 +-- Source/CTest/cmCTestLaunch.cxx | 2 +- Source/CTest/cmCTestMemCheckHandler.cxx | 15 ++-- Source/CTest/cmCTestMultiProcessHandler.cxx | 4 +- Source/CTest/cmCTestSVN.cxx | 4 +- Source/CTest/cmCTestTestHandler.cxx | 12 +--- Source/cmAddCustomCommandCommand.cxx | 7 +- Source/cmAddCustomTargetCommand.cxx | 3 +- Source/cmAuxSourceDirectoryCommand.cxx | 2 +- Source/cmCommonTargetGenerator.cxx | 2 +- Source/cmComputeComponentGraph.cxx | 6 +- Source/cmComputeLinkDepends.cxx | 7 +- Source/cmComputeLinkInformation.cxx | 34 ++++----- Source/cmComputeTargetDepends.cxx | 13 ++-- Source/cmCoreTryCompile.cxx | 10 +-- Source/cmCustomCommandGenerator.cxx | 5 +- Source/cmDependsC.cxx | 2 +- Source/cmDependsJavaParserHelper.cxx | 5 +- Source/cmDocumentation.cxx | 4 +- Source/cmDocumentationSection.cxx | 6 +- Source/cmELF.cxx | 3 +- Source/cmExportBuildFileGenerator.cxx | 2 +- Source/cmExportCommand.cxx | 2 +- Source/cmExportInstallFileGenerator.cxx | 2 +- Source/cmExtraEclipseCDT4Generator.cxx | 2 +- Source/cmFileCommand.cxx | 4 +- Source/cmFindCommon.cxx | 2 +- Source/cmFindLibraryCommand.cxx | 4 +- Source/cmFindPackageCommand.cxx | 6 +- Source/cmFindProgramCommand.cxx | 2 +- Source/cmGeneratorExpressionEvaluationFile.cxx | 2 +- Source/cmGeneratorExpressionEvaluator.cxx | 7 +- Source/cmGeneratorExpressionLexer.cxx | 16 ++--- Source/cmGeneratorTarget.cxx | 23 +++--- Source/cmGlobalGenerator.cxx | 99 +++++++++++++------------- Source/cmGlobalNinjaGenerator.cxx | 2 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 6 +- Source/cmGraphVizWriter.cxx | 4 +- Source/cmIncludeDirectoryCommand.cxx | 4 +- Source/cmInstallCommand.cxx | 7 +- Source/cmInstallCommandArguments.cxx | 4 +- Source/cmInstallFilesCommand.cxx | 3 +- Source/cmInstallTargetGenerator.cxx | 24 +++---- Source/cmListFileCache.cxx | 3 +- Source/cmLocalGenerator.cxx | 10 +-- Source/cmLocalUnixMakefileGenerator3.cxx | 46 ++++++------ Source/cmMacroCommand.cxx | 3 +- Source/cmMakefile.cxx | 17 +++-- Source/cmMakefileExecutableTargetGenerator.cxx | 4 +- Source/cmMakefileLibraryTargetGenerator.cxx | 10 +-- Source/cmMakefileTargetGenerator.cxx | 20 +++--- Source/cmMakefileUtilityTargetGenerator.cxx | 3 +- Source/cmNinjaNormalTargetGenerator.cxx | 5 +- Source/cmNinjaTargetGenerator.cxx | 2 +- Source/cmQTWrapCPPCommand.cxx | 4 +- Source/cmQTWrapUICommand.cxx | 8 ++- Source/cmSearchPath.cxx | 4 +- Source/cmServerProtocol.cxx | 6 +- Source/cmSystemTools.cxx | 2 +- Source/cmTarget.cxx | 12 ++-- Source/cmVariableWatchCommand.cxx | 18 +++-- Source/cmake.cxx | 18 +++-- 69 files changed, 302 insertions(+), 314 deletions(-) diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index bcbe84d..05a852d 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -467,7 +467,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile() std::string name = cmSystemTools::GetFilenameName(this->Resources[i]); std::string path = this->Directory + "/resources/" + name; cmsys::SystemTools::CopyFileIfDifferent(this->Resources[i], path); - resources.push_back(name); + resources.push_back(std::move(name)); } else { cmCPackIFWLogger(WARNING, "Can't copy resources from \"" << this->Resources[i] diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index 641be38..893b2fc 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -132,7 +132,7 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup) } } // add the generated package to package file names list - packageFileNames.push_back(packageFileName); + packageFileNames.push_back(std::move(packageFileName)); } // Handle Orphan components (components not belonging to any groups) for (auto& comp : this->Components) { @@ -157,7 +157,7 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup) addOneComponentToArchive(archive, &(comp.second)); } // add the generated package to package file names list - packageFileNames.push_back(packageFileName); + packageFileNames.push_back(std::move(packageFileName)); } } } @@ -178,7 +178,7 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup) addOneComponentToArchive(archive, &(comp.second)); } // add the generated package to package file names list - packageFileNames.push_back(packageFileName); + packageFileNames.push_back(std::move(packageFileName)); } } return 1; @@ -188,7 +188,7 @@ int cmCPackArchiveGenerator::PackageComponentsAllInOne() { // reset the package file names packageFileNames.clear(); - packageFileNames.push_back(std::string(toplevel)); + packageFileNames.emplace_back(toplevel); packageFileNames[0] += "/"; if (this->IsSet("CPACK_ARCHIVE_FILE_NAME")) { diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 7fc3c26..8ec54f8 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -89,7 +89,7 @@ int cmCPackDebGenerator::PackageOnePack(std::string const& initialTopLevel, packageFileName = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); packageFileName += "/"; packageFileName += this->GetOption("GEN_CPACK_OUTPUT_FILE_NAME"); - packageFileNames.push_back(packageFileName); + packageFileNames.push_back(std::move(packageFileName)); return retval; } @@ -206,7 +206,7 @@ int cmCPackDebGenerator::PackageComponentsAllInOne( packageFileName = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); packageFileName += "/"; packageFileName += this->GetOption("GEN_CPACK_OUTPUT_FILE_NAME"); - packageFileNames.push_back(packageFileName); + packageFileNames.push_back(std::move(packageFileName)); return retval; } diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 69e53e1..03fa018 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -313,7 +313,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( for (std::string const& ifr : ignoreFilesRegexString) { cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Create ignore files regex for: " << ifr << std::endl); - ignoreFilesRegex.push_back(ifr.c_str()); + ignoreFilesRegex.emplace_back(ifr); } } const char* installDirectories = @@ -383,8 +383,8 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( std::string inFileRelative = cmSystemTools::RelativePath(top.c_str(), inFile.c_str()); cmSystemTools::ReadSymlink(inFile, targetFile); - symlinkedFiles.push_back( - std::pair(targetFile, inFileRelative)); + symlinkedFiles.emplace_back(std::move(targetFile), + std::move(inFileRelative)); } /* If it is not a symlink then do a plain copy */ else if (!(cmSystemTools::CopyFileIfDifferent(inFile.c_str(), diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index ddf104c..e0b9f9e 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -115,7 +115,7 @@ int cmCPackNSISGenerator::PackageFiles() dstr << " RMDir \"" << componentOutputDir << "\\" << fileN << "\"" << std::endl; if (!componentName.empty()) { - this->Components[componentName].Directories.push_back(fileN); + this->Components[componentName].Directories.push_back(std::move(fileN)); } } cmCPackLogger(cmCPackLog::LOG_DEBUG, "Uninstall Dirs: " << dstr.str() diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 2b2152c..7d47798 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -432,7 +432,7 @@ int main(int argc, char const* const* argv) cmDocumentationEntry e; e.Name = g.first; e.Brief = g.second; - v.push_back(e); + v.push_back(std::move(e)); } doc.SetSection("Generators", v); diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 85d98d0..bbb4871 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -51,19 +51,13 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring, args.push_back(cmSystemTools::GetCMakeCommand()); args.push_back(this->SourceDir); if (!this->BuildGenerator.empty()) { - std::string generator = "-G"; - generator += this->BuildGenerator; - args.push_back(generator); + args.push_back("-G" + this->BuildGenerator); } if (!this->BuildGeneratorPlatform.empty()) { - std::string platform = "-A"; - platform += this->BuildGeneratorPlatform; - args.push_back(platform); + args.push_back("-A" + this->BuildGeneratorPlatform); } if (!this->BuildGeneratorToolset.empty()) { - std::string toolset = "-T"; - toolset += this->BuildGeneratorToolset; - args.push_back(toolset); + args.push_back("-T" + this->BuildGeneratorToolset); } const char* config = nullptr; @@ -77,8 +71,7 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring, #endif if (config) { - std::string btype = "-DCMAKE_BUILD_TYPE:STRING=" + std::string(config); - args.push_back(btype); + args.push_back("-DCMAKE_BUILD_TYPE:STRING=" + std::string(config)); } for (std::string const& opt : this->BuildOptions) { diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index ef4d3c6..dbbe131 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -17,6 +17,7 @@ #include #include #include +#include static const char* cmCTestErrorMatches[] = { "^[Bb]us [Ee]rror", @@ -294,7 +295,7 @@ int cmCTestBuildHandler::ProcessHandler() cmCTestWarningErrorFileLine[entry].RegularExpressionString)) { r.FileIndex = cmCTestWarningErrorFileLine[entry].FileIndex; r.LineIndex = cmCTestWarningErrorFileLine[entry].LineIndex; - this->ErrorWarningFileLineRegex.push_back(r); + this->ErrorWarningFileLineRegex.push_back(std::move(r)); } else { cmCTestLog( this->CTest, ERROR_MESSAGE, "Problem Compiling regular expression: " @@ -894,7 +895,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, int* retVal, errorwarning.PreContext.clear(); errorwarning.PostContext.clear(); errorwarning.Error = false; - this->ErrorsAndWarnings.push_back(errorwarning); + this->ErrorsAndWarnings.push_back(std::move(errorwarning)); this->TotalWarnings++; } } @@ -917,7 +918,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, int* retVal, errorwarning.PreContext.clear(); errorwarning.PostContext.clear(); errorwarning.Error = true; - this->ErrorsAndWarnings.push_back(errorwarning); + this->ErrorsAndWarnings.push_back(std::move(errorwarning)); this->TotalErrors++; cmCTestLog(this->CTest, ERROR_MESSAGE, "There was an error: " << cmsysProcess_GetErrorString(cp) << std::endl); @@ -1009,7 +1010,7 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, size_t length, this->PreContext.clear(); // Store report - this->ErrorsAndWarnings.push_back(errorwarning); + this->ErrorsAndWarnings.push_back(std::move(errorwarning)); this->LastErrorOrWarning = this->ErrorsAndWarnings.end() - 1; this->PostContextCount = 0; } else { diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index a1249f5..07dd2f5 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -564,7 +564,7 @@ void cmCTestLaunch::LoadScrapeRules( std::string line; cmsys::RegularExpression rex; while (cmSystemTools::GetLineFromStream(fin, line)) { - if (rex.compile(line.c_str())) { + if (rex.compile(line)) { regexps.push_back(rex); } } diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 6b6c337..a6e318a 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -14,6 +14,7 @@ #include #include #include +#include struct CatToErrorType { @@ -545,12 +546,12 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() << std::endl); return false; } - std::string suppressions = "--suppressions=" + - this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile"); - this->MemoryTesterOptions.push_back(suppressions); + this->MemoryTesterOptions.push_back( + "--suppressions=" + + this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile")); } - std::string outputFile = "--log-file=" + this->MemoryTesterOutputFile; - this->MemoryTesterDynamicOptions.push_back(outputFile); + this->MemoryTesterDynamicOptions.push_back("--log-file=" + + this->MemoryTesterOutputFile); break; } case cmCTestMemCheckHandler::PURIFY: { @@ -588,7 +589,7 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() "/Testing/Temporary/MemoryChecker.??.DPbd"; this->BoundsCheckerDPBDFile = dpbdFile; this->MemoryTesterDynamicOptions.push_back("/B"); - this->MemoryTesterDynamicOptions.push_back(dpbdFile); + this->MemoryTesterDynamicOptions.push_back(std::move(dpbdFile)); this->MemoryTesterDynamicOptions.push_back("/X"); this->MemoryTesterDynamicOptions.push_back(this->MemoryTesterOutputFile); this->MemoryTesterOptions.push_back("/M"); @@ -1098,5 +1099,5 @@ void cmCTestMemCheckHandler::TestOutputFileNames( cmCTestLog(this->CTest, ERROR_MESSAGE, log << std::endl); ofile.clear(); } - files.push_back(ofile); + files.push_back(std::move(ofile)); } diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 53c47a2..74ac97e 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -570,7 +570,7 @@ void cmCTestMultiProcessHandler::CreateParallelTestCostList() TestSet alreadySortedTests; std::list priorityStack; - priorityStack.push_back(TestSet()); + priorityStack.emplace_back(); TestSet& topLevel = priorityStack.back(); // In parallel test runs add previously failed tests to the front @@ -592,7 +592,7 @@ void cmCTestMultiProcessHandler::CreateParallelTestCostList() // further dependencies exist. while (!priorityStack.back().empty()) { TestSet& previousSet = priorityStack.back(); - priorityStack.push_back(TestSet()); + priorityStack.emplace_back(); TestSet& currentSet = priorityStack.back(); for (auto const& i : previousSet) { diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index ce96224..73184fc 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -515,7 +515,7 @@ private: } else { local_path = path; } - this->SVN->Repositories.push_back(SVNInfo(local_path.c_str())); + this->SVN->Repositories.emplace_back(local_path.c_str()); } }; @@ -526,7 +526,7 @@ bool cmCTestSVN::LoadRepositories() } // Info for root repository - this->Repositories.push_back(SVNInfo("")); + this->Repositories.emplace_back(""); this->RootInfo = &(this->Repositories.back()); // Run "svn status" to get the list of external repositories diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 4c7cefb..0141a1c 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -2156,9 +2156,7 @@ bool cmCTestTestHandler::SetTestsProperties( std::vector lval; cmSystemTools::ExpandListArgument(val, lval); for (std::string const& cr : lval) { - rt.ErrorRegularExpressions.push_back( - std::pair( - cmsys::RegularExpression(cr.c_str()), std::string(cr))); + rt.ErrorRegularExpressions.emplace_back(cr, cr); } } if (key == "PROCESSORS") { @@ -2204,9 +2202,7 @@ bool cmCTestTestHandler::SetTestsProperties( std::vector lval; cmSystemTools::ExpandListArgument(val, lval); for (std::string const& cr : lval) { - rt.RequiredRegularExpressions.push_back( - std::pair( - cmsys::RegularExpression(cr.c_str()), std::string(cr))); + rt.RequiredRegularExpressions.emplace_back(cr, cr); } } if (key == "WORKING_DIRECTORY") { @@ -2225,9 +2221,7 @@ bool cmCTestTestHandler::SetTestsProperties( std::vector lval; cmSystemTools::ExpandListArgument(propArgs[1], lval); for (std::string const& cr : lval) { - rt.TimeoutRegularExpressions.push_back( - std::pair( - cmsys::RegularExpression(cr.c_str()), std::string(cr))); + rt.TimeoutRegularExpressions.emplace_back(cr, cr); } } } diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index 7fed52d..14dfdae 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -3,6 +3,7 @@ #include "cmAddCustomCommandCommand.h" #include +#include #include "cmCustomCommand.h" #include "cmCustomCommandLines.h" @@ -184,9 +185,7 @@ bool cmAddCustomCommandCommand::InitialPass( depends.push_back(dep); // Add the implicit dependency language and file. - cmCustomCommand::ImplicitDependsPair entry(implicit_depends_lang, - dep); - implicit_depends.push_back(entry); + implicit_depends.emplace_back(implicit_depends_lang, dep); // Switch back to looking for a language. doing = doing_implicit_depends_lang; @@ -200,7 +199,7 @@ bool cmAddCustomCommandCommand::InitialPass( case doing_depends: { std::string dep = copy; cmSystemTools::ConvertToUnixSlashes(dep); - depends.push_back(dep); + depends.push_back(std::move(dep)); } break; case doing_outputs: outputs.push_back(filename); diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx index 819c781..cd1a376 100644 --- a/Source/cmAddCustomTargetCommand.cxx +++ b/Source/cmAddCustomTargetCommand.cxx @@ -3,6 +3,7 @@ #include "cmAddCustomTargetCommand.h" #include +#include #include "cmCustomCommandLines.h" #include "cmGeneratorExpression.h" @@ -127,7 +128,7 @@ bool cmAddCustomTargetCommand::InitialPass( case doing_depends: { std::string dep = copy; cmSystemTools::ConvertToUnixSlashes(dep); - depends.push_back(dep); + depends.push_back(std::move(dep)); } break; case doing_comment: comment_buffer = copy; diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx index fcdc632..f3cf32e 100644 --- a/Source/cmAuxSourceDirectoryCommand.cxx +++ b/Source/cmAuxSourceDirectoryCommand.cxx @@ -63,7 +63,7 @@ bool cmAuxSourceDirectoryCommand::InitialPass( // depends can be done cmSourceFile* sf = this->Makefile->GetOrCreateSource(fullname); sf->SetProperty("ABSTRACT", "0"); - files.push_back(fullname); + files.push_back(std::move(fullname)); } } } diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 1189606..d6d8eb0 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -159,7 +159,7 @@ std::vector cmCommonTargetGenerator::GetLinkedTargetDirectories() std::string di = lg->GetCurrentBinaryDirectory(); di += "/"; di += lg->GetTargetDirectory(linkee); - dirs.push_back(di); + dirs.push_back(std::move(di)); } } } diff --git a/Source/cmComputeComponentGraph.cxx b/Source/cmComputeComponentGraph.cxx index 9ec98ae..a7dc1ca 100644 --- a/Source/cmComputeComponentGraph.cxx +++ b/Source/cmComputeComponentGraph.cxx @@ -88,7 +88,7 @@ void cmComputeComponentGraph::TarjanVisit(int i) if (this->TarjanEntries[i].Root == i) { // Yes. Create it. int c = static_cast(this->Components.size()); - this->Components.push_back(NodeList()); + this->Components.emplace_back(); NodeList& component = this->Components[c]; // Populate the component list. @@ -125,8 +125,8 @@ void cmComputeComponentGraph::TransferEdges() if (i_component != j_component) { // We do not attempt to combine duplicate edges, but instead // store the inter-component edges with suitable multiplicity. - this->ComponentGraph[i_component].push_back( - cmGraphEdge(j_component, ni.IsStrong())); + this->ComponentGraph[i_component].emplace_back(j_component, + ni.IsStrong()); } } } diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index d9efc2e..354de36 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -285,9 +285,9 @@ std::map::iterator cmComputeLinkDepends::AllocateLinkEntry( item, static_cast(this->EntryList.size())); std::map::iterator lei = this->LinkEntryIndex.insert(index_entry).first; - this->EntryList.push_back(LinkEntry()); + this->EntryList.emplace_back(); this->InferredDependSets.push_back(nullptr); - this->EntryConstraintGraph.push_back(EdgeList()); + this->EntryConstraintGraph.emplace_back(); return lei; } @@ -472,8 +472,7 @@ void cmComputeLinkDepends::AddVarLinkEntries(int depender_index, // If the library is meant for this link type then use it. if (llt == GENERAL_LibraryType || llt == this->LinkType) { - cmLinkItem item(d, this->FindTargetToLink(depender_index, d)); - actual_libs.push_back(item); + actual_libs.emplace_back(d, this->FindTargetToLink(depender_index, d)); } else if (this->OldLinkDirMode) { cmLinkItem item(d, this->FindTargetToLink(depender_index, d)); this->CheckWrongConfigItem(item); diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 18cca5a..33dd2d7 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -498,8 +498,8 @@ bool cmComputeLinkInformation::Compute() cmStateEnums::ArtifactType artifact = implib ? cmStateEnums::ImportLibraryArtifact : cmStateEnums::RuntimeBinaryArtifact; - std::string lib = tgt->GetFullPath(this->Config, artifact, true); - this->OldLinkDirItems.push_back(lib); + this->OldLinkDirItems.push_back( + tgt->GetFullPath(this->Config, artifact, true)); } } @@ -598,13 +598,13 @@ void cmComputeLinkInformation::AddItem(std::string const& item, std::string exe = tgt->GetFullPath(config, artifact, true); linkItem += exe; - this->Items.push_back(Item(linkItem, true, tgt)); - this->Depends.push_back(exe); + this->Items.emplace_back(linkItem, true, tgt); + this->Depends.push_back(std::move(exe)); } else if (tgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) { // Add the interface library as an item so it can be considered as part // of COMPATIBLE_INTERFACE_ enforcement. The generators will ignore // this for the actual link line. - this->Items.push_back(Item(std::string(), false, tgt)); + this->Items.emplace_back(std::string(), false, tgt); // Also add the item the interface specifies to be used in its place. std::string const& libName = tgt->GetImportedLibName(config); @@ -950,10 +950,10 @@ void cmComputeLinkInformation::SetCurrentLinkType(LinkType lt) if (this->LinkTypeEnabled) { switch (this->CurrentLinkType) { case LinkStatic: - this->Items.push_back(Item(this->StaticLinkTypeFlag, false)); + this->Items.emplace_back(this->StaticLinkTypeFlag, false); break; case LinkShared: - this->Items.push_back(Item(this->SharedLinkTypeFlag, false)); + this->Items.emplace_back(this->SharedLinkTypeFlag, false); break; default: break; @@ -989,7 +989,7 @@ void cmComputeLinkInformation::AddTargetItem(std::string const& item, // If this platform wants a flag before the full path, add it. if (!this->LibLinkFileFlag.empty()) { - this->Items.push_back(Item(this->LibLinkFileFlag, false)); + this->Items.emplace_back(this->LibLinkFileFlag, false); } // For compatibility with CMake 2.4 include the item's directory in @@ -1001,7 +1001,7 @@ void cmComputeLinkInformation::AddTargetItem(std::string const& item, } // Now add the full path to the library. - this->Items.push_back(Item(item, true, target)); + this->Items.emplace_back(item, true, target); } void cmComputeLinkInformation::AddFullItem(std::string const& item) @@ -1056,11 +1056,11 @@ void cmComputeLinkInformation::AddFullItem(std::string const& item) // If this platform wants a flag before the full path, add it. if (!this->LibLinkFileFlag.empty()) { - this->Items.push_back(Item(this->LibLinkFileFlag, false)); + this->Items.emplace_back(this->LibLinkFileFlag, false); } // Now add the full path to the library. - this->Items.push_back(Item(item, true)); + this->Items.emplace_back(item, true); } bool cmComputeLinkInformation::CheckImplicitDirItem(std::string const& item) @@ -1147,7 +1147,7 @@ void cmComputeLinkInformation::AddUserItem(std::string const& item, this->SetCurrentLinkType(this->StartLinkType); // Use the item verbatim. - this->Items.push_back(Item(item, false)); + this->Items.emplace_back(item, false); return; } @@ -1219,7 +1219,7 @@ void cmComputeLinkInformation::AddUserItem(std::string const& item, std::string out = this->LibLinkFlag; out += lib; out += this->LibLinkSuffix; - this->Items.push_back(Item(out, false)); + this->Items.emplace_back(out, false); // Here we could try to find the library the linker will find and // add a runtime information entry for it. It would probably not be @@ -1254,10 +1254,10 @@ void cmComputeLinkInformation::AddFrameworkItem(std::string const& item) this->AddLibraryRuntimeInfo(full_fw); // Add the item using the -framework option. - this->Items.push_back(Item("-framework", false)); + this->Items.emplace_back("-framework", false); cmOutputConverter converter(this->Makefile->GetStateSnapshot()); fw = converter.EscapeForShell(fw); - this->Items.push_back(Item(fw, false)); + this->Items.emplace_back(fw, false); } void cmComputeLinkInformation::AddDirectoryItem(std::string const& item) @@ -1742,7 +1742,7 @@ void cmComputeLinkInformation::GetRPath(std::vector& runtimeDirs, cmSystemTools::ConvertToUnixSlashes(d); } if (emitted.insert(d).second) { - runtimeDirs.push_back(d); + runtimeDirs.push_back(std::move(d)); } } else if (use_link_rpath) { // Do not add any path inside the source or build tree. @@ -1764,7 +1764,7 @@ void cmComputeLinkInformation::GetRPath(std::vector& runtimeDirs, cmSystemTools::ConvertToUnixSlashes(d); } if (emitted.insert(d).second) { - runtimeDirs.push_back(d); + runtimeDirs.push_back(std::move(d)); } } } diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 963c2df..18767a3 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -200,7 +200,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) std::vector configs; depender->Makefile->GetConfigurations(configs); if (configs.empty()) { - configs.push_back(""); + configs.emplace_back(); } for (std::string const& it : configs) { std::vector objectFiles; @@ -369,8 +369,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, int dependee_index = tii->second; // Add this entry to the dependency graph. - this->InitialGraph[depender_index].push_back( - cmGraphEdge(dependee_index, !linking)); + this->InitialGraph[depender_index].emplace_back(dependee_index, !linking); } } @@ -504,7 +503,7 @@ bool cmComputeTargetDepends::IntraComponent(std::vector const& cmap, for (cmGraphEdge const& edge : el) { int j = edge; if (cmap[j] == c && edge.IsStrong()) { - this->FinalGraph[i].push_back(cmGraphEdge(j, true)); + this->FinalGraph[i].emplace_back(j, true); if (!this->IntraComponent(cmap, c, j, head, emitted, visited)) { return false; } @@ -513,7 +512,7 @@ bool cmComputeTargetDepends::IntraComponent(std::vector const& cmap, // Prepend to a linear linked-list of intra-component edges. if (*head >= 0) { - this->FinalGraph[i].push_back(cmGraphEdge(*head, false)); + this->FinalGraph[i].emplace_back(*head, false); } else { this->ComponentTail[c] = i; } @@ -563,8 +562,8 @@ bool cmComputeTargetDepends::ComputeFinalDepends( for (cmGraphEdge const& ni : nl) { int dependee_component = ni; int dependee_component_head = this->ComponentHead[dependee_component]; - this->FinalGraph[depender_component_tail].push_back( - cmGraphEdge(dependee_component_head, ni.IsStrong())); + this->FinalGraph[depender_component_tail].emplace_back( + dependee_component_head, ni.IsStrong()); } } return true; diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index fd258fe..7b28857 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -631,13 +631,13 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, kCMAKE_TRY_COMPILE_OSX_ARCHITECTURES)) { vars.erase(kCMAKE_OSX_ARCHITECTURES); std::string flag = "-DCMAKE_OSX_ARCHITECTURES=" + std::string(tcArchs); - cmakeFlags.push_back(flag); + cmakeFlags.push_back(std::move(flag)); } for (std::string const& var : vars) { if (const char* val = this->Makefile->GetDefinition(var)) { std::string flag = "-D" + var + "=" + val; - cmakeFlags.push_back(flag); + cmakeFlags.push_back(std::move(flag)); } } } @@ -938,7 +938,7 @@ void cmCoreTryCompile::FindOutputFile(const std::string& targetName, // a list of directories where to search for the compilation result // at first directly in the binary dir std::vector searchDirs; - searchDirs.push_back(""); + searchDirs.emplace_back(); const char* config = this->Makefile->GetDefinition("CMAKE_TRY_COMPILE_CONFIGURATION"); @@ -946,12 +946,12 @@ void cmCoreTryCompile::FindOutputFile(const std::string& targetName, if (config && config[0]) { std::string tmp = "/"; tmp += config; - searchDirs.push_back(tmp); + searchDirs.push_back(std::move(tmp)); } searchDirs.push_back("/Debug"); #if defined(__APPLE__) std::string app = "/Debug/" + targetName + ".app"; - searchDirs.push_back(app); + searchDirs.push_back(std::move(app)); #endif searchDirs.push_back("/Development"); diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index 3d816d5..e3951c1 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -14,6 +14,7 @@ #include // IWYU pragma: keep #include +#include cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc, const std::string& config, @@ -37,10 +38,10 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc, cmSystemTools::ExpandListArgument(parsed_arg, ExpandedArg); argv.insert(argv.end(), ExpandedArg.begin(), ExpandedArg.end()); } else { - argv.push_back(parsed_arg); + argv.push_back(std::move(parsed_arg)); } } - this->CommandLines.push_back(argv); + this->CommandLines.push_back(std::move(argv)); } std::vector depends = this->CC.GetDepends(); diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 1ab3fa2..29755d9 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -303,7 +303,7 @@ void cmDependsC::ReadCacheFile() if (line != "-") { entry.QuotedLocation = line; } - cacheEntry->UnscannedEntries.push_back(entry); + cacheEntry->UnscannedEntries.push_back(std::move(entry)); } } } diff --git a/Source/cmDependsJavaParserHelper.cxx b/Source/cmDependsJavaParserHelper.cxx index f227cf2..02db119 100644 --- a/Source/cmDependsJavaParserHelper.cxx +++ b/Source/cmDependsJavaParserHelper.cxx @@ -10,6 +10,7 @@ #include #include #include +#include int cmDependsJava_yyparse(yyscan_t yyscanner); @@ -22,7 +23,7 @@ cmDependsJavaParserHelper::cmDependsJavaParserHelper() CurrentClass tl; tl.Name = "*"; - this->ClassStack.push_back(tl); + this->ClassStack.push_back(std::move(tl)); } cmDependsJavaParserHelper::~cmDependsJavaParserHelper() @@ -175,7 +176,7 @@ void cmDependsJavaParserHelper::StartClass(const char* cls) { CurrentClass cl; cl.Name = cls; - this->ClassStack.push_back(cl); + this->ClassStack.push_back(std::move(cl)); this->CurrentDepth++; } diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 0c96860..2dfba04 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -213,7 +213,7 @@ bool cmDocumentation::CheckOptions(int argc, const char* const* argv, if (argc == 1) { RequestedHelpItem help; help.HelpType = cmDocumentation::Usage; - this->RequestedHelpItems.push_back(help); + this->RequestedHelpItems.push_back(std::move(help)); return true; } @@ -352,7 +352,7 @@ bool cmDocumentation::CheckOptions(int argc, const char* const* argv, if (help.HelpType != None) { // This is a help option. See if there is a file name given. result = true; - this->RequestedHelpItems.push_back(help); + this->RequestedHelpItems.push_back(std::move(help)); } } return result; diff --git a/Source/cmDocumentationSection.cxx b/Source/cmDocumentationSection.cxx index c47f33e..439da1b 100644 --- a/Source/cmDocumentationSection.cxx +++ b/Source/cmDocumentationSection.cxx @@ -6,7 +6,7 @@ void cmDocumentationSection::Append(const char* data[][2]) { int i = 0; while (data[i][1]) { - this->Entries.push_back(cmDocumentationEntry(data[i][0], data[i][1])); + this->Entries.emplace_back(data[i][0], data[i][1]); data += 1; } } @@ -16,7 +16,7 @@ void cmDocumentationSection::Prepend(const char* data[][2]) std::vector tmp; int i = 0; while (data[i][1]) { - tmp.push_back(cmDocumentationEntry(data[i][0], data[i][1])); + tmp.emplace_back(data[i][0], data[i][1]); data += 1; } this->Entries.insert(this->Entries.begin(), tmp.begin(), tmp.end()); @@ -24,5 +24,5 @@ void cmDocumentationSection::Prepend(const char* data[][2]) void cmDocumentationSection::Append(const char* n, const char* b) { - this->Entries.push_back(cmDocumentationEntry(n, b)); + this->Entries.emplace_back(n, b); } diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx index 76374b2..77ccd30 100644 --- a/Source/cmELF.cxx +++ b/Source/cmELF.cxx @@ -547,8 +547,7 @@ cmELF::DynamicEntryList cmELFInternalImpl::GetDynamicEntries() // Copy into public array result.reserve(this->DynamicSectionEntries.size()); for (ELF_Dyn& dyn : this->DynamicSectionEntries) { - result.push_back( - std::pair(dyn.d_tag, dyn.d_un.d_val)); + result.emplace_back(dyn.d_tag, dyn.d_un.d_val); } return result; diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index bb1dda3..f7aa6e8 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -228,7 +228,7 @@ void cmExportBuildFileGenerator::HandleMissingTarget( missingTarget += dependee->GetExportName(); link_libs += missingTarget; - missingTargets.push_back(missingTarget); + missingTargets.push_back(std::move(missingTarget)); return; } // We are not appending, so all exported targets should be diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index 9913129..1e112eb 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -205,7 +205,7 @@ bool cmExportCommand::InitialPass(std::vector const& args, std::vector configurationTypes; this->Makefile->GetConfigurations(configurationTypes); if (configurationTypes.empty()) { - configurationTypes.push_back(""); + configurationTypes.emplace_back(); } for (std::string const& ct : configurationTypes) { ebfg->AddConfiguration(ct); diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 9b65e9e..1979b15 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -439,7 +439,7 @@ void cmExportInstallFileGenerator::HandleMissingTarget( missingTarget += dependee->GetExportName(); link_libs += missingTarget; - missingTargets.push_back(missingTarget); + missingTargets.push_back(std::move(missingTarget)); } else { // All exported targets should be known here and should be unique. // This is probably user-error. diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 1fc0828..258c9ca 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -413,7 +413,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() this->AppendLinkedResource(xml, sourceLinkedResourceName, this->GetEclipsePath(linkSourceDirectory), LinkToFolder); - this->SrcLinkedResources.push_back(sourceLinkedResourceName); + this->SrcLinkedResources.push_back(std::move(sourceLinkedResourceName)); } } diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 88185bd..b7ab539 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -1320,7 +1320,7 @@ bool cmFileCopier::CheckValue(std::string const& arg) std::string regex = "/"; regex += cmsys::Glob::PatternToRegex(arg, false); regex += "$"; - this->MatchRules.push_back(MatchRule(regex)); + this->MatchRules.emplace_back(regex); this->CurrentMatchRule = &*(this->MatchRules.end() - 1); if (this->CurrentMatchRule->Regex.is_valid()) { this->Doing = DoingNone; @@ -1332,7 +1332,7 @@ bool cmFileCopier::CheckValue(std::string const& arg) } } break; case DoingRegex: - this->MatchRules.push_back(MatchRule(arg)); + this->MatchRules.emplace_back(arg); this->CurrentMatchRule = &*(this->MatchRules.end() - 1); if (this->CurrentMatchRule->Regex.is_valid()) { this->Doing = DoingNone; diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx index f771150..4a467f3 100644 --- a/Source/cmFindCommon.cxx +++ b/Source/cmFindCommon.cxx @@ -314,7 +314,7 @@ void cmFindCommon::AddPathSuffix(std::string const& arg) } // Store the suffix. - this->SearchPathSuffixes.push_back(suffix); + this->SearchPathSuffixes.push_back(std::move(suffix)); } void AddTrailingSlash(std::string& s) diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index 758da2c..0af6fce 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -150,7 +150,7 @@ void cmFindLibraryCommand::AddArchitecturePath( if (use_dirX) { dirX += "/"; - this->SearchPaths.push_back(dirX); + this->SearchPaths.push_back(std::move(dirX)); } if (use_dir) { @@ -323,7 +323,7 @@ void cmFindLibraryHelper::AddName(std::string const& name) } regex += "$"; entry.Regex.compile(regex.c_str()); - this->Names.push_back(entry); + this->Names.push_back(std::move(entry)); } void cmFindLibraryHelper::SetName(std::string const& name) diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 103dc5f..293a967 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -225,7 +225,7 @@ bool cmFindPackageCommand::InitialPass(std::vector const& args, std::set optionalComponents; // Always search directly in a generated path. - this->SearchPathSuffixes.push_back(""); + this->SearchPathSuffixes.emplace_back(); // Parse the arguments. enum Doing @@ -523,7 +523,7 @@ bool cmFindPackageCommand::InitialPass(std::vector const& args, config = cmSystemTools::LowerCase(n); config += "-config.cmake"; - this->Configs.push_back(config); + this->Configs.push_back(std::move(config)); } } @@ -1484,7 +1484,7 @@ bool cmFindPackageCommand::CheckVersion(std::string const& config_file) ConfigFileInfo configFileInfo; configFileInfo.filename = config_file; configFileInfo.version = version; - this->ConsideredConfigs.push_back(configFileInfo); + this->ConsideredConfigs.push_back(std::move(configFileInfo)); return result; } diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx index 2059b3d..1c63428 100644 --- a/Source/cmFindProgramCommand.cxx +++ b/Source/cmFindProgramCommand.cxx @@ -22,7 +22,7 @@ struct cmFindProgramHelper this->Extensions.push_back(".exe"); #endif // Consider original name with no extensions. - this->Extensions.push_back(""); + this->Extensions.emplace_back(); } // List of valid extensions. diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx index c988969..c544141 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.cxx +++ b/Source/cmGeneratorExpressionEvaluationFile.cxx @@ -155,7 +155,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(cmLocalGenerator* lg) lg->GetMakefile()->GetConfigurations(allConfigs); if (allConfigs.empty()) { - allConfigs.push_back(""); + allConfigs.emplace_back(); } std::vector enabledLanguages; diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index c73d486..dbc6840 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -132,9 +132,8 @@ std::string GeneratorExpressionContent::EvaluateParameters( int counter = 1; for (; pit != pend; ++pit, ++counter) { if (acceptsArbitraryContent && counter == numExpected) { - std::string lastParam = this->ProcessArbitraryContent( - node, identifier, context, dagChecker, pit); - parameters.push_back(lastParam); + parameters.push_back(this->ProcessArbitraryContent( + node, identifier, context, dagChecker, pit)); return std::string(); } std::string parameter; @@ -148,7 +147,7 @@ std::string GeneratorExpressionContent::EvaluateParameters( return std::string(); } } - parameters.push_back(parameter); + parameters.push_back(std::move(parameter)); } } diff --git a/Source/cmGeneratorExpressionLexer.cxx b/Source/cmGeneratorExpressionLexer.cxx index 931fd4d..95c79c1 100644 --- a/Source/cmGeneratorExpressionLexer.cxx +++ b/Source/cmGeneratorExpressionLexer.cxx @@ -12,8 +12,7 @@ static void InsertText(const char* upto, const char* c, std::vector& result) { if (upto != c) { - result.push_back(cmGeneratorExpressionToken( - cmGeneratorExpressionToken::Text, upto, c - upto)); + result.emplace_back(cmGeneratorExpressionToken::Text, upto, c - upto); } } @@ -30,8 +29,8 @@ std::vector cmGeneratorExpressionLexer::Tokenize( case '$': if (c[1] == '<') { InsertText(upto, c, result); - result.push_back(cmGeneratorExpressionToken( - cmGeneratorExpressionToken::BeginExpression, c, 2)); + result.emplace_back(cmGeneratorExpressionToken::BeginExpression, c, + 2); upto = c + 2; ++c; SawBeginExpression = true; @@ -39,21 +38,18 @@ std::vector cmGeneratorExpressionLexer::Tokenize( break; case '>': InsertText(upto, c, result); - result.push_back(cmGeneratorExpressionToken( - cmGeneratorExpressionToken::EndExpression, c, 1)); + result.emplace_back(cmGeneratorExpressionToken::EndExpression, c, 1); upto = c + 1; SawGeneratorExpression = SawBeginExpression; break; case ':': InsertText(upto, c, result); - result.push_back(cmGeneratorExpressionToken( - cmGeneratorExpressionToken::ColonSeparator, c, 1)); + result.emplace_back(cmGeneratorExpressionToken::ColonSeparator, c, 1); upto = c + 1; break; case ',': InsertText(upto, c, result); - result.push_back(cmGeneratorExpressionToken( - cmGeneratorExpressionToken::CommaSeparator, c, 1)); + result.emplace_back(cmGeneratorExpressionToken::CommaSeparator, c, 1); upto = c + 1; break; default: diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 4eddd15..ef3dc10 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -445,7 +445,7 @@ void cmGeneratorTarget::ComputeObjectMapping() std::vector configs; this->Makefile->GetConfigurations(configs); if (configs.empty()) { - configs.push_back(""); + configs.emplace_back(); } for (std::string const& c : configs) { std::vector sourceFiles; @@ -1101,8 +1101,7 @@ void cmGeneratorTarget::ComputeKindedSources(KindedSources& files, } // Save this classified source file in the result vector. - SourceAndKind entry = { sf, kind }; - files.Sources.push_back(entry); + files.Sources.push_back({ sf, kind }); } if (!badObjLib.empty()) { @@ -1143,7 +1142,7 @@ void cmGeneratorTarget::ComputeAllConfigSources() const AllConfigSource acs; acs.Source = src.Source; acs.Kind = src.Kind; - this->AllConfigSources.push_back(acs); + this->AllConfigSources.push_back(std::move(acs)); std::map::value_type entry( src.Source, this->AllConfigSources.size() - 1); mi = index.insert(entry).first; @@ -2113,7 +2112,7 @@ cmTargetTraceDependencies::cmTargetTraceDependencies(cmGeneratorTarget* target) std::vector configs; this->Makefile->GetConfigurations(configs); if (configs.empty()) { - configs.push_back(""); + configs.emplace_back(); } std::set emitted; for (std::string const& c : configs) { @@ -2306,7 +2305,7 @@ void cmTargetTraceDependencies::CheckCustomCommand(cmCustomCommand const& cc) std::set emitted; this->Makefile->GetConfigurations(configs); if (configs.empty()) { - configs.push_back(""); + configs.emplace_back(); } for (std::string const& conf : configs) { this->FollowCommandDepends(cc, conf, emitted); @@ -4201,7 +4200,7 @@ void cmGeneratorTarget::LookupLinkItems(std::vector const& names, if (name == this->GetName() || name.empty()) { continue; } - items.push_back(cmLinkItem(name, this->FindTargetToLink(name))); + items.emplace_back(name, this->FindTargetToLink(name)); } } @@ -4988,7 +4987,7 @@ bool cmGeneratorTarget::GetConfigCommonSourceFiles( std::vector configs; this->Makefile->GetConfigurations(configs); if (configs.empty()) { - configs.push_back(""); + configs.emplace_back(); } std::vector::const_iterator it = configs.begin(); @@ -5276,8 +5275,8 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries( } // The entry is meant for this configuration. - impl.Libraries.push_back(cmLinkImplItem( - name, this->FindTargetToLink(name), *btIt, evaluated != *le)); + impl.Libraries.emplace_back(name, this->FindTargetToLink(name), *btIt, + evaluated != *le); } std::set const& seenProps = cge->GetSeenTargetProperties(); @@ -5304,8 +5303,8 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries( continue; } // Support OLD behavior for CMP0003. - impl.WrongConfigLibraries.push_back( - cmLinkItem(name, this->FindTargetToLink(name))); + impl.WrongConfigLibraries.emplace_back(name, + this->FindTargetToLink(name)); } } } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 47a9390..82c5920 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2293,9 +2293,8 @@ void cmGlobalGenerator::AddGlobalTarget_Package( singleLine.push_back(cmakeCfgIntDir); } singleLine.push_back("--config"); - std::string relConfigFile = "./CPackConfig.cmake"; - singleLine.push_back(relConfigFile); - gti.CommandLines.push_back(singleLine); + singleLine.push_back("./CPackConfig.cmake"); + gti.CommandLines.push_back(std::move(singleLine)); if (this->GetPreinstallTargetName()) { gti.Depends.push_back(this->GetPreinstallTargetName()); } else { @@ -2305,7 +2304,7 @@ void cmGlobalGenerator::AddGlobalTarget_Package( gti.Depends.push_back(this->GetAllTargetName()); } } - targets.push_back(gti); + targets.push_back(std::move(gti)); } void cmGlobalGenerator::AddGlobalTarget_PackageSource( @@ -2339,11 +2338,10 @@ void cmGlobalGenerator::AddGlobalTarget_PackageSource( cmCustomCommandLine singleLine; singleLine.push_back(cmSystemTools::GetCPackCommand()); singleLine.push_back("--config"); - std::string relConfigFile = "./CPackSourceConfig.cmake"; - singleLine.push_back(relConfigFile); - singleLine.push_back(configFile); - gti.CommandLines.push_back(singleLine); - targets.push_back(gti); + singleLine.push_back("./CPackSourceConfig.cmake"); + singleLine.push_back(std::move(configFile)); + gti.CommandLines.push_back(std::move(singleLine)); + targets.push_back(std::move(gti)); } void cmGlobalGenerator::AddGlobalTarget_Test( @@ -2378,58 +2376,59 @@ void cmGlobalGenerator::AddGlobalTarget_Test( { singleLine.push_back("$(ARGS)"); } - gti.CommandLines.push_back(singleLine); - targets.push_back(gti); + gti.CommandLines.push_back(std::move(singleLine)); + targets.push_back(std::move(gti)); } void cmGlobalGenerator::AddGlobalTarget_EditCache( std::vector& targets) { const char* editCacheTargetName = this->GetEditCacheTargetName(); - if (editCacheTargetName) { - GlobalTargetInfo gti; - gti.Name = editCacheTargetName; - cmCustomCommandLine singleLine; - - // Use generator preference for the edit_cache rule if it is defined. - std::string edit_cmd = this->GetEditCacheCommand(); - if (!edit_cmd.empty()) { - singleLine.push_back(edit_cmd); - singleLine.push_back("-H$(CMAKE_SOURCE_DIR)"); - singleLine.push_back("-B$(CMAKE_BINARY_DIR)"); - gti.Message = "Running CMake cache editor..."; - gti.UsesTerminal = true; - gti.CommandLines.push_back(singleLine); - } else { - singleLine.push_back(cmSystemTools::GetCMakeCommand()); - singleLine.push_back("-E"); - singleLine.push_back("echo"); - singleLine.push_back("No interactive CMake dialog available."); - gti.Message = "No interactive CMake dialog available..."; - gti.UsesTerminal = false; - gti.CommandLines.push_back(singleLine); - } + if (!editCacheTargetName) { + return; + } + GlobalTargetInfo gti; + gti.Name = editCacheTargetName; + cmCustomCommandLine singleLine; - targets.push_back(gti); + // Use generator preference for the edit_cache rule if it is defined. + std::string edit_cmd = this->GetEditCacheCommand(); + if (!edit_cmd.empty()) { + singleLine.push_back(std::move(edit_cmd)); + singleLine.push_back("-H$(CMAKE_SOURCE_DIR)"); + singleLine.push_back("-B$(CMAKE_BINARY_DIR)"); + gti.Message = "Running CMake cache editor..."; + gti.UsesTerminal = true; + } else { + singleLine.push_back(cmSystemTools::GetCMakeCommand()); + singleLine.push_back("-E"); + singleLine.push_back("echo"); + singleLine.push_back("No interactive CMake dialog available."); + gti.Message = "No interactive CMake dialog available..."; + gti.UsesTerminal = false; } + gti.CommandLines.push_back(std::move(singleLine)); + + targets.push_back(std::move(gti)); } void cmGlobalGenerator::AddGlobalTarget_RebuildCache( std::vector& targets) { const char* rebuildCacheTargetName = this->GetRebuildCacheTargetName(); - if (rebuildCacheTargetName) { - GlobalTargetInfo gti; - gti.Name = rebuildCacheTargetName; - gti.Message = "Running CMake to regenerate build system..."; - gti.UsesTerminal = true; - cmCustomCommandLine singleLine; - singleLine.push_back(cmSystemTools::GetCMakeCommand()); - singleLine.push_back("-H$(CMAKE_SOURCE_DIR)"); - singleLine.push_back("-B$(CMAKE_BINARY_DIR)"); - gti.CommandLines.push_back(singleLine); - targets.push_back(gti); + if (!rebuildCacheTargetName) { + return; } + GlobalTargetInfo gti; + gti.Name = rebuildCacheTargetName; + gti.Message = "Running CMake to regenerate build system..."; + gti.UsesTerminal = true; + cmCustomCommandLine singleLine; + singleLine.push_back(cmSystemTools::GetCMakeCommand()); + singleLine.push_back("-H$(CMAKE_SOURCE_DIR)"); + singleLine.push_back("-B$(CMAKE_BINARY_DIR)"); + gti.CommandLines.push_back(std::move(singleLine)); + targets.push_back(std::move(gti)); } void cmGlobalGenerator::AddGlobalTarget_Install( @@ -2457,7 +2456,7 @@ void cmGlobalGenerator::AddGlobalTarget_Install( gti.Name = "list_install_components"; gti.Message = ostr.str(); gti.UsesTerminal = false; - targets.push_back(gti); + targets.push_back(std::move(gti)); } std::string cmd = cmSystemTools::GetCMakeCommand(); GlobalTargetInfo gti; @@ -2511,7 +2510,7 @@ void cmGlobalGenerator::AddGlobalTarget_Install( localCmdLine.insert(localCmdLine.begin() + 1, "-DCMAKE_INSTALL_LOCAL_ONLY=1"); - gti.CommandLines.push_back(localCmdLine); + gti.CommandLines.push_back(std::move(localCmdLine)); targets.push_back(gti); } @@ -2527,7 +2526,7 @@ void cmGlobalGenerator::AddGlobalTarget_Install( stripCmdLine.insert(stripCmdLine.begin() + 1, "-DCMAKE_INSTALL_DO_STRIP=1"); - gti.CommandLines.push_back(stripCmdLine); + gti.CommandLines.push_back(std::move(stripCmdLine)); targets.push_back(gti); } } @@ -2971,7 +2970,7 @@ void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target) std::vector configs; target->Target->GetMakefile()->GetConfigurations(configs); if (configs.empty()) { - configs.push_back(""); + configs.emplace_back(); } for (std::string const& c : configs) { target->GetSourceFiles(sources, c); diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 4f546bb..eff2e53 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -1727,7 +1727,7 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile( info.Requires.push_back(ddi_require.asString()); } } - objects.push_back(info); + objects.push_back(std::move(info)); } // Map from module name to module file path, if known. diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 236bb3d..d6307eb 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -420,7 +420,7 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRule2( std::string tname = lg->GetRelativeTargetDirectory(gtarget); tname += "/"; tname += pass; - depends.push_back(tname); + depends.push_back(std::move(tname)); } } } @@ -432,7 +432,7 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRule2( std::string subdir = c.GetDirectory().GetCurrentBinary(); subdir += "/"; subdir += pass; - depends.push_back(subdir); + depends.push_back(std::move(subdir)); } // Work-around for makes that drop rules that have no dependencies @@ -513,7 +513,7 @@ void cmGlobalUnixMakefileGenerator3::GenerateBuildCommand( tname = conv.ConvertToRelativePath(mf->GetState()->GetBinaryDirectory(), tname); cmSystemTools::ConvertToOutputSlashes(tname); - makeCommand.push_back(tname); + makeCommand.push_back(std::move(tname)); if (this->Makefiles.empty()) { delete mf; } diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index e684f5e..1bbfbe0 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -224,11 +224,11 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName, ignoreTargetsRegExVector); for (std::string const& currentRegexString : ignoreTargetsRegExVector) { cmsys::RegularExpression currentRegex; - if (!currentRegex.compile(currentRegexString.c_str())) { + if (!currentRegex.compile(currentRegexString)) { std::cerr << "Could not compile bad regex \"" << currentRegexString << "\"" << std::endl; } - this->TargetsToIgnoreRegex.push_back(currentRegex); + this->TargetsToIgnoreRegex.push_back(std::move(currentRegex)); } } } diff --git a/Source/cmIncludeDirectoryCommand.cxx b/Source/cmIncludeDirectoryCommand.cxx index 7bd6cb9..045926a 100644 --- a/Source/cmIncludeDirectoryCommand.cxx +++ b/Source/cmIncludeDirectoryCommand.cxx @@ -97,7 +97,7 @@ void cmIncludeDirectoryCommand::GetIncludes(const std::string& arg, std::string inc = arg.substr(lastPos, pos); this->NormalizeInclude(inc); if (!inc.empty()) { - incs.push_back(inc); + incs.push_back(std::move(inc)); } } lastPos = pos + 1; @@ -105,7 +105,7 @@ void cmIncludeDirectoryCommand::GetIncludes(const std::string& arg, std::string inc = arg.substr(lastPos); this->NormalizeInclude(inc); if (!inc.empty()) { - incs.push_back(inc); + incs.push_back(std::move(inc)); } } diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 685fc67..208f0ad 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -5,6 +5,7 @@ #include "cmsys/Glob.hxx" #include #include +#include #include "cmAlgorithms.h" #include "cmCommandArgumentsHelper.h" @@ -1061,7 +1062,7 @@ bool cmInstallCommand::HandleDirectoryMode( } // Store the directory for installation. - dirs.push_back(dir); + dirs.push_back(std::move(dir)); } else if (doing == DoingConfigurations) { configurations.push_back(args[i]); } else if (doing == DoingDestination) { @@ -1133,7 +1134,7 @@ bool cmInstallCommand::HandleDirectoryMode( // Support installing an empty directory. if (dirs.empty() && destination) { - dirs.push_back(""); + dirs.emplace_back(); } // Check if there is something to do. @@ -1388,7 +1389,7 @@ bool cmInstallCommand::MakeFilesFullPath( return false; } // Store the file for installation. - absFiles.push_back(file); + absFiles.push_back(std::move(file)); } return true; } diff --git a/Source/cmInstallCommandArguments.cxx b/Source/cmInstallCommandArguments.cxx index 12abac8..7b79ab5 100644 --- a/Source/cmInstallCommandArguments.cxx +++ b/Source/cmInstallCommandArguments.cxx @@ -4,6 +4,8 @@ #include "cmSystemTools.h" +#include + // Table of valid permissions. const char* cmInstallCommandArguments::PermissionsTable[] = { "OWNER_READ", "OWNER_WRITE", "OWNER_EXECUTE", "GROUP_READ", @@ -200,6 +202,6 @@ void cmInstallCommandIncludesArgument::Parse( for (; it != args->end(); ++it) { std::string dir = *it; cmSystemTools::ConvertToUnixSlashes(dir); - this->IncludeDirs.push_back(dir); + this->IncludeDirs.push_back(std::move(dir)); } } diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx index 4a3b620..4b49444 100644 --- a/Source/cmInstallFilesCommand.cxx +++ b/Source/cmInstallFilesCommand.cxx @@ -30,8 +30,7 @@ bool cmInstallFilesCommand::InitialPass(std::vector const& args, for (std::vector::const_iterator s = args.begin() + 2; s != args.end(); ++s) { // Find the source location for each file listed. - std::string f = this->FindInstallSource(s->c_str()); - this->Files.push_back(f); + this->Files.push_back(this->FindInstallSource(s->c_str())); } this->CreateInstallGenerator(); } else { diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 814dc4f..a9b4908 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -132,8 +132,8 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( if (this->ImportLibrary) { std::string from1 = fromDirConfig + targetNameImport; std::string to1 = toDir + targetNameImport; - filesFrom.push_back(from1); - filesTo.push_back(to1); + filesFrom.push_back(std::move(from1)); + filesTo.push_back(std::move(to1)); std::string targetNameImportLib; if (this->Target->GetImplibGNUtoMS(targetNameImport, targetNameImportLib)) { @@ -176,13 +176,13 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( if (targetNameReal != targetName) { std::string from2 = fromDirConfig + targetNameReal; std::string to2 = toDir += targetNameReal; - filesFrom.push_back(from2); - filesTo.push_back(to2); + filesFrom.push_back(std::move(from2)); + filesTo.push_back(std::move(to2)); } } - filesFrom.push_back(from1); - filesTo.push_back(to1); + filesFrom.push_back(std::move(from1)); + filesTo.push_back(std::move(to1)); } } else { std::string targetName; @@ -198,8 +198,8 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( std::string from1 = fromDirConfig + targetNameImport; std::string to1 = toDir + targetNameImport; - filesFrom.push_back(from1); - filesTo.push_back(to1); + filesFrom.push_back(std::move(from1)); + filesTo.push_back(std::move(to1)); std::string targetNameImportLib; if (this->Target->GetImplibGNUtoMS(targetNameImport, targetNameImportLib)) { @@ -223,8 +223,8 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( // Tweaks apply to the binary inside the bundle. std::string to1 = toDir + targetNameReal; - filesFrom.push_back(from1); - filesTo.push_back(to1); + filesFrom.push_back(std::move(from1)); + filesTo.push_back(std::move(to1)); } else if (this->Target->IsCFBundleOnApple()) { // Install the whole app bundle directory. type = cmInstallType_DIRECTORY; @@ -235,8 +235,8 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( std::string from1 = fromDirConfig + targetNameBase; std::string to1 = toDir + targetName; - filesFrom.push_back(from1); - filesTo.push_back(to1); + filesFrom.push_back(std::move(from1)); + filesTo.push_back(std::move(to1)); } else { bool haveNamelink = false; diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index cbcf200..64e634f 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -252,8 +252,7 @@ bool cmListFileParser::ParseFunction(const char* name, long line) bool cmListFileParser::AddArgument(cmListFileLexer_Token* token, cmListFileArgument::Delimiter delim) { - cmListFileArgument a(token->text, delim, token->line); - this->Function.Arguments.push_back(a); + this->Function.Arguments.emplace_back(token->text, delim, token->line); if (this->Separation == SeparationOkay) { return true; } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 86b16f8..859aa44 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -207,7 +207,7 @@ void cmLocalGenerator::TraceDependencies() std::vector configs; this->Makefile->GetConfigurations(configs); if (configs.empty()) { - configs.push_back(""); + configs.emplace_back(); } for (std::string const& c : configs) { this->GlobalGenerator->CreateEvaluationSourceFiles(c); @@ -602,7 +602,7 @@ void cmLocalGenerator::ComputeTargetManifest() std::vector configNames; this->Makefile->GetConfigurations(configNames); if (configNames.empty()) { - configNames.push_back(""); + configNames.emplace_back(); } // Add our targets to the manifest for each configuration. @@ -623,7 +623,7 @@ bool cmLocalGenerator::ComputeTargetCompileFeatures() std::vector configNames; this->Makefile->GetConfigurations(configNames); if (configNames.empty()) { - configNames.push_back(""); + configNames.emplace_back(); } // Process compile features of all targets. @@ -906,7 +906,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, for (std::string const& i : impDirVec) { std::string d = rootPath + i; cmSystemTools::ConvertToUnixSlashes(d); - emitted.insert(d); + emitted.insert(std::move(d)); if (!stripImplicitInclDirs) { implicitDirs.push_back(i); } @@ -2002,7 +2002,7 @@ void cmLocalGenerator::AppendIncludeDirectories( } if (uniqueIncludes.insert(inc).second) { - includes.push_back(inc); + includes.push_back(std::move(inc)); } } } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index e2d5322..ff3fcfd 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -191,7 +191,7 @@ void cmLocalUnixMakefileGenerator3::GetLocalObjectFiles( } LocalObjectInfo& info = localObjectFiles[objectName]; info.HasSourceExtension = hasSourceExtension; - info.push_back(LocalObjectEntry(gt, sf->GetLanguage())); + info.emplace_back(gt, sf->GetLanguage()); } } } @@ -750,11 +750,11 @@ void cmLocalUnixMakefileGenerator3::WriteSpecialTargetsTop( static_cast(this->GlobalGenerator); std::string hack = gg->GetEmptyRuleHackDepends(); if (!hack.empty()) { - no_depends.push_back(hack); + no_depends.push_back(std::move(hack)); } std::string hack_cmd = gg->GetEmptyRuleHackCommand(); if (!hack_cmd.empty()) { - no_commands.push_back(hack_cmd); + no_commands.push_back(std::move(hack_cmd)); } // Special symbolic target that never exists to force dependers to @@ -788,7 +788,7 @@ void cmLocalUnixMakefileGenerator3::WriteSpecialTargetsBottom( std::vector no_depends; std::vector commands; - commands.push_back(runRule); + commands.push_back(std::move(runRule)); if (!this->IsRootMakefile()) { this->CreateCDCommand(commands, this->GetBinaryDirectory(), this->GetCurrentBinaryDirectory()); @@ -888,7 +888,7 @@ void cmLocalUnixMakefileGenerator3::AppendCustomDepend( // Lookup the real name of the dependency in case it is a CMake target. std::string dep; if (this->GetRealDependency(d, this->ConfigName, dep)) { - depends.push_back(dep); + depends.push_back(std::move(dep)); } } } @@ -1037,7 +1037,7 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand( cmd = "echo >nul && " + cmd; } } - commands1.push_back(cmd); + commands1.push_back(std::move(cmd)); } } @@ -1075,12 +1075,14 @@ void cmLocalUnixMakefileGenerator3::AppendCleanCommand( } fout << ")\n"; } - std::string remove = "$(CMAKE_COMMAND) -P "; - remove += this->ConvertToOutputFormat( - this->MaybeConvertToRelativePath(this->GetCurrentBinaryDirectory(), - cleanfile), - cmOutputConverter::SHELL); - commands.push_back(remove); + { + std::string remove = "$(CMAKE_COMMAND) -P "; + remove += this->ConvertToOutputFormat( + this->MaybeConvertToRelativePath(this->GetCurrentBinaryDirectory(), + cleanfile), + cmOutputConverter::SHELL); + commands.push_back(std::move(remove)); + } // For the main clean rule add per-language cleaning. if (!filename) { @@ -1158,7 +1160,7 @@ void cmLocalUnixMakefileGenerator3::AppendEcho( } cmd += this->EscapeForShell(line); } - commands.push_back(cmd); + commands.push_back(std::move(cmd)); } // Reset the line to empty. @@ -1675,13 +1677,15 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules( commands.clear(); std::string cmakefileName = cmake::GetCMakeFilesDirectoryPostSlash(); cmakefileName += "Makefile.cmake"; - std::string runRule = - "$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)"; - runRule += " --check-build-system "; - runRule += - this->ConvertToOutputFormat(cmakefileName, cmOutputConverter::SHELL); - runRule += " 1"; - commands.push_back(runRule); + { + std::string runRule = + "$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)"; + runRule += " --check-build-system "; + runRule += + this->ConvertToOutputFormat(cmakefileName, cmOutputConverter::SHELL); + runRule += " 1"; + commands.push_back(std::move(runRule)); + } this->CreateCDCommand(commands, this->GetBinaryDirectory(), this->GetCurrentBinaryDirectory()); this->WriteMakeRule(ruleFileStream, "clear depends", "depend", depends, @@ -2066,7 +2070,7 @@ void cmLocalUnixMakefileGenerator3::CreateCDCommand( // Change back to the starting directory. cmd = cd_cmd; cmd += this->ConvertToOutputForExisting(relDir); - commands.push_back(cmd); + commands.push_back(std::move(cmd)); } else { // On UNIX we must construct a single shell command to change // directory and build because make resets the directory between diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 74a1da0..07943e3 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -4,6 +4,7 @@ #include #include +#include #include "cmAlgorithms.h" #include "cmExecutionStatus.h" @@ -131,7 +132,7 @@ bool cmMacroHelperCommand::InvokeInitialPass( } arg.Delim = k.Delim; arg.Line = k.Line; - newLFF.Arguments.push_back(arg); + newLFF.Arguments.push_back(std::move(arg)); } cmExecutionStatus status; if (!this->Makefile->ExecuteCommand(newLFF, status) || diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index c12cd9e..bf0720e 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -20,7 +20,7 @@ #include "cmCustomCommand.h" #include "cmCustomCommandLines.h" #include "cmExecutionStatus.h" -#include "cmExpandedCommandArgument.h" +#include "cmExpandedCommandArgument.h" // IWYU pragma: keep #include "cmFileLockPool.h" #include "cmFunctionBlocker.h" #include "cmGeneratorExpression.h" @@ -95,8 +95,7 @@ cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator, this->AddSourceGroup("Object Files", "\\.(lo|o|obj)$"); this->ObjectLibrariesSourceGroupIndex = this->SourceGroups.size(); - this->SourceGroups.push_back( - cmSourceGroup("Object Libraries", "^MATCH_NO_SOURCES$")); + this->SourceGroups.emplace_back("Object Libraries", "^MATCH_NO_SOURCES$"); #endif } @@ -1032,7 +1031,7 @@ cmTarget* cmMakefile::AddUtilityCommand( commandLine.push_back(arg4); } cmCustomCommandLines commandLines; - commandLines.push_back(commandLine); + commandLines.push_back(std::move(commandLine)); // Call the real signature of this method. return this->AddUtilityCommand(utilityName, origin, excludeFromAll, @@ -1480,8 +1479,8 @@ void cmMakefile::Configure() if (!hasProject) { cmListFileFunction project; project.Name = "PROJECT"; - cmListFileArgument prj("Project", cmListFileArgument::Unquoted, 0); - project.Arguments.push_back(prj); + project.Arguments.emplace_back("Project", cmListFileArgument::Unquoted, + 0); listFile.Functions.insert(listFile.Functions.begin(), project); } } @@ -3033,7 +3032,7 @@ bool cmMakefile::ExpandArguments( for (cmListFileArgument const& i : inArgs) { // No expansion in a bracket argument. if (i.Delim == cmListFileArgument::Bracket) { - outArgs.push_back(cmExpandedCommandArgument(i.Value, true)); + outArgs.emplace_back(i.Value, true); continue; } // Expand the variables in the argument. @@ -3044,12 +3043,12 @@ bool cmMakefile::ExpandArguments( // If the argument is quoted, it should be one argument. // Otherwise, it may be a list of arguments. if (i.Delim == cmListFileArgument::Quoted) { - outArgs.push_back(cmExpandedCommandArgument(value, true)); + outArgs.emplace_back(value, true); } else { std::vector stringArgs; cmSystemTools::ExpandListArgument(value, stringArgs); for (std::string const& stringArg : stringArgs) { - outArgs.push_back(cmExpandedCommandArgument(stringArg, false)); + outArgs.emplace_back(stringArg, false); } } } diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 90d8c7f..ebc771b 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -617,7 +617,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL); cmakeCommand += " -E __run_co_compile --lwyu="; cmakeCommand += targetOutPathReal; - real_link_commands.push_back(cmakeCommand); + real_link_commands.push_back(std::move(cmakeCommand)); } std::string launcher; @@ -666,7 +666,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) symlink += targetOutPathReal; symlink += " "; symlink += targetOutPath; - commands1.push_back(symlink); + commands1.push_back(std::move(symlink)); this->LocalGenerator->CreateCDCommand( commands1, this->Makefile->GetCurrentBinaryDirectory(), this->LocalGenerator->GetBinaryDirectory()); diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index ab15daf..cb99b3e 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -897,7 +897,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( std::string cmd = launcher + acc; rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator, cmd, vars); - real_link_commands.push_back(cmd); + real_link_commands.push_back(std::move(cmd)); } } // Append to the archive with the other object sets. @@ -907,7 +907,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( std::string cmd = launcher + aac; rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator, cmd, vars); - real_link_commands.push_back(cmd); + real_link_commands.push_back(std::move(cmd)); } } // Finish the archive. @@ -918,7 +918,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( vars); // If there is no ranlib the command will be ":". Skip it. if (!cmd.empty() && cmd[0] != ':') { - real_link_commands.push_back(cmd); + real_link_commands.push_back(std::move(cmd)); } } } else { @@ -931,7 +931,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL); cmakeCommand += " -E __run_co_compile --lwyu="; cmakeCommand += targetOutPathReal; - real_link_commands.push_back(cmakeCommand); + real_link_commands.push_back(std::move(cmakeCommand)); } // Expand placeholders. @@ -972,7 +972,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( symlink += targetOutPathSO; symlink += " "; symlink += targetOutPath; - commands1.push_back(symlink); + commands1.push_back(std::move(symlink)); this->LocalGenerator->CreateCDCommand( commands1, this->Makefile->GetCurrentBinaryDirectory(), this->LocalGenerator->GetBinaryDirectory()); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 5d80e77..fc39365 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -327,7 +327,7 @@ void cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator()( copyCommand += " "; copyCommand += this->Generator->LocalGenerator->ConvertToOutputFormat( output, cmOutputConverter::SHELL); - commands.push_back(copyCommand); + commands.push_back(std::move(copyCommand)); this->Generator->LocalGenerator->WriteMakeRule( *this->Generator->BuildFileStream, nullptr, output, depends, commands, false); @@ -797,7 +797,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( } else { std::string cmd = "$(CMAKE_COMMAND) -E cmake_unimplemented_variable "; cmd += preprocessRuleVar; - commands.push_back(cmd); + commands.push_back(std::move(cmd)); } this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, nullptr, @@ -844,7 +844,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( } else { std::string cmd = "$(CMAKE_COMMAND) -E cmake_unimplemented_variable "; cmd += assemblyRuleVar; - commands.push_back(cmd); + commands.push_back(std::move(cmd)); } this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, nullptr, @@ -1345,12 +1345,12 @@ void cmMakefileTargetGenerator::AppendObjectDepends( std::vector& depends) { // Add dependencies on the compiled object files. - std::string relPath = this->LocalGenerator->GetHomeRelativeOutputPath(); - std::string objTarget; + std::string const& relPath = + this->LocalGenerator->GetHomeRelativeOutputPath(); for (std::string const& obj : this->Objects) { - objTarget = relPath; + std::string objTarget = relPath; objTarget += obj; - depends.push_back(objTarget); + depends.push_back(std::move(objTarget)); } // Add dependencies on the external object files. @@ -1441,8 +1441,8 @@ void cmMakefileTargetGenerator::CreateLinkScript( this->LocalGenerator->GetCurrentBinaryDirectory(), linkScriptName), cmOutputConverter::SHELL); link_command += " --verbose=$(VERBOSE)"; - makefile_commands.push_back(link_command); - makefile_depends.push_back(linkScriptName); + makefile_commands.push_back(std::move(link_command)); + makefile_depends.push_back(std::move(linkScriptName)); } bool cmMakefileTargetGenerator::CheckUseResponseFileForObjects( @@ -1514,7 +1514,7 @@ std::string cmMakefileTargetGenerator::CreateResponseFile( // Add a dependency so the target will rebuild when the set of // objects changes. - makefile_depends.push_back(responseFileNameFull); + makefile_depends.push_back(std::move(responseFileNameFull)); // Construct the name to be used on the command line. std::string responseFileName = this->TargetBuildDirectory; diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx index 46df0d8..dbc0bc6 100644 --- a/Source/cmMakefileUtilityTargetGenerator.cxx +++ b/Source/cmMakefileUtilityTargetGenerator.cxx @@ -4,6 +4,7 @@ #include #include +#include #include #include "cmGeneratedFileStream.h" @@ -90,7 +91,7 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles() if (depends.empty() && commands.empty()) { std::string hack = this->GlobalGenerator->GetEmptyRuleHackDepends(); if (!hack.empty()) { - depends.push_back(hack); + depends.push_back(std::move(hack)); } } diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 594e0f5..eb595ba 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -498,13 +498,12 @@ std::vector cmNinjaNormalTargetGenerator::ComputeLinkCmd() cmakeCommand += " -E __run_co_compile --lwyu="; cmGeneratorTarget& gt = *this->GetGeneratorTarget(); const std::string cfgName = this->GetConfigName(); - std::string targetOutput = ConvertToNinjaPath(gt.GetFullPath(cfgName)); std::string targetOutputReal = this->ConvertToNinjaPath( gt.GetFullPath(cfgName, cmStateEnums::RuntimeBinaryArtifact, /*realname=*/true)); cmakeCommand += targetOutputReal; cmakeCommand += " || true"; - linkCmds.push_back(cmakeCommand); + linkCmds.push_back(std::move(cmakeCommand)); } return linkCmds; } @@ -978,7 +977,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() std::string obj_list_file = mdi->DefFile + ".objs"; cmd += this->GetLocalGenerator()->ConvertToOutputFormat( obj_list_file, cmOutputConverter::SHELL); - preLinkCmdLines.push_back(cmd); + preLinkCmdLines.push_back(std::move(cmd)); // create a list of obj files for the -E __create_def to read cmGeneratedFileStream fout(obj_list_file.c_str()); diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index a442463..3f0c42e 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -1188,7 +1188,7 @@ void cmNinjaTargetGenerator::MacOSXContentGeneratorType::operator()( output); // Add as a dependency to the target so that it gets called. - this->Generator->ExtraFiles.push_back(output); + this->Generator->ExtraFiles.push_back(std::move(output)); } void cmNinjaTargetGenerator::addPoolNinjaVariable( diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx index ae1fdfa..923d5ab 100644 --- a/Source/cmQTWrapCPPCommand.cxx +++ b/Source/cmQTWrapCPPCommand.cxx @@ -7,6 +7,8 @@ #include "cmSourceFile.h" #include "cmSystemTools.h" +#include + class cmExecutionStatus; // cmQTWrapCPPCommand @@ -71,7 +73,7 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector const& args, commandLine.push_back(hname); cmCustomCommandLines commandLines; - commandLines.push_back(commandLine); + commandLines.push_back(std::move(commandLine)); std::vector depends; depends.push_back(moc_exe); diff --git a/Source/cmQTWrapUICommand.cxx b/Source/cmQTWrapUICommand.cxx index 3d586d6..bbd80f9 100644 --- a/Source/cmQTWrapUICommand.cxx +++ b/Source/cmQTWrapUICommand.cxx @@ -7,6 +7,8 @@ #include "cmSourceFile.h" #include "cmSystemTools.h" +#include + class cmExecutionStatus; // cmQTWrapUICommand @@ -86,7 +88,7 @@ bool cmQTWrapUICommand::InitialPass(std::vector const& args, hCommand.push_back(hName); hCommand.push_back(uiName); cmCustomCommandLines hCommandLines; - hCommandLines.push_back(hCommand); + hCommandLines.push_back(std::move(hCommand)); cmCustomCommandLine cxxCommand; cxxCommand.push_back(uic_exe); @@ -96,7 +98,7 @@ bool cmQTWrapUICommand::InitialPass(std::vector const& args, cxxCommand.push_back(cxxName); cxxCommand.push_back(uiName); cmCustomCommandLines cxxCommandLines; - cxxCommandLines.push_back(cxxCommand); + cxxCommandLines.push_back(std::move(cxxCommand)); cmCustomCommandLine mocCommand; mocCommand.push_back(moc_exe); @@ -104,7 +106,7 @@ bool cmQTWrapUICommand::InitialPass(std::vector const& args, mocCommand.push_back(mocName); mocCommand.push_back(hName); cmCustomCommandLines mocCommandLines; - mocCommandLines.push_back(mocCommand); + mocCommandLines.push_back(std::move(mocCommand)); std::vector depends; depends.push_back(uiName); diff --git a/Source/cmSearchPath.cxx b/Source/cmSearchPath.cxx index a40c987..5b29868 100644 --- a/Source/cmSearchPath.cxx +++ b/Source/cmSearchPath.cxx @@ -155,7 +155,7 @@ void cmSearchPath::AddSuffixes(const std::vector& suffixes) } // And now the original w/o any suffix - this->Paths.push_back(inPath); + this->Paths.push_back(std::move(inPath)); } } @@ -212,6 +212,6 @@ void cmSearchPath::AddPathInternal(const std::string& path, const char* base) // Insert the path if has not already been emitted. if (this->FC->SearchPathsEmitted.insert(collapsed).second) { - this->Paths.push_back(collapsed); + this->Paths.push_back(std::move(collapsed)); } } diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index 371d536..df68d04 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -111,16 +111,16 @@ void getCMakeInputs(const cmGlobalGenerator* gg, const std::string& sourceDir, if (isInternal) { if (internalFiles) { - internalFiles->push_back(toAdd); + internalFiles->push_back(std::move(toAdd)); } } else { if (isTemporary) { if (tmpFiles) { - tmpFiles->push_back(toAdd); + tmpFiles->push_back(std::move(toAdd)); } } else { if (explicitFiles) { - explicitFiles->push_back(toAdd); + explicitFiles->push_back(std::move(toAdd)); } } } diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index ce08465..60df2b5 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1153,7 +1153,7 @@ void cmSystemTools::Glob(const std::string& directory, for (i = 0; i < numf; i++) { std::string fname = d.GetFile(i); if (reg.find(fname)) { - files.push_back(fname); + files.push_back(std::move(fname)); } } } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 663a4c9..33437a1 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -500,7 +500,7 @@ void cmTarget::AddSources(std::vector const& srcs) } if (!srcFiles.empty()) { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - this->Internal->SourceEntries.push_back(srcFiles); + this->Internal->SourceEntries.push_back(std::move(srcFiles)); this->Internal->SourceBacktraces.push_back(lfbt); } } @@ -747,10 +747,12 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, const std::string& lib, return; } - cmTarget::LibraryID tmp; - tmp.first = lib; - tmp.second = llt; - this->OriginalLinkLibraries.push_back(tmp); + { + cmTarget::LibraryID tmp; + tmp.first = lib; + tmp.second = llt; + this->OriginalLinkLibraries.emplace_back(lib, llt); + } // Add the explicit dependency information for this target. This is // simply a set of libraries separated by ";". There should always diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx index 9930086..e080df1 100644 --- a/Source/cmVariableWatchCommand.cxx +++ b/Source/cmVariableWatchCommand.cxx @@ -43,16 +43,14 @@ static void cmVariableWatchCommandVariableAccessed(const std::string& variable, std::string stack = makefile->GetProperty("LISTFILE_STACK"); if (!data->Command.empty()) { newLFF.Arguments.clear(); - newLFF.Arguments.push_back( - cmListFileArgument(variable, cmListFileArgument::Quoted, 9999)); - newLFF.Arguments.push_back( - cmListFileArgument(accessString, cmListFileArgument::Quoted, 9999)); - newLFF.Arguments.push_back(cmListFileArgument( - newValue ? newValue : "", cmListFileArgument::Quoted, 9999)); - newLFF.Arguments.push_back( - cmListFileArgument(currentListFile, cmListFileArgument::Quoted, 9999)); - newLFF.Arguments.push_back( - cmListFileArgument(stack, cmListFileArgument::Quoted, 9999)); + newLFF.Arguments.emplace_back(variable, cmListFileArgument::Quoted, 9999); + newLFF.Arguments.emplace_back(accessString, cmListFileArgument::Quoted, + 9999); + newLFF.Arguments.emplace_back(newValue ? newValue : "", + cmListFileArgument::Quoted, 9999); + newLFF.Arguments.emplace_back(currentListFile, cmListFileArgument::Quoted, + 9999); + newLFF.Arguments.emplace_back(stack, cmListFileArgument::Quoted, 9999); newLFF.Name = data->Command; newLFF.Line = 9999; cmExecutionStatus status; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index cefea27..01defe4 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -912,7 +912,7 @@ void cmake::GetRegisteredGenerators( info.name = name; info.baseName = name; info.isAlias = false; - generators.push_back(info); + generators.push_back(std::move(info)); } } @@ -928,7 +928,7 @@ void cmake::GetRegisteredGenerators( info.supportsPlatform = false; info.supportsToolset = false; info.isAlias = false; - generators.push_back(info); + generators.push_back(std::move(info)); } for (std::string const& a : eg->Aliases) { GeneratorInfo info; @@ -940,7 +940,7 @@ void cmake::GetRegisteredGenerators( info.supportsPlatform = false; info.supportsToolset = false; info.isAlias = true; - generators.push_back(info); + generators.push_back(std::move(info)); } } } @@ -1167,7 +1167,7 @@ int cmake::HandleDeleteCacheVariables(const std::string& var) save.help = help; } } - saved.push_back(save); + saved.push_back(std::move(save)); } // remove the cache @@ -1807,7 +1807,7 @@ void cmake::GetGeneratorDocumentation(std::vector& v) for (cmGlobalGeneratorFactory* g : this->Generators) { cmDocumentationEntry e; g->GetDocumentation(e); - v.push_back(e); + v.push_back(std::move(e)); } for (cmExternalMakefileProjectGeneratorFactory* eg : this->ExtraGenerators) { const std::string doc = eg->GetDocumentation(); @@ -1818,7 +1818,7 @@ void cmake::GetGeneratorDocumentation(std::vector& v) cmDocumentationEntry e; e.Name = a; e.Brief = doc; - v.push_back(e); + v.push_back(std::move(e)); } // Full names: @@ -1829,7 +1829,7 @@ void cmake::GetGeneratorDocumentation(std::vector& v) e.Name = cmExternalMakefileProjectGenerator::CreateFullGeneratorName(g, name); e.Brief = doc; - v.push_back(e); + v.push_back(std::move(e)); } } } @@ -2212,9 +2212,7 @@ int cmake::GetSystemInformation(std::vector& args) std::vector args2; args2.push_back(args[0]); args2.push_back(destPath); - std::string resultArg = "-DRESULT_FILE="; - resultArg += resultFile; - args2.push_back(resultArg); + args2.push_back("-DRESULT_FILE=" + resultFile); int res = this->Run(args2, false); if (res != 0) { -- cgit v0.12