diff options
author | Regina Pfeifer <regina@mailbox.org> | 2019-09-04 20:17:22 (GMT) |
---|---|---|
committer | Regina Pfeifer <regina@mailbox.org> | 2019-09-10 20:21:41 (GMT) |
commit | d25a5a7ec91bfa072d3cf1a302830a54506c88c0 (patch) | |
tree | d06203c8e5b5fdd38645e0fb9b284ded26651f44 /Source/CTest | |
parent | bbf48c494ad28d1c8ac5aa6e4cecb35c2cbf1b84 (diff) | |
download | CMake-d25a5a7ec91bfa072d3cf1a302830a54506c88c0.zip CMake-d25a5a7ec91bfa072d3cf1a302830a54506c88c0.tar.gz CMake-d25a5a7ec91bfa072d3cf1a302830a54506c88c0.tar.bz2 |
clang-tidy: modernize-use-auto
Set the MinTypeNameLength option to an impossibly high value in order
to limit the diagnostics to iterators. Leave new expressions and cast
expressions for later.
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestCoverageHandler.cxx | 13 | ||||
-rw-r--r-- | Source/CTest/cmCTestGenericHandler.cxx | 9 | ||||
-rw-r--r-- | Source/CTest/cmCTestP4.cxx | 3 | ||||
-rw-r--r-- | Source/CTest/cmCTestRunTest.cxx | 3 | ||||
-rw-r--r-- | Source/CTest/cmCTestSVN.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 27 | ||||
-rw-r--r-- | Source/CTest/cmParseCacheCoverage.cxx | 3 | ||||
-rw-r--r-- | Source/CTest/cmParseMumpsCoverage.cxx | 3 |
8 files changed, 23 insertions, 40 deletions
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 772fa47..d9dd931 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -1830,9 +1830,8 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch( return 0; } std::map<std::string, std::string> fileMap; - std::vector<std::string>::iterator fp = filesFullPath.begin(); - for (std::vector<std::string>::iterator f = files.begin(); f != files.end(); - ++f, ++fp) { + auto fp = filesFullPath.begin(); + for (auto f = files.begin(); f != files.end(); ++f, ++fp) { fileMap[*f] = *fp; } @@ -1870,7 +1869,7 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch( this->StartCoverageLogXML(covLogXML); count++; // move on one } - std::map<std::string, std::string>::iterator i = fileMap.find(file); + auto i = fileMap.find(file); // if the file should be covered write out the header for that file if (i != fileMap.end()) { // we have a new file so count it in the output @@ -2202,7 +2201,7 @@ bool cmCTestCoverageHandler::ParseBullsEyeCovsrcLine( int cmCTestCoverageHandler::GetLabelId(std::string const& label) { - LabelIdMapType::iterator i = this->LabelIdMap.find(label); + auto i = this->LabelIdMap.find(label); if (i == this->LabelIdMap.end()) { int n = int(this->Labels.size()); this->Labels.push_back(label); @@ -2273,7 +2272,7 @@ void cmCTestCoverageHandler::LoadLabels(const char* dir) void cmCTestCoverageHandler::WriteXMLLabels(cmXMLWriter& xml, std::string const& source) { - LabelMapType::const_iterator li = this->SourceLabels.find(source); + auto li = this->SourceLabels.find(source); if (li != this->SourceLabels.end() && !li->second.empty()) { xml.StartElement("Labels"); for (auto const& ls : li->second) { @@ -2316,7 +2315,7 @@ bool cmCTestCoverageHandler::IsFilteredOut(std::string const& source) // The source is filtered out if it does not have any labels in // common with the filter set. std::string shortSrc = this->CTest->GetShortPathToFile(source.c_str()); - LabelMapType::const_iterator li = this->SourceLabels.find(shortSrc); + auto li = this->SourceLabels.find(shortSrc); if (li != this->SourceLabels.end()) { return !this->IntersectsFilter(li->second); } diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx index d3020b5..cc0b4ed 100644 --- a/Source/CTest/cmCTestGenericHandler.cxx +++ b/Source/CTest/cmCTestGenericHandler.cxx @@ -23,8 +23,7 @@ cmCTestGenericHandler::~cmCTestGenericHandler() = default; void cmCTestGenericHandler::SetOption(const std::string& op, const char* value) { if (!value) { - cmCTestGenericHandler::t_StringToString::iterator remit = - this->Options.find(op); + auto remit = this->Options.find(op); if (remit != this->Options.end()) { this->Options.erase(remit); } @@ -39,8 +38,7 @@ void cmCTestGenericHandler::SetPersistentOption(const std::string& op, { this->SetOption(op, value); if (!value) { - cmCTestGenericHandler::t_StringToString::iterator remit = - this->PersistentOptions.find(op); + auto remit = this->PersistentOptions.find(op); if (remit != this->PersistentOptions.end()) { this->PersistentOptions.erase(remit); } @@ -62,8 +60,7 @@ void cmCTestGenericHandler::Initialize() const char* cmCTestGenericHandler::GetOption(const std::string& op) { - cmCTestGenericHandler::t_StringToString::iterator remit = - this->Options.find(op); + auto remit = this->Options.find(op); if (remit == this->Options.end()) { return nullptr; } diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx index 9bca7cb..08c850d 100644 --- a/Source/CTest/cmCTestP4.cxx +++ b/Source/CTest/cmCTestP4.cxx @@ -146,8 +146,7 @@ private: cmCTestP4::User cmCTestP4::GetUserData(const std::string& username) { - std::map<std::string, cmCTestP4::User>::const_iterator it = - Users.find(username); + auto it = Users.find(username); if (it == Users.end()) { std::vector<char const*> p4_users; diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 23c6b0d..c5bb826 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -571,8 +571,7 @@ bool cmCTestRunTest::StartTest(size_t completed, size_t total) void cmCTestRunTest::ComputeArguments() { this->Arguments.clear(); // reset because this might be a rerun - std::vector<std::string>::const_iterator j = - this->TestProperties->Args.begin(); + auto j = this->TestProperties->Args.begin(); ++j; // skip test name // find the test executable if (this->TestHandler->MemCheck) { diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index 6d8077f..a945111 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -169,7 +169,7 @@ void cmCTestSVN::GuessBase(SVNInfo& svninfo, slash = svninfo.URL.find('/', slash + 1)) { // If the URL suffix is a prefix of at least one path then it is the base. std::string base = cmCTest::DecodeURL(svninfo.URL.substr(slash)); - for (std::vector<Change>::const_iterator ci = changes.begin(); + for (auto ci = changes.begin(); svninfo.Base.empty() && ci != changes.end(); ++ci) { if (cmCTestSVNPathStarts(ci->Path, base)) { svninfo.Base = base; diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index f67b11a..2ece411 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -690,8 +690,7 @@ void cmCTestTestHandler::PrintLabelOrSubprojectSummary(bool doSubProject) for (std::string const& l : p.Labels) { // first check to see if the current label is a subproject label bool isSubprojectLabel = false; - std::vector<std::string>::iterator subproject = - std::find(subprojects.begin(), subprojects.end(), l); + auto subproject = std::find(subprojects.begin(), subprojects.end(), l); if (subproject != subprojects.end()) { isSubprojectLabel = true; } @@ -945,8 +944,7 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const FixtureDependencies fixtureSetups; FixtureDependencies fixtureCleanups; - for (ListOfTests::const_iterator it = this->TestList.begin(); - it != this->TestList.end(); ++it) { + for (auto it = this->TestList.begin(); it != this->TestList.end(); ++it) { const cmCTestTestProperties& p = *it; for (std::string const& deps : p.FixturesSetup) { @@ -1007,8 +1005,7 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const // cleanup tests depend on this test case later. std::pair<FixtureDepsIterator, FixtureDepsIterator> setupRange = fixtureSetups.equal_range(requiredFixtureName); - for (FixtureDepsIterator sIt = setupRange.first; - sIt != setupRange.second; ++sIt) { + for (auto sIt = setupRange.first; sIt != setupRange.second; ++sIt) { const std::string& setupTestName = sIt->second->Name; tests[i].RequireSuccessDepends.insert(setupTestName); if (!cmContains(tests[i].Depends, setupTestName)) { @@ -1031,8 +1028,7 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const !excludeSetupRegex.find(requiredFixtureName)) { std::pair<FixtureDepsIterator, FixtureDepsIterator> fixtureRange = fixtureSetups.equal_range(requiredFixtureName); - for (FixtureDepsIterator it = fixtureRange.first; - it != fixtureRange.second; ++it) { + for (auto it = fixtureRange.first; it != fixtureRange.second; ++it) { ListOfTests::const_iterator lotIt = it->second; const cmCTestTestProperties& p = *lotIt; @@ -1063,8 +1059,7 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const !excludeCleanupRegex.find(requiredFixtureName)) { std::pair<FixtureDepsIterator, FixtureDepsIterator> fixtureRange = fixtureCleanups.equal_range(requiredFixtureName); - for (FixtureDepsIterator it = fixtureRange.first; - it != fixtureRange.second; ++it) { + for (auto it = fixtureRange.first; it != fixtureRange.second; ++it) { ListOfTests::const_iterator lotIt = it->second; const cmCTestTestProperties& p = *lotIt; @@ -1112,8 +1107,7 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const // This cleanup test could be part of the original test list that was // passed in. It is then possible that no other test requires the // fIt fixture, so we have to check for this. - std::map<std::string, std::vector<size_t>>::const_iterator cIt = - fixtureRequirements.find(fixture); + auto cIt = fixtureRequirements.find(fixture); if (cIt != fixtureRequirements.end()) { const std::vector<size_t>& indices = cIt->second; for (size_t index : indices) { @@ -1819,8 +1813,7 @@ void cmCTestTestHandler::ExpandTestsToRunInformation(size_t numTests) std::sort(this->TestsToRun.begin(), this->TestsToRun.end(), std::less<int>()); // remove duplicates - std::vector<int>::iterator new_end = - std::unique(this->TestsToRun.begin(), this->TestsToRun.end()); + auto new_end = std::unique(this->TestsToRun.begin(), this->TestsToRun.end()); this->TestsToRun.erase(new_end, this->TestsToRun.end()); } @@ -2257,8 +2250,7 @@ bool cmCTestTestHandler::SetTestsProperties( // sort the array std::sort(rt.Labels.begin(), rt.Labels.end()); // remove duplicates - std::vector<std::string>::iterator new_end = - std::unique(rt.Labels.begin(), rt.Labels.end()); + auto new_end = std::unique(rt.Labels.begin(), rt.Labels.end()); rt.Labels.erase(new_end, rt.Labels.end()); } if (key == "MEASUREMENT") { @@ -2337,8 +2329,7 @@ bool cmCTestTestHandler::SetDirectoryProperties( // sort the array std::sort(rt.Labels.begin(), rt.Labels.end()); // remove duplicates - std::vector<std::string>::iterator new_end = - std::unique(rt.Labels.begin(), rt.Labels.end()); + auto new_end = std::unique(rt.Labels.begin(), rt.Labels.end()); rt.Labels.erase(new_end, rt.Labels.end()); } } diff --git a/Source/CTest/cmParseCacheCoverage.cxx b/Source/CTest/cmParseCacheCoverage.cxx index cd2bb1a..b3ef7d3 100644 --- a/Source/CTest/cmParseCacheCoverage.cxx +++ b/Source/CTest/cmParseCacheCoverage.cxx @@ -47,8 +47,7 @@ void cmParseCacheCoverage::RemoveUnCoveredFiles() { // loop over the coverage data computed and remove all files // that only have -1 or 0 for the lines. - cmCTestCoverageHandlerContainer::TotalCoverageMap::iterator ci = - this->Coverage.TotalCoverage.begin(); + auto ci = this->Coverage.TotalCoverage.begin(); while (ci != this->Coverage.TotalCoverage.end()) { cmCTestCoverageHandlerContainer::SingleFileCoverageVector& v = ci->second; bool nothing = true; diff --git a/Source/CTest/cmParseMumpsCoverage.cxx b/Source/CTest/cmParseMumpsCoverage.cxx index afd7dc3..596b72e 100644 --- a/Source/CTest/cmParseMumpsCoverage.cxx +++ b/Source/CTest/cmParseMumpsCoverage.cxx @@ -123,8 +123,7 @@ bool cmParseMumpsCoverage::LoadPackages(const char* d) bool cmParseMumpsCoverage::FindMumpsFile(std::string const& routine, std::string& filepath) { - std::map<std::string, std::string>::iterator i = - this->RoutineToDirectory.find(routine); + auto i = this->RoutineToDirectory.find(routine); if (i != this->RoutineToDirectory.end()) { filepath = i->second; return true; |