Commit ef61997b authored by wahikihiki's avatar wahikihiki Committed by Brad King

clang-tidy: Use emplace

parent 2e5307a2
......@@ -15,7 +15,6 @@ modernize-*,\
-modernize-raw-string-literal,\
-modernize-return-braced-init-list,\
-modernize-use-auto,\
-modernize-use-emplace,\
-modernize-use-equals-default,\
-modernize-use-equals-delete,\
-modernize-use-noexcept,\
......
......@@ -71,8 +71,8 @@ int cmCPackDragNDropGenerator::InitializeInternal()
// Starting with Xcode 4.3, look in "/Applications/Xcode.app" first:
//
std::vector<std::string> paths;
paths.push_back("/Applications/Xcode.app/Contents/Developer/Tools");
paths.push_back("/Developer/Tools");
paths.emplace_back("/Applications/Xcode.app/Contents/Developer/Tools");
paths.emplace_back("/Developer/Tools");
const std::string hdiutil_path =
cmSystemTools::FindProgram("hdiutil", std::vector<std::string>(), false);
......
......@@ -1036,7 +1036,8 @@ int cmCPackGenerator::DoPackage()
* may update this during PackageFiles.
* (either putting several names or updating the provided one)
*/
packageFileNames.push_back(tempPackageFileName ? tempPackageFileName : "");
packageFileNames.emplace_back(tempPackageFileName ? tempPackageFileName
: "");
toplevel = tempDirectory;
{ // scope that enables package generators to run internal scripts with
// latest CMake policies enabled
......
......@@ -610,7 +610,7 @@ bool cmCPackNSISGenerator::GetListOfSubdirectories(
}
}
}
dirs.push_back(topdir);
dirs.emplace_back(topdir);
return true;
}
......
......@@ -340,16 +340,16 @@ int cmCPackPackageMakerGenerator::InitializeInternal()
// If found, save result in the CPACK_INSTALLER_PROGRAM variable.
std::vector<std::string> paths;
paths.push_back("/Applications/Xcode.app/Contents/Applications"
"/PackageMaker.app/Contents/MacOS");
paths.push_back("/Applications/Utilities"
"/PackageMaker.app/Contents/MacOS");
paths.push_back("/Applications"
"/PackageMaker.app/Contents/MacOS");
paths.push_back("/Developer/Applications/Utilities"
"/PackageMaker.app/Contents/MacOS");
paths.push_back("/Developer/Applications"
"/PackageMaker.app/Contents/MacOS");
paths.emplace_back("/Applications/Xcode.app/Contents/Applications"
"/PackageMaker.app/Contents/MacOS");
paths.emplace_back("/Applications/Utilities"
"/PackageMaker.app/Contents/MacOS");
paths.emplace_back("/Applications"
"/PackageMaker.app/Contents/MacOS");
paths.emplace_back("/Developer/Applications/Utilities"
"/PackageMaker.app/Contents/MacOS");
paths.emplace_back("/Developer/Applications"
"/PackageMaker.app/Contents/MacOS");
std::string pkgPath;
const char* inst_program = this->GetOption("CPACK_INSTALLER_PROGRAM");
......
......@@ -232,7 +232,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
// do the build
if (this->BuildTargets.empty()) {
this->BuildTargets.push_back("");
this->BuildTargets.emplace_back();
}
for (std::string const& tar : this->BuildTargets) {
cmDuration remainingTime = std::chrono::seconds(0);
......
......@@ -341,17 +341,17 @@ int cmCTestBuildHandler::ProcessHandler()
// warnings and warning exceptions.
std::vector<std::string>::size_type cc;
for (cc = 0; cmCTestErrorMatches[cc]; cc++) {
this->CustomErrorMatches.push_back(cmCTestErrorMatches[cc]);
this->CustomErrorMatches.emplace_back(cmCTestErrorMatches[cc]);
}
for (cc = 0; cmCTestErrorExceptions[cc]; cc++) {
this->CustomErrorExceptions.push_back(cmCTestErrorExceptions[cc]);
this->CustomErrorExceptions.emplace_back(cmCTestErrorExceptions[cc]);
}
for (cc = 0; cmCTestWarningMatches[cc]; cc++) {
this->CustomWarningMatches.push_back(cmCTestWarningMatches[cc]);
this->CustomWarningMatches.emplace_back(cmCTestWarningMatches[cc]);
}
for (cc = 0; cmCTestWarningExceptions[cc]; cc++) {
this->CustomWarningExceptions.push_back(cmCTestWarningExceptions[cc]);
this->CustomWarningExceptions.emplace_back(cmCTestWarningExceptions[cc]);
}
// Pre-compile regular expressions objects for all regular expressions
......@@ -365,7 +365,7 @@ int cmCTestBuildHandler::ProcessHandler()
cmCTestOptionalLog(this->CTest, DEBUG, \
"Add " #strings ": " << s << std::endl, \
this->Quiet); \
(regexes).push_back(s.c_str()); \
(regexes).emplace_back(s); \
} \
} while (false)
......@@ -1034,7 +1034,7 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, size_t length,
}
} else {
// Otherwise store pre-context for the next error
this->PreContext.push_back(line);
this->PreContext.emplace_back(line);
if (this->PreContext.size() > this->MaxPreContext) {
this->PreContext.erase(this->PreContext.begin(),
this->PreContext.end() -
......
......@@ -56,12 +56,12 @@ public:
void SetCommand(const char* command)
{
this->CommandLineStrings.clear();
this->CommandLineStrings.push_back(command);
this->CommandLineStrings.emplace_back(command);
}
void AddArgument(const char* arg)
{
if (arg) {
this->CommandLineStrings.push_back(arg);
this->CommandLineStrings.emplace_back(arg);
}
}
void SetWorkingDirectory(const char* dir) { this->WorkingDirectory = dir; }
......@@ -316,8 +316,7 @@ int cmCTestCoverageHandler::ProcessHandler()
// setup the regex exclude stuff
this->CustomCoverageExcludeRegex.clear();
for (std::string const& rex : this->CustomCoverageExclude) {
this->CustomCoverageExcludeRegex.push_back(
cmsys::RegularExpression(rex.c_str()));
this->CustomCoverageExcludeRegex.emplace_back(rex);
}
if (this->HandleBullseyeCoverage(&cont)) {
......@@ -1005,7 +1004,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
std::vector<std::string> basecovargs =
cmSystemTools::ParseArguments(gcovExtraFlags.c_str());
basecovargs.insert(basecovargs.begin(), gcovCommand);
basecovargs.push_back("-o");
basecovargs.emplace_back("-o");
// files is a list of *.da and *.gcda files with coverage data in them.
// These are binary files that you give as input to gcov so that it will
......
......@@ -146,7 +146,7 @@ void cmCTestLaunch::HandleRealArg(const char* arg)
return;
}
#endif
this->RealArgs.push_back(arg);
this->RealArgs.emplace_back(arg);
}
void cmCTestLaunch::ComputeFileNames()
......@@ -534,9 +534,9 @@ void cmCTestLaunch::LoadScrapeRules()
// Common compiler warning formats. These are much simpler than the
// full log-scraping expressions because we do not need to extract
// file and line information.
this->RegexWarning.push_back("(^|[ :])[Ww][Aa][Rr][Nn][Ii][Nn][Gg]");
this->RegexWarning.push_back("(^|[ :])[Rr][Ee][Mm][Aa][Rr][Kk]");
this->RegexWarning.push_back("(^|[ :])[Nn][Oo][Tt][Ee]");
this->RegexWarning.emplace_back("(^|[ :])[Ww][Aa][Rr][Nn][Ii][Nn][Gg]");
this->RegexWarning.emplace_back("(^|[ :])[Rr][Ee][Mm][Aa][Rr][Kk]");
this->RegexWarning.emplace_back("(^|[ :])[Nn][Oo][Tt][Ee]");
// Load custom match rules given to us by CTest.
this->LoadScrapeRules("Warning", this->RegexWarning);
......
......@@ -261,8 +261,8 @@ void cmCTestMemCheckHandler::InitializeResultsVectors()
};
this->GlobalResults.clear();
for (int i = 0; cmCTestMemCheckResultStrings[i] != nullptr; ++i) {
this->ResultStrings.push_back(cmCTestMemCheckResultStrings[i]);
this->ResultStringsLong.push_back(cmCTestMemCheckResultLongStrings[i]);
this->ResultStrings.emplace_back(cmCTestMemCheckResultStrings[i]);
this->ResultStringsLong.emplace_back(cmCTestMemCheckResultLongStrings[i]);
this->GlobalResults.push_back(0);
}
}
......@@ -528,11 +528,11 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
switch (this->MemoryTesterStyle) {
case cmCTestMemCheckHandler::VALGRIND: {
if (this->MemoryTesterOptions.empty()) {
this->MemoryTesterOptions.push_back("-q");
this->MemoryTesterOptions.push_back("--tool=memcheck");
this->MemoryTesterOptions.push_back("--leak-check=yes");
this->MemoryTesterOptions.push_back("--show-reachable=yes");
this->MemoryTesterOptions.push_back("--num-callers=50");
this->MemoryTesterOptions.emplace_back("-q");
this->MemoryTesterOptions.emplace_back("--tool=memcheck");
this->MemoryTesterOptions.emplace_back("--leak-check=yes");
this->MemoryTesterOptions.emplace_back("--show-reachable=yes");
this->MemoryTesterOptions.emplace_back("--num-callers=50");
}
if (!this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile")
.empty()) {
......@@ -586,11 +586,11 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
std::string dpbdFile = this->CTest->GetBinaryDir() +
"/Testing/Temporary/MemoryChecker.??.DPbd";
this->BoundsCheckerDPBDFile = dpbdFile;
this->MemoryTesterDynamicOptions.push_back("/B");
this->MemoryTesterDynamicOptions.emplace_back("/B");
this->MemoryTesterDynamicOptions.push_back(std::move(dpbdFile));
this->MemoryTesterDynamicOptions.push_back("/X");
this->MemoryTesterDynamicOptions.emplace_back("/X");
this->MemoryTesterDynamicOptions.push_back(this->MemoryTesterOutputFile);
this->MemoryTesterOptions.push_back("/M");
this->MemoryTesterOptions.emplace_back("/M");
break;
}
// these are almost the same but the env var used is different
......@@ -604,8 +604,8 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
// The MemoryTesterDynamicOptions is setup with the -E env
// Then the MemoryTesterEnvironmentVariable gets the
// TSAN_OPTIONS string with the log_path in it.
this->MemoryTesterDynamicOptions.push_back("-E");
this->MemoryTesterDynamicOptions.push_back("env");
this->MemoryTesterDynamicOptions.emplace_back("-E");
this->MemoryTesterDynamicOptions.emplace_back("env");
std::string envVar;
std::string extraOptions;
std::string suppressionsOption;
......
......@@ -307,20 +307,20 @@ void cmCTestP4::SetP4Options(std::vector<char const*>& CommandOptions)
{
if (P4Options.empty()) {
const char* p4 = this->CommandLineTool.c_str();
P4Options.push_back(p4);
P4Options.emplace_back(p4);
// The CTEST_P4_CLIENT variable sets the P4 client used when issuing
// Perforce commands, if it's different from the default one.
std::string client = this->CTest->GetCTestConfiguration("P4Client");
if (!client.empty()) {
P4Options.push_back("-c");
P4Options.emplace_back("-c");
P4Options.push_back(client);
}
// Set the message language to be English, in case the P4 admin
// has localized them
P4Options.push_back("-L");
P4Options.push_back("en");
P4Options.emplace_back("-L");
P4Options.emplace_back("en");
// The CTEST_P4_OPTIONS variable adds additional Perforce command line
// options before the main command
......
......@@ -532,7 +532,7 @@ bool cmCTestSVN::LoadRepositories()
}
// Info for root repository
this->Repositories.emplace_back("");
this->Repositories.emplace_back();
this->RootInfo = &(this->Repositories.back());
// Run "svn status" to get the list of external repositories
......
......@@ -135,7 +135,7 @@ cmCTestScriptHandler::~cmCTestScriptHandler()
void cmCTestScriptHandler::AddConfigurationScript(const char* script,
bool pscope)
{
this->ConfigurationScripts.push_back(script);
this->ConfigurationScripts.emplace_back(script);
this->ScriptProcessScope.push_back(pscope);
}
......@@ -450,7 +450,7 @@ int cmCTestScriptHandler::ExtractVariables()
updateVar, " specified without specifying CTEST_CVS_COMMAND.");
return 12;
}
this->ExtraUpdates.push_back(updateVal);
this->ExtraUpdates.emplace_back(updateVal);
}
}
......
......@@ -861,7 +861,7 @@ int cmCTestSubmitHandler::ProcessHandler()
// Submit Done.xml last
if (this->SubmitPart[cmCTest::PartDone]) {
files.push_back("Done.xml");
files.emplace_back("Done.xml");
}
if (ofs) {
......
......@@ -1524,7 +1524,7 @@ void cmCTestTestHandler::AddConfigurations(
}
tempPath = filepath + filename;
attempted.push_back(tempPath);
attemptedConfigs.push_back("");
attemptedConfigs.emplace_back();
if (!ctest->GetConfigType().empty()) {
tempPath = filepath;
......@@ -1547,32 +1547,32 @@ void cmCTestTestHandler::AddConfigurations(
tempPath += "Release/";
tempPath += filename;
attempted.push_back(tempPath);
attemptedConfigs.push_back("Release");
attemptedConfigs.emplace_back("Release");
tempPath = filepath;
tempPath += "Debug/";
tempPath += filename;
attempted.push_back(tempPath);
attemptedConfigs.push_back("Debug");
attemptedConfigs.emplace_back("Debug");
tempPath = filepath;
tempPath += "MinSizeRel/";
tempPath += filename;
attempted.push_back(tempPath);
attemptedConfigs.push_back("MinSizeRel");
attemptedConfigs.emplace_back("MinSizeRel");
tempPath = filepath;
tempPath += "RelWithDebInfo/";
tempPath += filename;
attempted.push_back(tempPath);
attemptedConfigs.push_back("RelWithDebInfo");
attemptedConfigs.emplace_back("RelWithDebInfo");
tempPath = filepath;
tempPath += "Deployment/";
tempPath += filename;
attempted.push_back(tempPath);
attemptedConfigs.push_back("Deployment");
attemptedConfigs.emplace_back("Deployment");
tempPath = filepath;
tempPath += "Development/";
tempPath += filename;
attempted.push_back(tempPath);
attemptedConfigs.push_back("Deployment");
attemptedConfigs.emplace_back("Deployment");
}
}
......
......@@ -44,7 +44,7 @@ public:
// Check that the begin is the first non-space string on the line
if ((beginPos == line.find_first_not_of(' ')) &&
beginPos != std::string::npos) {
beginSet.push_back("begin");
beginSet.emplace_back("begin");
coverageVector.push_back(-1);
continue;
}
......
......@@ -109,7 +109,7 @@ int main(int argc, char const* const* argv)
if (strcmp(argv[j], "-debug") == 0) {
debug = true;
} else {
args.push_back(argv[j]);
args.emplace_back(argv[j]);
}
}
......
......@@ -37,10 +37,10 @@ cmCursesMainForm::cmCursesMainForm(std::vector<std::string> const& args,
this->AdvancedMode = false;
this->NumberOfVisibleEntries = 0;
this->OkToGenerate = false;
this->HelpMessage.push_back(
this->HelpMessage.emplace_back(
"Welcome to ccmake, curses based user interface for CMake.");
this->HelpMessage.push_back("");
this->HelpMessage.push_back(s_ConstHelpMessage);
this->HelpMessage.emplace_back();
this->HelpMessage.emplace_back(s_ConstHelpMessage);
this->CMakeInstance = new cmake(cmake::RoleProject, cmState::Project);
this->CMakeInstance->SetCMakeEditCommand(
cmSystemTools::GetCMakeCursesCommand());
......@@ -652,7 +652,7 @@ int cmCursesMainForm::Generate()
void cmCursesMainForm::AddError(const char* message, const char* /*unused*/)
{
this->Errors.push_back(message);
this->Errors.emplace_back(message);
}
void cmCursesMainForm::RemoveEntry(const char* value)
......
......@@ -181,7 +181,7 @@ void CCONV cmAddExecutable(void* arg, const char* exename, int numSrcs,
std::vector<std::string> srcs2;
int i;
for (i = 0; i < numSrcs; ++i) {
srcs2.push_back(srcs[i]);
srcs2.emplace_back(srcs[i]);
}
cmTarget* tg = mf->AddExecutable(exename, srcs2);
if (win32) {
......@@ -393,7 +393,7 @@ void CCONV cmAddLibrary(void* arg, const char* libname, int shared,
std::vector<std::string> srcs2;
int i;
for (i = 0; i < numSrcs; ++i) {
srcs2.push_back(srcs[i]);
srcs2.emplace_back(srcs[i]);
}
mf->AddLibrary(
libname,
......@@ -419,8 +419,7 @@ int CCONV cmExecuteCommand(void* arg, const char* name, int numArgs,
lff.Name = name;
for (int i = 0; i < numArgs; ++i) {
// Assume all arguments are quoted.
lff.Arguments.push_back(
cmListFileArgument(args[i], cmListFileArgument::Quoted, 0));
lff.Arguments.emplace_back(args[i], cmListFileArgument::Quoted, 0);
}
cmExecutionStatus status;
return mf->ExecuteCommand(lff, status);
......@@ -436,7 +435,7 @@ void CCONV cmExpandSourceListArguments(void* arg, int numArgs,
std::vector<std::string> result;
int i;
for (i = 0; i < numArgs; ++i) {
result.push_back(args[i]);
result.emplace_back(args[i]);
}
int resargc = static_cast<int>(result.size());
char** resargv = nullptr;
......@@ -627,7 +626,7 @@ void CCONV cmSourceFileAddDepend(void* arg, const char* depend)
if (cmSourceFile* rsf = sf->RealSourceFile) {
rsf->AddDepend(depend);
} else {
sf->Depends.push_back(depend);
sf->Depends.emplace_back(depend);
}
}
......@@ -647,10 +646,10 @@ void CCONV cmSourceFileSetName(void* arg, const char* name, const char* dir,
std::vector<std::string> headerExts;
int i;
for (i = 0; i < numSourceExtensions; ++i) {
sourceExts.push_back(sourceExtensions[i]);
sourceExts.emplace_back(sourceExtensions[i]);
}
for (i = 0; i < numHeaderExtensions; ++i) {
headerExts.push_back(headerExtensions[i]);
headerExts.emplace_back(headerExtensions[i]);
}
// Save the original name given.
......
......@@ -1176,12 +1176,12 @@ int cmCTest::RunTest(std::vector<const char*> argv, std::string* output,
if (strcmp(i, "--build-generator") == 0 &&
timeout != cmCTest::MaxDuration() &&
timeout > cmDuration::zero()) {
args.push_back("--test-timeout");
args.emplace_back("--test-timeout");
std::ostringstream msg;
msg << cmDurationTo<unsigned int>(timeout);
args.push_back(msg.str());
}
args.push_back(i);
args.emplace_back(i);
}
}
if (log) {
......@@ -2690,7 +2690,7 @@ void cmCTest::SetSpecificTrack(const char* track)
void cmCTest::AddSubmitFile(Part part, const char* name)
{
this->Parts[part].SubmitFiles.push_back(name);
this->Parts[part].SubmitFiles.emplace_back(name);
}
void cmCTest::AddCTestConfigurationOverwrite(const std::string& overStr)
......
......@@ -884,12 +884,12 @@ void cmComputeLinkInformation::AddLinkExtension(const char* e, LinkType type)
{
if (e && *e) {
if (type == LinkStatic) {
this->StaticLinkExtensions.push_back(e);
this->StaticLinkExtensions.emplace_back(e);
}
if (type == LinkShared) {
this->SharedLinkExtensions.push_back(e);
this->SharedLinkExtensions.emplace_back(e);
}
this->LinkExtensions.push_back(e);
this->LinkExtensions.emplace_back(e);
}
}
......
......@@ -1005,12 +1005,12 @@ void cmCoreTryCompile::FindOutputFile(const std::string& targetName,
tmp += config;
searchDirs.push_back(std::move(tmp));
}
searchDirs.push_back("/Debug");
searchDirs.emplace_back("/Debug");
#if defined(__APPLE__)
std::string app = "/Debug/" + targetName + ".app";
searchDirs.push_back(std::move(app));
#endif
searchDirs.push_back("/Development");
searchDirs.emplace_back("/Development");
for (std::string const& sdir : searchDirs) {
std::string command = this->BinaryDirectory;
......
......@@ -68,7 +68,7 @@ void cmDependsJavaParserHelper::AddClassFound(const char* sclass)
return;
}
}
this->ClassesFound.push_back(sclass);
this->ClassesFound.emplace_back(sclass);
}
void cmDependsJavaParserHelper::AddPackagesImport(const char* sclass)
......@@ -78,7 +78,7 @@ void cmDependsJavaParserHelper::AddPackagesImport(const char* sclass)
return;
}
}
this->PackagesImport.push_back(sclass);
this->PackagesImport.emplace_back(sclass);
}
void cmDependsJavaParserHelper::SafePrintMissing(const char* str, int line,
......
......@@ -54,7 +54,7 @@ bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args,
if (args[i] == "COMMAND") {
doing_command = true;
command_index = cmds.size();
cmds.push_back(std::vector<const char*>());
cmds.emplace_back();
} else if (args[i] == "OUTPUT_VARIABLE") {
doing_command = false;
if (++i < args.size()) {
......@@ -327,15 +327,15 @@ bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args,
cmsysProcess_GetExitValueByIndex(cp, static_cast<int>(i));
char buf[16];
sprintf(buf, "%d", exitCode);
res.push_back(buf);
res.emplace_back(buf);
} break;
case kwsysProcess_StateByIndex_Exception:
res.push_back(cmsysProcess_GetExceptionStringByIndex(
res.emplace_back(cmsysProcess_GetExceptionStringByIndex(
cp, static_cast<int>(i)));
break;
case kwsysProcess_StateByIndex_Error:
default:
res.push_back("Error getting the child return code");
res.emplace_back("Error getting the child return code");
break;
}
}
......
......@@ -178,13 +178,13 @@ void cmFindCommon::RerootPaths(std::vector<std::string>& paths)
cmSystemTools::ExpandListArgument(rootPath, roots);
}
if (sysrootCompile) {
roots.push_back(sysrootCompile);
roots.emplace_back(sysrootCompile);
}
if (sysrootLink) {
roots.push_back(sysrootLink);
roots.emplace_back(sysrootLink);
}
if (sysroot) {
roots.push_back(sysroot);
roots.emplace_back(sysroot);
}
for (std::string& r : roots) {
cmSystemTools::ConvertToUnixSlashes(r);
......
......@@ -1848,7 +1848,7 @@ private:
}
for (std::string const& n : this->Names) {
if (cmsysString_strncasecmp(fname, n.c_str(), n.length()) == 0) {
matches.push_back(fname);
matches.emplace_back(fname);
}
}
}
......@@ -1907,7 +1907,7 @@ private:
for (std::string name : this->Names) {
name += this->Extension;
if (cmsysString_strcasecmp(fname, name.c_str()) == 0) {
matches.push_back(fname);
matches.emplace_back(fname);
}
}
}
......@@ -2070,16 +2070,16 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in)
common.push_back("lib/" + this->LibraryArchitecture);
}
if (this->UseLib32Paths) {
common.push_back("lib32");
common.emplace_back("lib32");
}
if (this->UseLib64Paths) {
common.push_back("lib64");
common.emplace_back("lib64");
}
if (this->UseLibx32Paths) {
common.push_back("libx32");
common.emplace_back("libx32");
}
common.push_back("lib");
common.push_back("share");
common.emplace_back("lib");
common.emplace_back("share");
// PREFIX/(lib/ARCH|lib*|share)/cmake/(Foo|foo|FOO).*/
{
......
......@@ -164,7 +164,7 @@ bool cmForEachCommand::InitialPass(std::vector<std::string> const& args,
break;
}
sprintf(buffer, "%d", cc);
range.push_back(buffer);
range.emplace_back(buffer);
if (cc == stop) {
break;
}
......
......@@ -20,8 +20,8 @@ std::vector<cmGeneratorExpressionToken> cmGeneratorExpressionLexer::Tokenize(
std::vector<cmGeneratorExpressionToken> result;
if (input.find('$') == std::string::npos) {
result.push_back(cmGeneratorExpressionToken(
cmGeneratorExpressionToken::Text, input.c_str(), input.size()));
result.emplace_back(cmGeneratorExpressionToken::Text, input.c_str(),
input.size());
return result;
}
......
......@@ -319,7 +319,7 @@ std::string cmGeneratorTarget::GetOutputName(
props.push_back(configUpper + "_OUTPUT_NAME");
}
// OUTPUT_NAME
props.push_back("OUTPUT_NAME");
props.emplace_back("OUTPUT_NAME");
std::string outName;
for (std::string const& p : props) {
......@@ -988,7 +988,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
item.back() == '>') {
continue;
}
files.push_back(item);
files.emplace_back(item);
}
}
return files;
......@@ -3260,7 +3260,7 @@ void processLinkDirectories(
// in case projects set the LINK_DIRECTORIES property directly.
cmSystemTools::ConvertToUnixSlashes(entryDirectory);
if (uniqueDirectories.insert(entryDirectory).second) {
directories.push_back(entryDirectory);
directories.emplace_back(entryDirectory);
if (debugDirectories) {
usedDirectories += " * " + entryDirectory + "\n";
}
......@@ -3838,7 +3838,7 @@ std::string cmGeneratorTarget::GetPDBName(const std::string& config) const
}
// PDB_NAME
props.push_back("PDB_NAME");
props.emplace_back("PDB_NAME");
for (std::string const& p : props) {
if (const char* outName = this->GetProperty(p)) {
......
......@@ -1761,7 +1761,7 @@ void cmGlobalGenerator::GenerateBuildCommand(
bool /*unused*/, int /*unused*/, bool /*unused*/,
std::vector<std::string> const& /*unused*/)
{
makeCommand.push_back(
makeCommand.emplace_back(
"cmGlobalGenerator::GenerateBuildCommand not implemented");
}
......@@ -2313,12 +2313,12 @@ void cmGlobalGenerator::AddGlobalTarget_Package(
singleLine.push_back("./CPackConfig.cmake");
gti.CommandLines.push_back(std::move(singleLine));
if (this->GetPreinstallTargetName()) {
gti.Depends.push_back(this->GetPreinstallTargetName());
gti.Depends.emplace_back(this->GetPreinstallTargetName());
} else {
const char* noPackageAll =
mf->GetDefinition("CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY");
if (!noPackageAll || cmSystemTools::IsOff(noPackageAll)) {
gti.Depends.push_back(this->GetAllTargetName());
gti.Depends.emplace_back(this->GetAllTargetName());
}
}
targets.push_back(std::move(gti));
......@@ -2483,12 +2483,12 @@ void cmGlobalGenerator::AddGlobalTarget_Install(
gti.UsesTerminal = true;
cmCustomCommandLine singleLine;
if (this->GetPreinstallTargetName()) {
gti.Depends.push_back(this->GetPreinstallTargetName());
gti.Depends.emplace_back(this->GetPreinstallTargetName());
} else {
const char* noall =
mf->GetDefinition("CMAKE_SKIP_INSTALL_ALL_DEPENDENCY");
if (!noall || cmSystemTools::IsOff(noall)) {
gti.Depends.push_back(this->GetAllTargetName());
gti.Depends.emplace_back(this->GetAllTargetName());
}