summaryrefslogtreecommitdiffstats
path: root/Source/CTest
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-01-21 12:51:46 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-01-21 12:51:54 (GMT)
commit4dba5d6ce251257259874bce394b2fba954e200c (patch)
treef775a504eb80d0383231fb99eb301a962a989fb2 /Source/CTest
parent7e5f9b192e9c3ed7130e1e52b7f9d3243f51e2ab (diff)
parentef61997b1be5c2f542472f8eb48dac62cd26bf5c (diff)
downloadCMake-4dba5d6ce251257259874bce394b2fba954e200c.zip
CMake-4dba5d6ce251257259874bce394b2fba954e200c.tar.gz
CMake-4dba5d6ce251257259874bce394b2fba954e200c.tar.bz2
Merge topic 'use-emplace'
ef61997b1b clang-tidy: Use emplace 2e5307a2a4 CTestSVN: Accept std::string in SVNInfo constructor Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2811
Diffstat (limited to 'Source/CTest')
-rw-r--r--Source/CTest/cmCTestBuildAndTestHandler.cxx2
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx12
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx9
-rw-r--r--Source/CTest/cmCTestLaunch.cxx8
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.cxx24
-rw-r--r--Source/CTest/cmCTestP4.cxx8
-rw-r--r--Source/CTest/cmCTestSVN.cxx4
-rw-r--r--Source/CTest/cmCTestSVN.h2
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx4
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx2
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx14
-rw-r--r--Source/CTest/cmParseDelphiCoverage.cxx2
12 files changed, 45 insertions, 46 deletions
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx
index d49fba2..6496af8 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.cxx
+++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx
@@ -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);
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index 361883c..d07bd21 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -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() -
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index fbd1038..6c68f46 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -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
diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx
index 4facea2..5218993 100644
--- a/Source/CTest/cmCTestLaunch.cxx
+++ b/Source/CTest/cmCTestLaunch.cxx
@@ -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);
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index 9c9532a..8ba59d3 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -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;
diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx
index 511dbd2..c0bdc17 100644
--- a/Source/CTest/cmCTestP4.cxx
+++ b/Source/CTest/cmCTestP4.cxx
@@ -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
diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx
index 6c439e9..afde61c 100644
--- a/Source/CTest/cmCTestSVN.cxx
+++ b/Source/CTest/cmCTestSVN.cxx
@@ -521,7 +521,7 @@ private:
} else {
local_path = path;
}
- this->SVN->Repositories.emplace_back(local_path.c_str());
+ this->SVN->Repositories.emplace_back(local_path);
}
};
@@ -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
diff --git a/Source/CTest/cmCTestSVN.h b/Source/CTest/cmCTestSVN.h
index a467ede..5c8505d 100644
--- a/Source/CTest/cmCTestSVN.h
+++ b/Source/CTest/cmCTestSVN.h
@@ -41,7 +41,7 @@ private:
struct SVNInfo
{
- SVNInfo(const char* path)
+ SVNInfo(std::string const& path = std::string())
: LocalPath(path)
{
}
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index aa37ff9..3eac903 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -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);
}
}
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 600194a..5213bd3 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -838,7 +838,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) {
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index acbe465..f86a4cd 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -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");
}
}
diff --git a/Source/CTest/cmParseDelphiCoverage.cxx b/Source/CTest/cmParseDelphiCoverage.cxx
index cc81979..d99de06 100644
--- a/Source/CTest/cmParseDelphiCoverage.cxx
+++ b/Source/CTest/cmParseDelphiCoverage.cxx
@@ -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;
}