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.
This commit is contained in:
Regina Pfeifer
2019-09-04 22:17:22 +02:00
parent bbf48c494a
commit d25a5a7ec9
87 changed files with 289 additions and 449 deletions
+2 -1
View File
@@ -12,7 +12,6 @@ misc-*,\
modernize-*,\
-modernize-avoid-c-arrays,\
-modernize-deprecated-headers,\
-modernize-use-auto,\
-modernize-use-nodiscard,\
-modernize-use-noexcept,\
-modernize-use-transparent-functors,\
@@ -33,4 +32,6 @@ CheckOptions:
value: '1'
- key: modernize-use-equals-default.IgnoreMacros
value: '0'
- key: modernize-use-auto.MinTypeNameLength
value: '80'
...
+11 -17
View File
@@ -77,8 +77,7 @@ int cmCPackIFWGenerator::PackageFiles()
if (!this->OnlineOnly && !this->DownloadedPackages.empty()) {
ifwCmd.emplace_back("-i");
std::set<cmCPackIFWPackage*>::iterator it =
this->DownloadedPackages.begin();
auto it = this->DownloadedPackages.begin();
ifwArg = (*it)->Name;
++it;
while (it != this->DownloadedPackages.end()) {
@@ -137,8 +136,7 @@ int cmCPackIFWGenerator::PackageFiles()
if (!this->Installer.Resources.empty()) {
ifwCmd.emplace_back("-r");
std::vector<std::string>::iterator it =
this->Installer.Resources.begin();
auto it = this->Installer.Resources.begin();
std::string path = this->toplevel + "/resources/";
ifwArg = path + *it;
++it;
@@ -180,8 +178,7 @@ int cmCPackIFWGenerator::PackageFiles()
} else if (!this->DownloadedPackages.empty() &&
!this->Installer.RemoteRepositories.empty()) {
ifwCmd.emplace_back("-e");
std::set<cmCPackIFWPackage*>::iterator it =
this->DownloadedPackages.begin();
auto it = this->DownloadedPackages.begin();
ifwArg = (*it)->Name;
++it;
while (it != this->DownloadedPackages.end()) {
@@ -193,14 +190,13 @@ int cmCPackIFWGenerator::PackageFiles()
ifwCmd.emplace_back("-i");
ifwArg.clear();
// Binary
std::set<cmCPackIFWPackage*>::iterator bit =
this->BinaryPackages.begin();
auto bit = this->BinaryPackages.begin();
while (bit != this->BinaryPackages.end()) {
ifwArg += (*bit)->Name + ",";
++bit;
}
// Depend
DependenceMap::iterator it = this->DependentPackages.begin();
auto it = this->DependentPackages.begin();
ifwArg += it->second.Name;
++it;
while (it != this->DependentPackages.end()) {
@@ -410,7 +406,7 @@ std::string cmCPackIFWGenerator::GetComponentInstallDirNameSuffix(
cmCPackComponent* cmCPackIFWGenerator::GetComponent(
const std::string& projectName, const std::string& componentName)
{
ComponentsMap::iterator cit = this->Components.find(componentName);
auto cit = this->Components.find(componentName);
if (cit != this->Components.end()) {
return &(cit->second);
}
@@ -422,7 +418,7 @@ cmCPackComponent* cmCPackIFWGenerator::GetComponent(
}
std::string name = this->GetComponentPackageName(component);
PackagesMap::iterator pit = this->Packages.find(name);
auto pit = this->Packages.find(name);
if (pit != this->Packages.end()) {
return component;
}
@@ -462,7 +458,7 @@ cmCPackComponentGroup* cmCPackIFWGenerator::GetComponentGroup(
}
std::string name = this->GetGroupPackageName(group);
PackagesMap::iterator pit = this->Packages.find(name);
auto pit = this->Packages.find(name);
if (pit != this->Packages.end()) {
return group;
}
@@ -593,23 +589,21 @@ std::string cmCPackIFWGenerator::GetComponentPackageName(
cmCPackIFWPackage* cmCPackIFWGenerator::GetGroupPackage(
cmCPackComponentGroup* group) const
{
std::map<cmCPackComponentGroup*, cmCPackIFWPackage*>::const_iterator pit =
this->GroupPackages.find(group);
auto pit = this->GroupPackages.find(group);
return pit != this->GroupPackages.end() ? pit->second : nullptr;
}
cmCPackIFWPackage* cmCPackIFWGenerator::GetComponentPackage(
cmCPackComponent* component) const
{
std::map<cmCPackComponent*, cmCPackIFWPackage*>::const_iterator pit =
this->ComponentPackages.find(component);
auto pit = this->ComponentPackages.find(component);
return pit != this->ComponentPackages.end() ? pit->second : nullptr;
}
cmCPackIFWRepository* cmCPackIFWGenerator::GetRepository(
const std::string& repositoryName)
{
RepositoriesMap::iterator rit = this->Repositories.find(repositoryName);
auto rit = this->Repositories.find(repositoryName);
if (rit != this->Repositories.end()) {
return &(rit->second);
}
+3 -3
View File
@@ -620,7 +620,7 @@ void cmCPackIFWPackage::GeneratePackageFile()
// Write dependencies
if (!compDepSet.empty()) {
std::ostringstream dependencies;
std::set<DependenceStruct>::iterator it = compDepSet.begin();
auto it = compDepSet.begin();
dependencies << it->NameWithCompare();
++it;
while (it != compDepSet.end()) {
@@ -638,7 +638,7 @@ void cmCPackIFWPackage::GeneratePackageFile()
// Write automatic dependency on
if (!compAutoDepSet.empty()) {
std::ostringstream dependencies;
std::set<DependenceStruct>::iterator it = compAutoDepSet.begin();
auto it = compAutoDepSet.begin();
dependencies << it->NameWithCompare();
++it;
while (it != compAutoDepSet.end()) {
@@ -674,7 +674,7 @@ void cmCPackIFWPackage::GeneratePackageFile()
// Replaces
if (!this->Replaces.empty()) {
std::ostringstream replaces;
std::vector<std::string>::iterator it = this->Replaces.begin();
auto it = this->Replaces.begin();
replaces << *it;
++it;
while (it != this->Replaces.end()) {
+1 -2
View File
@@ -158,8 +158,7 @@ cmCPackGenerator* cmCPackGeneratorFactory::NewGenerator(
cmCPackGenerator* cmCPackGeneratorFactory::NewGeneratorInternal(
const std::string& name)
{
cmCPackGeneratorFactory::t_GeneratorCreatorsMap::iterator it =
this->GeneratorCreators.find(name);
auto it = this->GeneratorCreators.find(name);
if (it == this->GeneratorCreators.end()) {
return nullptr;
}
+3 -6
View File
@@ -184,8 +184,7 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup)
// The default behavior is to have one package by component group
// unless CPACK_COMPONENTS_IGNORE_GROUP is specified.
if (!ignoreGroup) {
std::map<std::string, cmCPackComponentGroup>::iterator mainCompGIt =
this->ComponentGroups.end();
auto mainCompGIt = this->ComponentGroups.end();
std::map<std::string, cmCPackComponentGroup>::iterator compGIt;
for (compGIt = this->ComponentGroups.begin();
@@ -206,8 +205,7 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup)
retval &= PackageOnePack(initialTopLevel, compGIt->first);
}
// Handle Orphan components (components not belonging to any groups)
std::map<std::string, cmCPackComponent>::iterator mainCompIt =
this->Components.end();
auto mainCompIt = this->Components.end();
std::map<std::string, cmCPackComponent>::iterator compIt;
for (compIt = this->Components.begin(); compIt != this->Components.end();
++compIt) {
@@ -251,8 +249,7 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup)
// CPACK_COMPONENTS_IGNORE_GROUPS is set
// We build 1 package per component
else {
std::map<std::string, cmCPackComponent>::iterator mainCompIt =
this->Components.end();
auto mainCompIt = this->Components.end();
std::map<std::string, cmCPackComponent>::iterator compIt;
for (compIt = this->Components.begin(); compIt != this->Components.end();
+6 -7
View File
@@ -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);
}
+3 -6
View File
@@ -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;
}
+1 -2
View File
@@ -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;
+1 -2
View File
@@ -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) {
+1 -1
View File
@@ -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;
+9 -18
View File
@@ -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());
}
}
+1 -2
View File
@@ -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;
+1 -2
View File
@@ -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;
+1 -2
View File
@@ -107,8 +107,7 @@ void StartCompilerSetup::setGenerators(
->GeneratorDefaultPlatform[QString::fromLocal8Bit(gen.name.c_str())] =
QString::fromLocal8Bit(gen.defaultPlatform.c_str());
std::vector<std::string>::const_iterator platformIt =
gen.supportedPlatforms.cbegin();
auto platformIt = gen.supportedPlatforms.cbegin();
while (platformIt != gen.supportedPlatforms.cend()) {
this->GeneratorSupportedPlatforms.insert(
+1 -1
View File
@@ -20,7 +20,7 @@ bool cmAddExecutableCommand(std::vector<std::string> const& args,
}
cmMakefile& mf = status.GetMakefile();
std::vector<std::string>::const_iterator s = args.begin();
auto s = args.begin();
std::string const& exename = *s;
+1 -1
View File
@@ -34,7 +34,7 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
bool importTarget = false;
bool importGlobal = false;
std::vector<std::string>::const_iterator s = args.begin();
auto s = args.begin();
std::string const& libName = *s;
+3 -3
View File
@@ -165,14 +165,14 @@ typename Range::const_iterator cmRemoveIndices(Range& r, InputRange const& rem)
{
typename InputRange::const_iterator remIt = rem.begin();
typename InputRange::const_iterator remEnd = rem.end();
const typename Range::iterator rangeEnd = r.end();
const auto rangeEnd = r.end();
if (remIt == remEnd) {
return rangeEnd;
}
typename Range::iterator writer = r.begin();
auto writer = r.begin();
std::advance(writer, *remIt);
typename Range::iterator pivot = writer;
auto pivot = writer;
typename InputRange::value_type prevRem = *remIt;
++remIt;
size_t count = 1;
+1 -1
View File
@@ -531,7 +531,7 @@ void CCONV* cmGetSource(void* arg, const char* name)
cmMakefile* mf = static_cast<cmMakefile*>(arg);
if (cmSourceFile* rsf = mf->GetSource(name)) {
// Lookup the proxy source file object for this source.
cmCPluginAPISourceFileMap::iterator i = cmCPluginAPISourceFiles.find(rsf);
auto i = cmCPluginAPISourceFiles.find(rsf);
if (i == cmCPluginAPISourceFiles.end()) {
// Create a proxy source file object for this source.
cmCPluginAPISourceFile* sf = new cmCPluginAPISourceFile;
+1 -2
View File
@@ -1483,8 +1483,7 @@ std::vector<std::string> cmCTest::GetLabelsForSubprojects()
// sort the array
std::sort(subprojects.begin(), subprojects.end());
// remove duplicates
std::vector<std::string>::iterator new_end =
std::unique(subprojects.begin(), subprojects.end());
auto new_end = std::unique(subprojects.begin(), subprojects.end());
subprojects.erase(new_end, subprojects.end());
return subprojects;
+3 -3
View File
@@ -480,7 +480,7 @@ void cmCacheManager::OutputNewlineTruncationWarning(std::ostream& fout,
void cmCacheManager::RemoveCacheEntry(const std::string& key)
{
CacheEntryMap::iterator i = this->Cache.find(key);
auto i = this->Cache.find(key);
if (i != this->Cache.end()) {
this->Cache.erase(i);
}
@@ -489,7 +489,7 @@ void cmCacheManager::RemoveCacheEntry(const std::string& key)
cmCacheManager::CacheEntry* cmCacheManager::GetCacheEntry(
const std::string& key)
{
CacheEntryMap::iterator i = this->Cache.find(key);
auto i = this->Cache.find(key);
if (i != this->Cache.end()) {
return &i->second;
}
@@ -504,7 +504,7 @@ cmCacheManager::CacheIterator cmCacheManager::GetCacheIterator(const char* key)
const std::string* cmCacheManager::GetInitializedCacheValue(
const std::string& key) const
{
CacheEntryMap::const_iterator i = this->Cache.find(key);
auto i = this->Cache.find(key);
if (i != this->Cache.end() && i->second.Initialized) {
return &i->second.Value;
}
+3 -3
View File
@@ -96,7 +96,7 @@ void cmCommonTargetGenerator::AppendFortranFormatFlags(
std::string cmCommonTargetGenerator::GetFlags(const std::string& l)
{
ByLanguageMap::iterator i = this->FlagsByLanguage.find(l);
auto i = this->FlagsByLanguage.find(l);
if (i == this->FlagsByLanguage.end()) {
std::string flags;
@@ -111,7 +111,7 @@ std::string cmCommonTargetGenerator::GetFlags(const std::string& l)
std::string cmCommonTargetGenerator::GetDefines(const std::string& l)
{
ByLanguageMap::iterator i = this->DefinesByLanguage.find(l);
auto i = this->DefinesByLanguage.find(l);
if (i == this->DefinesByLanguage.end()) {
std::set<std::string> defines;
this->LocalCommonGenerator->GetTargetDefines(this->GeneratorTarget,
@@ -128,7 +128,7 @@ std::string cmCommonTargetGenerator::GetDefines(const std::string& l)
std::string cmCommonTargetGenerator::GetIncludes(std::string const& l)
{
ByLanguageMap::iterator i = this->IncludesByLanguage.find(l);
auto i = this->IncludesByLanguage.find(l);
if (i == this->IncludesByLanguage.end()) {
std::string includes;
this->AddIncludeFlags(includes, l);
+4 -7
View File
@@ -283,8 +283,7 @@ std::map<cmLinkItem, int>::iterator cmComputeLinkDepends::AllocateLinkEntry(
{
std::map<cmLinkItem, int>::value_type index_entry(
item, static_cast<int>(this->EntryList.size()));
std::map<cmLinkItem, int>::iterator lei =
this->LinkEntryIndex.insert(index_entry).first;
auto lei = this->LinkEntryIndex.insert(index_entry).first;
this->EntryList.emplace_back();
this->InferredDependSets.push_back(nullptr);
this->EntryConstraintGraph.emplace_back();
@@ -294,7 +293,7 @@ std::map<cmLinkItem, int>::iterator cmComputeLinkDepends::AllocateLinkEntry(
int cmComputeLinkDepends::AddLinkEntry(cmLinkItem const& item)
{
// Check if the item entry has already been added.
std::map<cmLinkItem, int>::iterator lei = this->LinkEntryIndex.find(item);
auto lei = this->LinkEntryIndex.find(item);
if (lei != this->LinkEntryIndex.end()) {
// Yes. We do not need to follow the item's dependencies again.
return lei->second;
@@ -394,8 +393,7 @@ void cmComputeLinkDepends::QueueSharedDependencies(
void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep)
{
// Check if the target already has an entry.
std::map<cmLinkItem, int>::iterator lei =
this->LinkEntryIndex.find(dep.Item);
auto lei = this->LinkEntryIndex.find(dep.Item);
if (lei == this->LinkEntryIndex.end()) {
// Allocate a spot for the item entry.
lei = this->AllocateLinkEntry(dep.Item);
@@ -719,8 +717,7 @@ void cmComputeLinkDepends::VisitEntry(int index)
// This entry has now been seen. Update its component.
bool completed = false;
int component = this->CCG->GetComponentMap()[index];
std::map<int, PendingComponent>::iterator mi =
this->PendingComponents.find(this->ComponentOrder[component]);
auto mi = this->PendingComponents.find(this->ComponentOrder[component]);
if (mi != this->PendingComponents.end()) {
// The entry is in an already pending component.
PendingComponent& pc = mi->second;
+1 -2
View File
@@ -1332,8 +1332,7 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item,
std::string const& file)
{
// Do not depend on things that do not exist.
std::vector<std::string>::iterator i =
std::find(this->Depends.begin(), this->Depends.end(), item);
auto i = std::find(this->Depends.begin(), this->Depends.end(), item);
if (i != this->Depends.end()) {
this->Depends.erase(i);
}
+3 -5
View File
@@ -140,8 +140,7 @@ void cmComputeTargetDepends::GetTargetDirectDepends(cmGeneratorTarget const* t,
{
// Lookup the index for this target. All targets should be known by
// this point.
std::map<cmGeneratorTarget const*, int>::const_iterator tii =
this->TargetIndex.find(t);
auto tii = this->TargetIndex.find(t);
assert(tii != this->TargetIndex.end());
int i = tii->second;
@@ -149,7 +148,7 @@ void cmComputeTargetDepends::GetTargetDirectDepends(cmGeneratorTarget const* t,
EdgeList const& nl = this->FinalGraph[i];
for (cmGraphEdge const& ni : nl) {
cmGeneratorTarget const* dep = this->Targets[ni];
cmTargetDependSet::iterator di = deps.insert(dep).first;
auto di = deps.insert(dep).first;
di->SetType(ni.IsStrong());
di->SetBacktrace(ni.GetBacktrace());
}
@@ -368,8 +367,7 @@ void cmComputeTargetDepends::AddTargetDepend(
} else {
// Lookup the index for this target. All targets should be known by
// this point.
std::map<cmGeneratorTarget const*, int>::const_iterator tii =
this->TargetIndex.find(dependee);
auto tii = this->TargetIndex.find(dependee);
assert(tii != this->TargetIndex.end());
int dependee_index = tii->second;
+6 -6
View File
@@ -367,7 +367,7 @@ bool cmConditionEvaluator::HandleLevel0(cmArgumentList& newArgs,
int reducible;
do {
reducible = 0;
cmArgumentList::iterator arg = newArgs.begin();
auto arg = newArgs.begin();
while (arg != newArgs.end()) {
if (IsKeyword(keyParenL, *arg)) {
// search for the closing paren for this opening one
@@ -393,7 +393,7 @@ bool cmConditionEvaluator::HandleLevel0(cmArgumentList& newArgs,
std::vector<cmExpandedCommandArgument> newArgs2;
// copy to the list structure
cmArgumentList::iterator argP1 = arg;
auto argP1 = arg;
argP1++;
cmAppend(newArgs2, argP1, argClose);
newArgs2.pop_back();
@@ -424,7 +424,7 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList& newArgs, std::string&,
int reducible;
do {
reducible = 0;
cmArgumentList::iterator arg = newArgs.begin();
auto arg = newArgs.begin();
cmArgumentList::iterator argP1;
cmArgumentList::iterator argP2;
while (arg != newArgs.end()) {
@@ -524,7 +524,7 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs,
const char* def2;
do {
reducible = 0;
cmArgumentList::iterator arg = newArgs.begin();
auto arg = newArgs.begin();
cmArgumentList::iterator argP1;
cmArgumentList::iterator argP2;
while (arg != newArgs.end()) {
@@ -700,7 +700,7 @@ bool cmConditionEvaluator::HandleLevel3(cmArgumentList& newArgs,
int reducible;
do {
reducible = 0;
cmArgumentList::iterator arg = newArgs.begin();
auto arg = newArgs.begin();
cmArgumentList::iterator argP1;
cmArgumentList::iterator argP2;
while (arg != newArgs.end()) {
@@ -728,7 +728,7 @@ bool cmConditionEvaluator::HandleLevel4(cmArgumentList& newArgs,
bool rhs;
do {
reducible = 0;
cmArgumentList::iterator arg = newArgs.begin();
auto arg = newArgs.begin();
cmArgumentList::iterator argP1;
cmArgumentList::iterator argP2;
while (arg != newArgs.end()) {
+2 -2
View File
@@ -20,7 +20,7 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args,
return false;
}
std::vector<std::string>::const_iterator i = args.begin();
auto i = args.begin();
std::string extraInclude;
std::string function;
std::vector<std::string> tests;
@@ -67,7 +67,7 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args,
configFile += "/Templates/TestDriver.cxx.in";
// Create the test driver file
std::vector<std::string>::const_iterator testsBegin = i;
auto testsBegin = i;
std::vector<std::string> tests_func_name;
// The rest of the arguments consist of a list of test source files.
+1 -2
View File
@@ -33,8 +33,7 @@ bool cmDepends::Write(std::ostream& makeDepends, std::ostream& internalDepends)
cmMakefile* mf = this->LocalGenerator->GetMakefile();
cmExpandList(mf->GetSafeDefinition(srcLang), pairs);
}
for (std::vector<std::string>::iterator si = pairs.begin();
si != pairs.end();) {
for (auto si = pairs.begin(); si != pairs.end();) {
// Get the source and object file.
std::string const& src = *si++;
if (si == pairs.end()) {
+1 -2
View File
@@ -438,8 +438,7 @@ void cmDependsC::TransformLine(std::string& line)
if (!this->IncludeRegexTransform.find(line)) {
return;
}
TransformRulesType::const_iterator tri =
this->TransformRules.find(this->IncludeRegexTransform.match(3));
auto tri = this->TransformRules.find(this->IncludeRegexTransform.match(3));
if (tri == this->TransformRules.end()) {
return;
}
+3 -9
View File
@@ -56,8 +56,7 @@ public:
cmFortranSourceInfo& CreateObjectInfo(const std::string& obj,
const std::string& src)
{
std::map<std::string, cmFortranSourceInfo>::iterator i =
this->ObjectInfo.find(obj);
auto i = this->ObjectInfo.find(obj);
if (i == this->ObjectInfo.end()) {
std::map<std::string, cmFortranSourceInfo>::value_type entry(
obj, cmFortranSourceInfo());
@@ -303,9 +302,7 @@ void cmDependsFortran::ConsiderModule(const std::string& name,
const std::string& stampDir)
{
// Locate each required module.
using TargetRequiresMap = cmDependsFortranInternals::TargetRequiresMap;
TargetRequiresMap::iterator required =
this->Internal->TargetRequires.find(name);
auto required = this->Internal->TargetRequires.find(name);
if (required != this->Internal->TargetRequires.end() &&
required->second.empty()) {
// The module is provided by a CMake target. It will have a stamp file.
@@ -321,8 +318,6 @@ bool cmDependsFortran::WriteDependenciesReal(std::string const& obj,
std::ostream& makeDepends,
std::ostream& internalDepends)
{
using TargetRequiresMap = cmDependsFortranInternals::TargetRequiresMap;
// Get the source file for this object.
std::string const& src = info.Source;
@@ -350,8 +345,7 @@ bool cmDependsFortran::WriteDependenciesReal(std::string const& obj,
// The object file should depend on timestamped files for the
// modules it uses.
TargetRequiresMap::const_iterator required =
this->Internal->TargetRequires.find(i);
auto required = this->Internal->TargetRequires.find(i);
if (required == this->Internal->TargetRequires.end()) {
abort();
}
+2 -4
View File
@@ -39,8 +39,7 @@ void cmDynamicLoaderCache::CacheFile(const char* path,
bool cmDynamicLoaderCache::GetCacheFile(const char* path,
cmsys::DynamicLoader::LibraryHandle& p)
{
std::map<std::string, cmsys::DynamicLoader::LibraryHandle>::iterator it =
this->CacheMap.find(path);
auto it = this->CacheMap.find(path);
if (it != this->CacheMap.end()) {
p = it->second;
return true;
@@ -50,8 +49,7 @@ bool cmDynamicLoaderCache::GetCacheFile(const char* path,
bool cmDynamicLoaderCache::FlushCache(const char* path)
{
std::map<std::string, cmsys::DynamicLoader::LibraryHandle>::iterator it =
this->CacheMap.find(path);
auto it = this->CacheMap.find(path);
bool ret = false;
if (it != this->CacheMap.end()) {
cmsys::DynamicLoader::CloseLibrary(it->second);
+2 -4
View File
@@ -585,8 +585,7 @@ cmELF::StringEntry const* cmELFInternalImpl<Types>::GetDynamicSectionString(
unsigned int tag)
{
// Short-circuit if already checked.
std::map<unsigned int, StringEntry>::iterator dssi =
this->DynamicSectionStrings.find(tag);
auto dssi = this->DynamicSectionStrings.find(tag);
if (dssi != this->DynamicSectionStrings.end()) {
if (dssi->second.Position > 0) {
return &dssi->second;
@@ -614,8 +613,7 @@ cmELF::StringEntry const* cmELFInternalImpl<Types>::GetDynamicSectionString(
ELF_Shdr const& strtab = this->SectionHeaders[sec.sh_link];
// Look for the requested entry.
for (typename std::vector<ELF_Dyn>::iterator di =
this->DynamicSectionEntries.begin();
for (auto di = this->DynamicSectionEntries.begin();
di != this->DynamicSectionEntries.end(); ++di) {
ELF_Dyn& dyn = *di;
if (static_cast<tagtype>(dyn.d_tag) == static_cast<tagtype>(tag)) {
+1 -1
View File
@@ -1185,7 +1185,7 @@ void cmExportFileGenerator::GenerateImportedFileChecksCode(
<< targetName << " ";
for (std::string const& li : importedLocations) {
ImportPropertyMap::const_iterator pi = properties.find(li);
auto pi = properties.find(li);
if (pi != properties.end()) {
os << cmExportFileGeneratorEscape(pi->second) << " ";
}
+1 -1
View File
@@ -9,7 +9,7 @@
cmExportSet* cmExportSetMap::operator[](const std::string& name)
{
std::map<std::string, cmExportSet*>::iterator it = this->find(name);
auto it = this->find(name);
if (it == this->end()) // Export set not found
{
it = this->insert(std::make_pair(name, new cmExportSet(name))).first;
+1 -2
View File
@@ -573,8 +573,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(
cmAppend(allIncludeDirs, cmExpandedList(systemIncludeDirs));
}
std::vector<std::string>::const_iterator end =
cmRemoveDuplicates(allIncludeDirs);
auto end = cmRemoveDuplicates(allIncludeDirs);
for (std::string const& str : cmMakeRange(allIncludeDirs.cbegin(), end)) {
xml.StartElement("Add");
+1 -1
View File
@@ -307,7 +307,7 @@ void cmExtraCodeLiteGenerator::FindMatchingHeaderfiles(
for (std::string const& ext : headerExts) {
std::string hname = cmStrCat(headerBasename, '.', ext);
// if it's already in the set, don't check if it exists on disk
std::set<std::string>::const_iterator headerIt = otherFiles.find(hname);
auto headerIt = otherFiles.find(hname);
if (headerIt != otherFiles.end()) {
break;
}
+2 -2
View File
@@ -800,7 +800,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
// the list must contain only definition-value pairs:
if ((defs.size() % 2) == 0) {
std::vector<std::string>::const_iterator di = defs.begin();
auto di = defs.begin();
while (di != defs.end()) {
std::string def = *di;
++di;
@@ -832,7 +832,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
// the list must contain only definition-value pairs:
if ((defs.size() % 2) == 0) {
std::vector<std::string>::const_iterator di = defs.begin();
auto di = defs.begin();
while (di != defs.end()) {
std::string def = *di;
++di;
+1 -1
View File
@@ -242,7 +242,7 @@ void cmExtraSublimeTextGenerator::AppendTarget(
target->GetSourceFiles(sourceFiles,
makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
for (cmSourceFile* sourceFile : sourceFiles) {
MapSourceFileFlags::iterator sourceFileFlagsIter =
auto sourceFileFlagsIter =
sourceFileFlags.find(sourceFile->ResolveFullPath());
if (sourceFileFlagsIter == sourceFileFlags.end()) {
sourceFileFlagsIter =
+1 -2
View File
@@ -823,8 +823,7 @@ void Target::ProcessLanguage(std::string const& lang)
Json::ArrayIndex Target::AddSourceGroup(cmSourceGroup* sg, Json::ArrayIndex si)
{
std::unordered_map<cmSourceGroup const*, Json::ArrayIndex>::iterator i =
this->SourceGroupsMap.find(sg);
auto i = this->SourceGroupsMap.find(sg);
if (i == this->SourceGroupsMap.end()) {
auto sgIndex = static_cast<Json::ArrayIndex>(this->SourceGroups.size());
i = this->SourceGroupsMap.emplace(sg, sgIndex).first;
+4 -4
View File
@@ -91,7 +91,7 @@ std::string fix_file_url_windows(const std::string& url)
bool HandleWriteImpl(std::vector<std::string> const& args, bool append,
cmExecutionStatus& status)
{
std::vector<std::string>::const_iterator i = args.begin();
auto i = args.begin();
i++; // Get rid of subcommand
@@ -663,7 +663,7 @@ bool HandleGlobImpl(std::vector<std::string> const& args, bool recurse,
// File commands has at least one argument
assert(args.size() > 1);
std::vector<std::string>::const_iterator i = args.begin();
auto i = args.begin();
i++; // Get rid of subcommand
@@ -1585,7 +1585,7 @@ bool HandleDownloadCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
#if !defined(CMAKE_BOOTSTRAP)
std::vector<std::string>::const_iterator i = args.begin();
auto i = args.begin();
if (args.size() < 3) {
status.SetError("DOWNLOAD must be called with at least three arguments.");
return false;
@@ -1955,7 +1955,7 @@ bool HandleUploadCommand(std::vector<std::string> const& args,
status.SetError("UPLOAD must be called with at least three arguments.");
return false;
}
std::vector<std::string>::const_iterator i = args.begin();
auto i = args.begin();
++i;
std::string filename = *i;
++i;
+4 -6
View File
@@ -847,8 +847,7 @@ bool cmFindPackageCommand::HandlePackageMode(
// If there are files in ConsideredConfigs, it means that FooConfig.cmake
// have been found, but they didn't have appropriate versions.
else if (!this->ConsideredConfigs.empty()) {
std::vector<ConfigFileInfo>::const_iterator duplicate_end =
cmRemoveDuplicates(this->ConsideredConfigs);
auto duplicate_end = cmRemoveDuplicates(this->ConsideredConfigs);
e << "Could not find a configuration file for package \"" << this->Name
<< "\" that "
<< (this->VersionExact ? "exactly matches" : "is compatible with")
@@ -1080,7 +1079,7 @@ void cmFindPackageCommand::AppendToFoundProperty(bool found)
std::string tmp = foundProp;
cmExpandList(tmp, foundContents, false);
std::vector<std::string>::iterator nameIt =
auto nameIt =
std::find(foundContents.begin(), foundContents.end(), this->Name);
if (nameIt != foundContents.end()) {
foundContents.erase(nameIt);
@@ -1094,7 +1093,7 @@ void cmFindPackageCommand::AppendToFoundProperty(bool found)
std::string tmp = notFoundProp;
cmExpandList(tmp, notFoundContents, false);
std::vector<std::string>::iterator nameIt =
auto nameIt =
std::find(notFoundContents.begin(), notFoundContents.end(), this->Name);
if (nameIt != notFoundContents.end()) {
notFoundContents.erase(nameIt);
@@ -1199,8 +1198,7 @@ void cmFindPackageCommand::FillPrefixesPackageRoot()
cmSearchPath& paths = this->LabeledPaths[PathLabel::PackageRoot];
// Add the PACKAGE_ROOT_PATH from each enclosing find_package call.
for (std::deque<std::vector<std::string>>::const_reverse_iterator pkgPaths =
this->Makefile->FindPackageRootPathStack.rbegin();
for (auto pkgPaths = this->Makefile->FindPackageRootPathStack.rbegin();
pkgPaths != this->Makefile->FindPackageRootPathStack.rend();
++pkgPaths) {
for (std::string const& path : *pkgPaths) {
+1 -2
View File
@@ -80,8 +80,7 @@ bool cmFunctionHelperCommand::operator()(
// define ARGV and ARGN
std::string argvDef = cmJoin(expandedArgs, ";");
std::vector<std::string>::const_iterator eit =
expandedArgs.begin() + (this->Args.size() - 1);
auto eit = expandedArgs.begin() + (this->Args.size() - 1);
std::string argnDef = cmJoin(cmMakeRange(eit, expandedArgs.end()), ";");
makefile.AddDefinition("ARGV", argvDef);
makefile.MarkVariableAsUsed("ARGV");
+1 -3
View File
@@ -370,9 +370,7 @@ bool cmGeneratorExpression::IsValidTargetName(const std::string& input)
void cmCompiledGeneratorExpression::GetMaxLanguageStandard(
const cmGeneratorTarget* tgt, std::map<std::string, std::string>& mapping)
{
using MapType =
std::map<cmGeneratorTarget const*, std::map<std::string, std::string>>;
MapType::const_iterator it = this->MaxLanguageStandard.find(tgt);
auto it = this->MaxLanguageStandard.find(tgt);
if (it != this->MaxLanguageStandard.end()) {
mapping = it->second;
}
+1 -2
View File
@@ -59,8 +59,7 @@ void cmGeneratorExpressionDAGChecker::Initialize()
TEST_TRANSITIVE_PROPERTY_METHOD) false)) // NOLINT(*)
#undef TEST_TRANSITIVE_PROPERTY_METHOD
{
std::map<cmGeneratorTarget const*, std::set<std::string>>::const_iterator
it = top->Seen.find(this->Target);
auto it = top->Seen.find(this->Target);
if (it != top->Seen.end()) {
const std::set<std::string>& propSet = it->second;
if (propSet.find(this->Property) != propSet.end()) {
@@ -64,8 +64,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(
outputFileName = this->FixRelativePath(outputFileName, PathForOutput, lg);
}
std::map<std::string, std::string>::iterator it =
outputFiles.find(outputFileName);
auto it = outputFiles.find(outputFileName);
if (it != outputFiles.end()) {
if (it->second == outputContent) {
+3 -8
View File
@@ -30,9 +30,7 @@ std::string GeneratorExpressionContent::ProcessArbitraryContent(
{
std::string result;
const std::vector<
std::vector<cmGeneratorExpressionEvaluator*>>::const_iterator pend =
this->ParamChildren.end();
const auto pend = this->ParamChildren.end();
for (; pit != pend; ++pit) {
for (cmGeneratorExpressionEvaluator* pExprEval : *pit) {
if (node->RequiresLiteralInput()) {
@@ -116,11 +114,8 @@ std::string GeneratorExpressionContent::EvaluateParameters(
{
const int numExpected = node->NumExpectedParameters();
{
std::vector<std::vector<cmGeneratorExpressionEvaluator*>>::const_iterator
pit = this->ParamChildren.begin();
const std::vector<
std::vector<cmGeneratorExpressionEvaluator*>>::const_iterator pend =
this->ParamChildren.end();
auto pit = this->ParamChildren.begin();
const auto pend = this->ParamChildren.end();
const bool acceptsArbitraryContent =
node->AcceptsArbitraryContentParameter();
int counter = 1;
+4 -9
View File
@@ -66,8 +66,7 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression(
unsigned int nestedLevel = this->NestingLevel;
++this->NestingLevel;
std::vector<cmGeneratorExpressionToken>::const_iterator startToken =
this->it - 1;
auto startToken = this->it - 1;
std::vector<cmGeneratorExpressionEvaluator*> identifier;
while (this->it->TokenType != cmGeneratorExpressionToken::EndExpression &&
@@ -174,13 +173,9 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression(
if (!parameters.empty()) {
extendText(result, colonToken);
using EvaluatorVector = std::vector<cmGeneratorExpressionEvaluator*>;
using TokenVector = std::vector<cmGeneratorExpressionToken>;
std::vector<EvaluatorVector>::const_iterator pit = parameters.begin();
const std::vector<EvaluatorVector>::const_iterator pend =
parameters.end();
std::vector<TokenVector::const_iterator>::const_iterator commaIt =
commaTokens.begin();
auto pit = parameters.begin();
const auto pend = parameters.end();
auto commaIt = commaTokens.begin();
assert(parameters.size() > commaTokens.size());
for (; pit != pend; ++pit, ++commaIt) {
if (!pit->empty() && !emptyParamTermination) {
+19 -28
View File
@@ -204,9 +204,8 @@ void CreatePropertyGeneratorExpressions(
std::vector<cmGeneratorTarget::TargetPropertyEntry*>& items,
bool evaluateForBuildsystem = false)
{
std::vector<cmListFileBacktrace>::const_iterator btIt = backtraces.begin();
for (std::vector<std::string>::const_iterator it = entries.begin();
it != entries.end(); ++it, ++btIt) {
auto btIt = backtraces.begin();
for (auto it = entries.begin(); it != entries.end(); ++it, ++btIt) {
items.push_back(
CreateTargetPropertyEntry(*it, *btIt, evaluateForBuildsystem));
}
@@ -471,8 +470,7 @@ std::string cmGeneratorTarget::GetOutputName(
{
// Lookup/compute/cache the output name for this configuration.
OutputNameKey key(config, artifact);
cmGeneratorTarget::OutputNameMapType::iterator i =
this->OutputNameMap.find(key);
auto i = this->OutputNameMap.find(key);
if (i == this->OutputNameMap.end()) {
// Add empty name in map to detect potential recursion.
OutputNameMapType::value_type entry(key, "");
@@ -716,7 +714,7 @@ void cmGeneratorTarget::AddIncludeDirectory(const std::string& src,
std::vector<cmSourceFile*> const* cmGeneratorTarget::GetSourceDepends(
cmSourceFile const* sf) const
{
SourceEntriesType::const_iterator i = this->SourceDepends.find(sf);
auto i = this->SourceDepends.find(sf);
if (i != this->SourceDepends.end()) {
return &i->second.Depends;
}
@@ -925,8 +923,7 @@ void cmGeneratorTarget::AddExplicitObjectName(cmSourceFile const* sf)
bool cmGeneratorTarget::HasExplicitObjectName(cmSourceFile const* file) const
{
const_cast<cmGeneratorTarget*>(this)->ComputeObjectMapping();
std::set<cmSourceFile const*>::const_iterator it =
this->ExplicitObjectName.find(file);
auto it = this->ExplicitObjectName.find(file);
return it != this->ExplicitObjectName.end();
}
@@ -1108,8 +1105,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(
}
using IncludeCacheType = std::map<std::string, std::vector<std::string>>;
IncludeCacheType::const_iterator iter =
this->SystemIncludesCache.find(config_upper);
auto iter = this->SystemIncludesCache.find(config_upper);
if (iter == this->SystemIncludesCache.end()) {
cmGeneratorExpressionDAGChecker dagChecker(
@@ -1548,7 +1544,7 @@ cmGeneratorTarget::KindedSources const& cmGeneratorTarget::GetKindedSources(
// Lookup any existing link implementation for this configuration.
std::string const key = cmSystemTools::UpperCase(config);
KindedSourcesMapType::iterator it = this->KindedSourcesMap.find(key);
auto it = this->KindedSourcesMap.find(key);
if (it != this->KindedSourcesMap.end()) {
if (!it->second.Initialized) {
std::ostringstream e;
@@ -1680,8 +1676,7 @@ void cmGeneratorTarget::ComputeAllConfigSources() const
for (size_t ci = 0; ci < configs.size(); ++ci) {
KindedSources const& sources = this->GetKindedSources(configs[ci]);
for (SourceAndKind const& src : sources.Sources) {
std::map<cmSourceFile const*, size_t>::iterator mi =
index.find(src.Source.Value);
auto mi = index.find(src.Source.Value);
if (mi == index.end()) {
AllConfigSource acs;
acs.Source = src.Source.Value;
@@ -2292,7 +2287,7 @@ cmGeneratorTarget::LinkClosure const* cmGeneratorTarget::GetLinkClosure(
const std::string& config) const
{
std::string key(cmSystemTools::UpperCase(config));
LinkClosureMapType::iterator i = this->LinkClosureMap.find(key);
auto i = this->LinkClosureMap.find(key);
if (i == this->LinkClosureMap.end()) {
LinkClosure lc;
this->ComputeLinkClosure(config, lc);
@@ -2474,8 +2469,7 @@ cmGeneratorTarget::CompileInfo const* cmGeneratorTarget::GetCompileInfo(
if (!config.empty()) {
config_upper = cmSystemTools::UpperCase(config);
}
CompileInfoMapType::const_iterator i =
this->CompileInfoMap.find(config_upper);
auto i = this->CompileInfoMap.find(config_upper);
if (i == this->CompileInfoMap.end()) {
CompileInfo info;
this->ComputePDBOutputDir("COMPILE_PDB", config, info.CompilePdbDir);
@@ -2500,8 +2494,7 @@ cmGeneratorTarget::GetModuleDefinitionInfo(std::string const& config) const
if (!config.empty()) {
config_upper = cmSystemTools::UpperCase(config);
}
ModuleDefinitionInfoMapType::const_iterator i =
this->ModuleDefinitionInfoMap.find(config_upper);
auto i = this->ModuleDefinitionInfoMap.find(config_upper);
if (i == this->ModuleDefinitionInfoMap.end()) {
ModuleDefinitionInfo info;
this->ComputeModuleDefinitionInfo(config, info);
@@ -2712,7 +2705,7 @@ void cmTargetTraceDependencies::QueueSource(cmSourceFile* sf)
void cmTargetTraceDependencies::FollowName(std::string const& name)
{
NameMapType::iterator i = this->NameMap.find(name);
auto i = this->NameMap.find(name);
if (i == this->NameMap.end()) {
// Check if we know how to generate this file.
cmSourceFile* sf = this->Makefile->GetSourceFileWithOutput(name);
@@ -4260,8 +4253,7 @@ void cmGeneratorTarget::GetTargetObjectNames(
for (cmSourceFile const* src : objectSources) {
// Find the object file name corresponding to this source file.
std::map<cmSourceFile const*, std::string>::const_iterator map_it =
mapping.find(src);
auto map_it = mapping.find(src);
// It must exist because we populated the mapping just above.
assert(!map_it->second.empty());
objects.push_back(map_it->second);
@@ -4285,8 +4277,7 @@ cmGeneratorTarget::GetTargetSourceFileFlags(const cmSourceFile* sf) const
{
struct SourceFileFlags flags;
this->ConstructSourceFileFlags();
std::map<cmSourceFile const*, SourceFileFlags>::iterator si =
this->SourceFlagsMap.find(sf);
auto si = this->SourceFlagsMap.find(sf);
if (si != this->SourceFlagsMap.end()) {
flags = si->second;
} else {
@@ -4620,7 +4611,7 @@ void cmGeneratorTarget::CheckPropertyCompatibility(
if (!prop.empty()) {
// Use a sorted std::vector to keep the error message sorted.
std::vector<std::string> props;
std::set<std::string>::const_iterator i = emittedBools.find(prop);
auto i = emittedBools.find(prop);
if (i != emittedBools.end()) {
props.push_back(strBool);
}
@@ -5065,7 +5056,7 @@ cmComputeLinkInformation* cmGeneratorTarget::GetLinkInformation(
{
// Lookup any existing information for this configuration.
std::string key(cmSystemTools::UpperCase(config));
cmTargetLinkInformationMap::iterator i = this->LinkInformation.find(key);
auto i = this->LinkInformation.find(key);
if (i == this->LinkInformation.end()) {
// Compute information for this configuration.
cmComputeLinkInformation* info =
@@ -5466,7 +5457,7 @@ cmGeneratorTarget::OutputInfo const* cmGeneratorTarget::GetOutputInfo(
if (!config.empty()) {
config_upper = cmSystemTools::UpperCase(config);
}
OutputInfoMapType::iterator i = this->OutputInfoMap.find(config_upper);
auto i = this->OutputInfoMap.find(config_upper);
if (i == this->OutputInfoMap.end()) {
// Add empty info in map to detect potential recursion.
OutputInfo info;
@@ -5865,7 +5856,7 @@ cmGeneratorTarget::ImportInfo const* cmGeneratorTarget::GetImportInfo(
config_upper = "NOCONFIG";
}
ImportInfoMapType::const_iterator i = this->ImportInfoMap.find(config_upper);
auto i = this->ImportInfoMap.find(config_upper);
if (i == this->ImportInfoMap.end()) {
ImportInfo info;
this->ComputeImportInfo(config_upper, info);
@@ -6069,7 +6060,7 @@ bool cmGeneratorTarget::GetConfigCommonSourceFiles(
std::vector<std::string> const& configs =
this->Makefile->GetGeneratorConfigs();
std::vector<std::string>::const_iterator it = configs.begin();
auto it = configs.begin();
const std::string& firstConfig = *it;
this->GetSourceFilesWithoutObjectLibraries(files, firstConfig);
+1 -1
View File
@@ -24,7 +24,7 @@ bool cmGetDirectoryPropertyCommand(std::vector<std::string> const& args,
return false;
}
std::vector<std::string>::const_iterator i = args.begin();
auto i = args.begin();
std::string const& variable = *i;
++i;
+3 -6
View File
@@ -177,8 +177,7 @@ void cmGhsMultiTargetGenerator::WriteTargetSpecifics(std::ostream& fout,
void cmGhsMultiTargetGenerator::SetCompilerFlags(std::string const& config,
const std::string& language)
{
std::map<std::string, std::string>::iterator i =
this->FlagsByLanguage.find(language);
auto i = this->FlagsByLanguage.find(language);
if (i == this->FlagsByLanguage.end()) {
std::string flags;
const char* lang = language.c_str();
@@ -209,8 +208,7 @@ void cmGhsMultiTargetGenerator::SetCompilerFlags(std::string const& config,
std::string cmGhsMultiTargetGenerator::GetDefines(const std::string& language,
std::string const& config)
{
std::map<std::string, std::string>::iterator i =
this->DefinesByLanguage.find(language);
auto i = this->DefinesByLanguage.find(language);
if (i == this->DefinesByLanguage.end()) {
std::set<std::string> defines;
const char* lang = language.c_str();
@@ -232,8 +230,7 @@ void cmGhsMultiTargetGenerator::WriteCompilerFlags(std::ostream& fout,
std::string const&,
const std::string& language)
{
std::map<std::string, std::string>::iterator flagsByLangI =
this->FlagsByLanguage.find(language);
auto flagsByLangI = this->FlagsByLanguage.find(language);
if (flagsByLangI != this->FlagsByLanguage.end()) {
if (!flagsByLangI->second.empty()) {
std::vector<std::string> ghsCompFlags =
+1 -2
View File
@@ -291,8 +291,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
// Sort the list and remove duplicates.
std::sort(lfiles.begin(), lfiles.end(), std::less<std::string>());
#if !defined(__VMS) // The Compaq STL on VMS crashes, so accept duplicates.
std::vector<std::string>::iterator new_end =
std::unique(lfiles.begin(), lfiles.end());
auto new_end = std::unique(lfiles.begin(), lfiles.end());
lfiles.erase(new_end, lfiles.end());
#endif
+7 -14
View File
@@ -582,10 +582,8 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile(
}
// sort the array
std::sort(lfiles.begin(), lfiles.end(), std::less<std::string>());
std::vector<std::string>::iterator new_end =
std::unique(lfiles.begin(), lfiles.end());
lfiles.erase(new_end, lfiles.end());
std::sort(lfiles.begin(), lfiles.end());
lfiles.erase(std::unique(lfiles.begin(), lfiles.end()), lfiles.end());
cmake* cm = this->GetCMakeInstance();
if (cm->DoWriteGlobVerifyTarget()) {
@@ -2629,8 +2627,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::FindXCodeTarget(
return nullptr;
}
std::map<cmGeneratorTarget const*, cmXCodeObject*>::const_iterator const i =
this->XCodeObjectMap.find(t);
auto const i = this->XCodeObjectMap.find(t);
if (i == this->XCodeObjectMap.end()) {
return nullptr;
}
@@ -2910,8 +2907,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateOrGetPBXGroup(
}
target += gtgt->GetName();
s = cmStrCat(target, '/', sg->GetFullName());
std::map<std::string, cmXCodeObject*>::iterator it =
this->GroupNameMap.find(s);
auto it = this->GroupNameMap.find(s);
if (it != this->GroupNameMap.end()) {
return it->second;
}
@@ -2956,8 +2952,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateOrGetPBXGroup(
std::string curr_folder = cmStrCat(target, '/');
for (auto const& folder : cmTokenize(sg->GetFullName(), "\\")) {
curr_folder += folder;
std::map<std::string, cmXCodeObject*>::iterator i_folder =
this->GroupNameMap.find(curr_folder);
auto const i_folder = this->GroupNameMap.find(curr_folder);
// Create new folder
if (i_folder == this->GroupNameMap.end()) {
cmXCodeObject* group = this->CreatePBXGroup(tgroup, folder);
@@ -3269,8 +3264,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
std::string trel = this->ConvertToRelativeForMake(tfull);
// Add this target to the post-build phases of its dependencies.
std::map<std::string, cmXCodeObject::StringVec>::const_iterator y =
target->GetDependTargets().find(configName);
auto const y = target->GetDependTargets().find(configName);
if (y != target->GetDependTargets().end()) {
for (auto const& deptgt : y->second) {
makefileStream << this->PostBuildMakeTarget(deptgt, configName)
@@ -3290,8 +3284,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
makefileStream << trel << ":";
// List dependencies if any exist.
std::map<std::string, cmXCodeObject::StringVec>::const_iterator x =
target->GetDependLibraries().find(configName);
auto const x = target->GetDependLibraries().find(configName);
if (x != target->GetDependLibraries().end()) {
for (auto const& deplib : x->second) {
std::string file = this->ConvertToRelativeForMake(deplib);
+6 -12
View File
@@ -368,8 +368,7 @@ void cmGraphVizWriter::WriteConnections(
const std::string& targetName, std::set<std::string>& insertedNodes,
std::set<std::string>& insertedConnections, cmGeneratedFileStream& str) const
{
std::map<std::string, const cmGeneratorTarget*>::const_iterator targetPtrIt =
this->TargetPtrs.find(targetName);
auto targetPtrIt = this->TargetPtrs.find(targetName);
if (targetPtrIt == this->TargetPtrs.end()) // not found at all
{
@@ -390,8 +389,7 @@ void cmGraphVizWriter::WriteConnections(
for (auto const& llit : ll) {
const std::string& libName = llit.first;
std::map<std::string, std::string>::const_iterator libNameIt =
this->TargetNamesNodes.find(libName);
auto libNameIt = this->TargetNamesNodes.find(libName);
// can happen e.g. if GRAPHVIZ_TARGET_IGNORE_REGEX is used
if (libNameIt == this->TargetNamesNodes.end()) {
@@ -419,8 +417,7 @@ void cmGraphVizWriter::WriteDependerConnections(
const std::string& targetName, std::set<std::string>& insertedNodes,
std::set<std::string>& insertedConnections, cmGeneratedFileStream& str) const
{
std::map<std::string, const cmGeneratorTarget*>::const_iterator targetPtrIt =
this->TargetPtrs.find(targetName);
auto targetPtrIt = this->TargetPtrs.find(targetName);
if (targetPtrIt == this->TargetPtrs.end()) // not found at all
{
@@ -454,8 +451,7 @@ void cmGraphVizWriter::WriteDependerConnections(
for (auto const& llit : ll) {
if (llit.first == targetName) {
// So this target links against targetName.
std::map<std::string, std::string>::const_iterator dependerNodeNameIt =
this->TargetNamesNodes.find(tptr.first);
auto dependerNodeNameIt = this->TargetNamesNodes.find(tptr.first);
if (dependerNodeNameIt != this->TargetNamesNodes.end()) {
std::string connectionName =
@@ -487,8 +483,7 @@ void cmGraphVizWriter::WriteNode(const std::string& targetName,
{
if (insertedNodes.find(targetName) == insertedNodes.end()) {
insertedNodes.insert(targetName);
std::map<std::string, std::string>::const_iterator nameIt =
this->TargetNamesNodes.find(targetName);
auto nameIt = this->TargetNamesNodes.find(targetName);
str << " \"" << nameIt->second << "\" [ label=\"" << targetName
<< "\" shape=\"" << getShapeForTarget(target) << "\"];" << std::endl;
@@ -556,8 +551,7 @@ int cmGraphVizWriter::CollectAllExternalLibs(int cnt)
}
}
std::map<std::string, const cmGeneratorTarget*>::const_iterator tarIt =
this->TargetPtrs.find(libName);
auto tarIt = this->TargetPtrs.find(libName);
if (tarIt == this->TargetPtrs.end()) {
std::ostringstream ostr;
ostr << this->GraphNodePrefix << cnt++;
+1 -1
View File
@@ -22,7 +22,7 @@ bool cmIncludeDirectoryCommand::InitialPass(
return true;
}
std::vector<std::string>::const_iterator i = args.begin();
auto i = args.begin();
bool before = this->Makefile->IsOn("CMAKE_INCLUDE_DIRECTORIES_BEFORE");
bool system = false;
+2 -2
View File
@@ -63,7 +63,7 @@ static void FinalAction(cmMakefile& makefile, std::string const& dest,
// two different options
if (args.size() > 1) {
// now put the files into the list
std::vector<std::string>::const_iterator s = args.begin();
auto s = args.begin();
++s;
// for each argument, get the files
for (; s != args.end(); ++s) {
@@ -85,7 +85,7 @@ static void FinalAction(cmMakefile& makefile, std::string const& dest,
std::string const& regex = args[0];
cmSystemTools::Glob(makefile.GetCurrentSourceDirectory(), regex, files);
std::vector<std::string>::iterator s = files.begin();
auto s = files.begin();
// for each argument, get the files
for (; s != files.end(); ++s) {
installFiles.push_back(FindInstallSource(makefile, s->c_str()));
+2 -2
View File
@@ -52,7 +52,7 @@ static void FinalAction(cmMakefile& makefile, std::string const& dest,
// two different options
if (args.size() > 1 || files_mode) {
// for each argument, get the programs
std::vector<std::string>::const_iterator s = args.begin();
auto s = args.begin();
if (files_mode) {
// Skip the FILES argument in files mode.
++s;
@@ -67,7 +67,7 @@ static void FinalAction(cmMakefile& makefile, std::string const& dest,
cmSystemTools::Glob(makefile.GetCurrentSourceDirectory(), args[0],
programs);
std::vector<std::string>::iterator s = programs.begin();
auto s = programs.begin();
// for each argument, get the programs
for (; s != programs.end(); ++s) {
files.push_back(FindInstallSource(makefile, s->c_str()));
+2 -2
View File
@@ -24,7 +24,7 @@ bool cmInstallTargetsCommand::InitialPass(std::vector<std::string> const& args,
this->Makefile->GetGlobalGenerator()->EnableInstallTarget();
cmMakefile::cmTargetMap& tgts = this->Makefile->GetTargets();
std::vector<std::string>::const_iterator s = args.begin();
auto s = args.begin();
++s;
std::string runtime_dir = "/bin";
for (; s != args.end(); ++s) {
@@ -38,7 +38,7 @@ bool cmInstallTargetsCommand::InitialPass(std::vector<std::string> const& args,
runtime_dir = *s;
} else {
cmMakefile::cmTargetMap::iterator ti = tgts.find(*s);
auto ti = tgts.find(*s);
if (ti != tgts.end()) {
ti->second.SetInstallPath(args[0]);
ti->second.SetRuntimeInstallPath(runtime_dir);
+1 -1
View File
@@ -74,7 +74,7 @@ bool cmInstalledFile::HasProperty(const std::string& prop) const
bool cmInstalledFile::GetProperty(const std::string& prop,
std::string& value) const
{
PropertyMapType::const_iterator i = this->Properties.find(prop);
auto i = this->Properties.find(prop);
if (i == this->Properties.end()) {
return false;
}
+1 -2
View File
@@ -15,8 +15,7 @@ bool cmLinkLibrariesCommand::InitialPass(std::vector<std::string> const& args,
}
// add libraries, note that there is an optional prefix
// of debug and optimized than can be used
for (std::vector<std::string>::const_iterator i = args.begin();
i != args.end(); ++i) {
for (auto i = args.begin(); i != args.end(); ++i) {
if (*i == "debug") {
++i;
if (i == args.end()) {
+14 -18
View File
@@ -338,8 +338,7 @@ bool HandleFindCommand(std::vector<std::string> const& args,
return true;
}
std::vector<std::string>::iterator it =
std::find(varArgsExpanded.begin(), varArgsExpanded.end(), args[2]);
auto it = std::find(varArgsExpanded.begin(), varArgsExpanded.end(), args[2]);
if (it != varArgsExpanded.end()) {
status.GetMakefile().AddDefinition(
variableName,
@@ -441,13 +440,12 @@ bool HandleRemoveItemCommand(std::vector<std::string> const& args,
std::vector<std::string> remove(args.begin() + 2, args.end());
std::sort(remove.begin(), remove.end());
std::vector<std::string>::const_iterator remEnd =
std::unique(remove.begin(), remove.end());
std::vector<std::string>::const_iterator remBegin = remove.begin();
auto remEnd = std::unique(remove.begin(), remove.end());
auto remBegin = remove.begin();
std::vector<std::string>::const_iterator argsEnd =
auto argsEnd =
cmRemoveMatching(varArgsExpanded, cmMakeRange(remBegin, remEnd));
std::vector<std::string>::const_iterator argsBegin = varArgsExpanded.begin();
auto argsBegin = varArgsExpanded.cbegin();
std::string value = cmJoin(cmMakeRange(argsBegin, argsEnd), ";");
status.GetMakefile().AddDefinition(listName, value);
return true;
@@ -491,9 +489,8 @@ bool HandleRemoveDuplicatesCommand(std::vector<std::string> const& args,
return true;
}
std::vector<std::string>::const_iterator argsEnd =
cmRemoveDuplicates(varArgsExpanded);
std::vector<std::string>::const_iterator argsBegin = varArgsExpanded.begin();
auto argsEnd = cmRemoveDuplicates(varArgsExpanded);
auto argsBegin = varArgsExpanded.cbegin();
std::string value = cmJoin(cmMakeRange(argsBegin, argsEnd), ";");
status.GetMakefile().AddDefinition(listName, value);
@@ -1357,13 +1354,12 @@ bool HandleRemoveAtCommand(std::vector<std::string> const& args,
}
std::sort(removed.begin(), removed.end());
std::vector<size_t>::const_iterator remEnd =
std::unique(removed.begin(), removed.end());
std::vector<size_t>::const_iterator remBegin = removed.begin();
auto remEnd = std::unique(removed.begin(), removed.end());
auto remBegin = removed.begin();
std::vector<std::string>::const_iterator argsEnd =
auto argsEnd =
cmRemoveIndices(varArgsExpanded, cmMakeRange(remBegin, remEnd));
std::vector<std::string>::const_iterator argsBegin = varArgsExpanded.begin();
auto argsBegin = varArgsExpanded.cbegin();
std::string value = cmJoin(cmMakeRange(argsBegin, argsEnd), ";");
status.GetMakefile().AddDefinition(listName, value);
@@ -1456,9 +1452,9 @@ bool FilterRegex(std::vector<std::string> const& args, bool includeMatches,
return false;
}
std::vector<std::string>::iterator argsBegin = varArgsExpanded.begin();
std::vector<std::string>::iterator argsEnd = varArgsExpanded.end();
std::vector<std::string>::iterator newArgsEnd =
auto argsBegin = varArgsExpanded.begin();
auto argsEnd = varArgsExpanded.end();
auto newArgsEnd =
std::remove_if(argsBegin, argsEnd, MatchesRegex(regex, includeMatches));
std::string value = cmJoin(cmMakeRange(argsBegin, newArgsEnd), ";");
+5 -10
View File
@@ -649,8 +649,7 @@ void cmLocalGenerator::AddOwnedImportedGeneratorTarget(cmGeneratorTarget* gt)
cmGeneratorTarget* cmLocalGenerator::FindLocalNonAliasGeneratorTarget(
const std::string& name) const
{
GeneratorTargetMap::const_iterator ti =
this->GeneratorTargetSearchIndex.find(name);
auto ti = this->GeneratorTargetSearchIndex.find(name);
if (ti != this->GeneratorTargetSearchIndex.end()) {
return ti->second;
}
@@ -1641,8 +1640,7 @@ void cmLocalGenerator::AddLanguageFlagsForLinking(
cmGeneratorTarget* cmLocalGenerator::FindGeneratorTargetToUse(
const std::string& name) const
{
GeneratorTargetMap::const_iterator imported =
this->ImportedGeneratorTargets.find(name);
auto imported = this->ImportedGeneratorTargets.find(name);
if (imported != this->ImportedGeneratorTargets.end()) {
return imported->second;
}
@@ -1843,8 +1841,7 @@ void cmLocalGenerator::AddCompilerRequirementFlag(
std::vector<std::string>& stds = langStdMap[lang];
std::vector<std::string>::const_iterator stdIt =
std::find(stds.begin(), stds.end(), standard);
auto stdIt = std::find(stds.begin(), stds.end(), standard);
if (stdIt == stds.end()) {
std::string e =
lang + "_STANDARD is set to invalid value '" + standard + "'";
@@ -1853,8 +1850,7 @@ void cmLocalGenerator::AddCompilerRequirementFlag(
return;
}
std::vector<std::string>::const_iterator defaultStdIt =
std::find(stds.begin(), stds.end(), defaultStd);
auto defaultStdIt = std::find(stds.begin(), stds.end(), defaultStd);
if (defaultStdIt == stds.end()) {
std::string e = "CMAKE_" + lang +
"_STANDARD_DEFAULT is set to invalid value '" + std::string(defaultStd) +
@@ -2720,8 +2716,7 @@ std::string& cmLocalGenerator::CreateSafeUniqueObjectFileName(
const std::string& sin, std::string const& dir_max)
{
// Look for an existing mapped name for this object file.
std::map<std::string, std::string>::iterator it =
this->UniqueObjectNamesMap.find(sin);
auto it = this->UniqueObjectNamesMap.find(sin);
// If no entry exists create one.
if (it == this->UniqueObjectNamesMap.end()) {
+3 -5
View File
@@ -386,8 +386,7 @@ std::string cmLocalNinjaGenerator::BuildCommandLine(
}
std::ostringstream cmd;
for (std::vector<std::string>::const_iterator li = cmdLines.begin();
li != cmdLines.end(); ++li)
for (auto li = cmdLines.begin(); li != cmdLines.end(); ++li)
#ifdef _WIN32
{
if (li != cmdLines.begin()) {
@@ -531,8 +530,7 @@ void cmLocalNinjaGenerator::AddCustomCommandTarget(cmCustomCommand const* cc,
void cmLocalNinjaGenerator::WriteCustomCommandBuildStatements()
{
for (cmCustomCommand const* customCommand : this->CustomCommands) {
CustomCommandTargetMap::iterator i =
this->CustomCommandTargets.find(customCommand);
auto i = this->CustomCommandTargets.find(customCommand);
assert(i != this->CustomCommandTargets.end());
// A custom command may appear on multiple targets. However, some build
@@ -544,7 +542,7 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatements()
//
// FIXME: This won't work in certain obscure scenarios involving indirect
// dependencies.
std::set<cmGeneratorTarget*>::iterator j = i->second.begin();
auto j = i->second.begin();
assert(j != i->second.end());
std::vector<std::string> ccTargetDeps;
this->GetGlobalNinjaGenerator()->AppendTargetDependsClosure(*j,
+5 -8
View File
@@ -1225,8 +1225,7 @@ std::string cmLocalUnixMakefileGenerator3::CreateMakeVariable(
// see if the variable has been defined before and return
// the modified version of the variable
std::map<std::string, std::string>::iterator i =
this->MakeVariableMap.find(unmodified);
auto i = this->MakeVariableMap.find(unmodified);
if (i != this->MakeVariableMap.end()) {
return i->second;
}
@@ -1495,8 +1494,7 @@ void cmLocalUnixMakefileGenerator3::CheckMultipleOutputs(bool verbose)
// Convert the string to a list and preserve empty entries.
std::vector<std::string> pairs = cmExpandedList(pairs_string, true);
for (std::vector<std::string>::const_iterator i = pairs.begin();
i != pairs.end() && (i + 1) != pairs.end();) {
for (auto i = pairs.begin(); i != pairs.end() && (i + 1) != pairs.end();) {
const std::string& depender = *i++;
const std::string& dependee = *i++;
@@ -2019,10 +2017,9 @@ std::string cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(
if (components.size() > 1) {
// Now add the rest of the components separated by the proper slash
// direction for this platform.
std::vector<std::string>::const_iterator compEnd = std::remove(
components.begin() + 1, components.end() - 1, std::string());
std::vector<std::string>::const_iterator compStart =
components.begin() + 1;
auto compEnd = std::remove(components.begin() + 1, components.end() - 1,
std::string());
auto compStart = components.begin() + 1;
result += cmJoin(cmMakeRange(compStart, compEnd), slash);
// Only the last component can be empty to avoid double slashes.
result += slash;
+1 -2
View File
@@ -65,8 +65,7 @@ bool cmMacroHelperCommand::operator()(
// set the value of argc
std::string argcDef = std::to_string(expandedArgs.size());
std::vector<std::string>::const_iterator eit =
expandedArgs.begin() + (this->Args.size() - 1);
auto eit = expandedArgs.begin() + (this->Args.size() - 1);
std::string expandedArgn = cmJoin(cmMakeRange(eit, expandedArgs.end()), ";");
std::string expandedArgv = cmJoin(expandedArgs, ";");
std::vector<std::string> variables;
+18 -25
View File
@@ -751,9 +751,8 @@ cmMakefile::GetExportBuildFileGenerators() const
void cmMakefile::RemoveExportBuildFileGeneratorCMP0024(
cmExportBuildFileGenerator* gen)
{
std::vector<cmExportBuildFileGenerator*>::iterator it =
std::find(this->ExportBuildFileGenerators.begin(),
this->ExportBuildFileGenerators.end(), gen);
auto it = std::find(this->ExportBuildFileGenerators.begin(),
this->ExportBuildFileGenerators.end(), gen);
if (it != this->ExportBuildFileGenerators.end()) {
this->ExportBuildFileGenerators.erase(it);
}
@@ -829,7 +828,7 @@ void cmMakefile::AddCustomCommandToTarget(
bool command_expand_lists, ObjectLibraryCommands objLibraryCommands)
{
// Find the target to which to add the custom command.
cmTargetMap::iterator ti = this->Targets.find(target);
auto ti = this->Targets.find(target);
if (ti == this->Targets.end()) {
MessageType messageType = MessageType::AUTHOR_WARNING;
@@ -1034,7 +1033,7 @@ void cmMakefile::UpdateOutputToSourceMap(
void cmMakefile::UpdateOutputToSourceMap(std::string const& output,
cmSourceFile* source)
{
OutputToSourceMap::iterator i = this->OutputToSource.find(output);
auto i = this->OutputToSource.find(output);
if (i != this->OutputToSource.end()) {
// Multiple custom commands produce the same output but may
// be attached to a different source file (MAIN_DEPENDENCY).
@@ -1110,7 +1109,7 @@ void cmMakefile::AddCustomCommandOldStyle(
// then add the source to the target to make sure the rule is
// included.
if (sf && !sf->GetPropertyAsBool("__CMAKE_RULE")) {
cmTargetMap::iterator ti = this->Targets.find(target);
auto ti = this->Targets.find(target);
if (ti != this->Targets.end()) {
ti->second.AddSource(sf->ResolveFullPath());
} else {
@@ -1355,9 +1354,8 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove)
std::vector<std::string> defs = cmExpandedList(cdefs);
// Recompose the list without the definition.
std::vector<std::string>::const_iterator defEnd =
std::remove(defs.begin(), defs.end(), define);
std::vector<std::string>::const_iterator defBegin = defs.begin();
auto defEnd = std::remove(defs.begin(), defs.end(), define);
auto defBegin = defs.begin();
std::string ndefs = cmJoin(cmMakeRange(defBegin, defEnd), ";");
// Store the new list.
@@ -1640,7 +1638,7 @@ void cmMakefile::Configure()
std::vector<cmMakefile*> subdirs = this->UnConfiguredDirectories;
// for each subdir recurse
std::vector<cmMakefile*>::iterator sdi = subdirs.begin();
auto sdi = subdirs.begin();
for (; sdi != subdirs.end(); ++sdi) {
(*sdi)->StateSnapshot.InitializeFromParent_ForSubdirsCommand();
this->ConfigureSubDirectory(*sdi);
@@ -1954,8 +1952,7 @@ void cmMakefile::AddGlobalLinkInformation(cmTarget& target)
if (const char* linkLibsProp = this->GetProperty("LINK_LIBRARIES")) {
std::vector<std::string> linkLibs = cmExpandedList(linkLibsProp);
for (std::vector<std::string>::iterator j = linkLibs.begin();
j != linkLibs.end(); ++j) {
for (auto j = linkLibs.begin(); j != linkLibs.end(); ++j) {
std::string libraryName = *j;
cmTargetLinkLibraryType libType = GENERAL_LibraryType;
if (libraryName == "optimized") {
@@ -2024,7 +2021,7 @@ cmTarget* cmMakefile::AddExecutable(const std::string& exeName,
cmTarget* cmMakefile::AddNewTarget(cmStateEnums::TargetType type,
const std::string& name)
{
cmTargetMap::iterator it =
auto it =
this->Targets
.emplace(name, cmTarget(name, type, cmTarget::VisibilityNormal, this))
.first;
@@ -2071,7 +2068,7 @@ cmSourceFile* cmMakefile::GetSourceFileWithOutput(
return this->LinearGetSourceFileWithOutput(name);
}
// Otherwise we use an efficient lookup map.
OutputToSourceMap::const_iterator o = this->OutputToSource.find(name);
auto o = this->OutputToSource.find(name);
if (o != this->OutputToSource.end()) {
return (*o).second;
}
@@ -2188,8 +2185,7 @@ cmSourceGroup* cmMakefile::FindSourceGroup(
const std::string& source, std::vector<cmSourceGroup>& groups) const
{
// First search for a group that lists the file explicitly.
for (std::vector<cmSourceGroup>::reverse_iterator sg = groups.rbegin();
sg != groups.rend(); ++sg) {
for (auto sg = groups.rbegin(); sg != groups.rend(); ++sg) {
cmSourceGroup* result = sg->MatchChildrenFiles(source);
if (result) {
return result;
@@ -2197,8 +2193,7 @@ cmSourceGroup* cmMakefile::FindSourceGroup(
}
// Now search for a group whose regex matches the file.
for (std::vector<cmSourceGroup>::reverse_iterator sg = groups.rbegin();
sg != groups.rend(); ++sg) {
for (auto sg = groups.rbegin(); sg != groups.rend(); ++sg) {
cmSourceGroup* result = sg->MatchChildrenRegex(source);
if (result) {
return result;
@@ -2281,8 +2276,7 @@ void cmMakefile::ExpandVariablesCMP0019()
if (const char* linkLibsProp = this->GetProperty("LINK_LIBRARIES")) {
std::vector<std::string> linkLibs = cmExpandedList(linkLibsProp);
for (std::vector<std::string>::iterator l = linkLibs.begin();
l != linkLibs.end(); ++l) {
for (auto l = linkLibs.begin(); l != linkLibs.end(); ++l) {
std::string libName = *l;
if (libName == "optimized") {
++l;
@@ -3841,7 +3835,7 @@ std::vector<std::string> cmMakefile::GetPropertyKeys() const
cmTarget* cmMakefile::FindLocalNonAliasTarget(const std::string& name) const
{
cmTargetMap::iterator i = this->Targets.find(name);
auto i = this->Targets.find(name);
if (i != this->Targets.end()) {
return &i->second;
}
@@ -3862,8 +3856,7 @@ cmTest* cmMakefile::CreateTest(const std::string& testName)
cmTest* cmMakefile::GetTest(const std::string& testName) const
{
std::map<std::string, cmTest*>::const_iterator mi =
this->Tests.find(testName);
auto mi = this->Tests.find(testName);
if (mi != this->Tests.end()) {
return mi->second;
}
@@ -3908,7 +3901,7 @@ std::string cmMakefile::FormatListFileStack() const
std::ostringstream tmp;
size_t depth = listFiles.size();
if (depth > 0) {
std::vector<std::string>::const_iterator it = listFiles.end();
auto it = listFiles.end();
do {
if (depth != listFiles.size()) {
tmp << "\n ";
@@ -3995,7 +3988,7 @@ cmTarget* cmMakefile::FindTargetToUse(const std::string& name,
{
// Look for an imported target. These take priority because they
// are more local in scope and do not have to be globally unique.
TargetMap::const_iterator imported = this->ImportedTargets.find(name);
auto imported = this->ImportedTargets.find(name);
if (imported != this->ImportedTargets.end()) {
return imported->second;
}
+1 -1
View File
@@ -837,7 +837,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
}
// Create the archive with the first set of objects.
std::vector<std::string>::iterator osi = object_strings.begin();
auto osi = object_strings.begin();
{
vars.Objects = osi->c_str();
for (std::string const& acc : archiveCreateCommands) {
+6 -8
View File
@@ -128,7 +128,7 @@ bool cmOrderDirectoriesConstraint::FileMayConflict(std::string const& dir,
// Check if the file will be built by cmake.
std::set<std::string> const& files =
(this->GlobalGenerator->GetDirectoryContent(dir, false));
std::set<std::string>::const_iterator fi = files.find(name);
auto fi = files.find(name);
return fi != files.end();
}
@@ -186,9 +186,9 @@ bool cmOrderDirectoriesConstraintSOName::FindConflict(std::string const& dir)
// know the soname just look at all files that start with the
// file name. Usually the soname starts with the library name.
std::string base = this->FileName;
std::set<std::string>::const_iterator first = files.lower_bound(base);
auto first = files.lower_bound(base);
++base.back();
std::set<std::string>::const_iterator last = files.upper_bound(base);
auto last = files.upper_bound(base);
if (first != last) {
return true;
}
@@ -380,7 +380,7 @@ void cmOrderDirectories::CollectOriginalDirectories()
int cmOrderDirectories::AddOriginalDirectory(std::string const& dir)
{
// Add the runtime directory with a unique index.
std::map<std::string, int>::iterator i = this->DirectoryIndex.find(dir);
auto i = this->DirectoryIndex.find(dir);
if (i == this->DirectoryIndex.end()) {
std::map<std::string, int>::value_type entry(
dir, static_cast<int>(this->OriginalDirectories.size()));
@@ -441,8 +441,7 @@ void cmOrderDirectories::FindConflicts()
std::sort(cl.begin(), cl.end());
// Make the edge list unique so cycle detection will be reliable.
ConflictList::iterator last =
std::unique(cl.begin(), cl.end(), cmOrderDirectoriesCompare());
auto last = std::unique(cl.begin(), cl.end(), cmOrderDirectoriesCompare());
cl.erase(last, cl.end());
}
@@ -553,8 +552,7 @@ bool cmOrderDirectories::IsSameDirectory(std::string const& l,
std::string const& cmOrderDirectories::GetRealPath(std::string const& dir)
{
std::map<std::string, std::string>::iterator i =
this->RealPaths.lower_bound(dir);
auto i = this->RealPaths.lower_bound(dir);
if (i == this->RealPaths.end() ||
this->RealPaths.key_comp()(dir, i->first)) {
using value_type = std::map<std::string, std::string>::value_type;
+2 -3
View File
@@ -367,8 +367,7 @@ protected:
std::string fullPath = this->FullPath(file, extraPath);
// Try to find the file's instance of cmDependInformation.
DependInformationMapType::const_iterator result =
this->DependInformationMap.find(fullPath);
auto result = this->DependInformationMap.find(fullPath);
if (result != this->DependInformationMap.end()) {
// Found an instance, return it.
return result->second;
@@ -398,7 +397,7 @@ protected:
if (m != this->DirectoryToFileToPathMap.end()) {
FileToPathMapType& map = m->second;
FileToPathMapType::iterator p = map.find(fname);
auto p = map.find(fname);
if (p != map.end()) {
return p->second;
}
+2 -2
View File
@@ -116,8 +116,8 @@ bool cmParseArgumentsCommand(std::vector<std::string> const& args,
return false;
}
std::vector<std::string>::const_iterator argIter = args.begin();
std::vector<std::string>::const_iterator argEnd = args.end();
auto argIter = args.begin();
auto argEnd = args.end();
bool parseFromArgV = false;
unsigned long argvStart = 0;
if (*argIter == "PARSE_ARGV") {
+2 -2
View File
@@ -10,7 +10,7 @@ void cmPropertyDefinitionMap::DefineProperty(const std::string& name,
const char* FullDescription,
bool chain)
{
cmPropertyDefinitionMap::iterator it = this->find(name);
auto it = this->find(name);
cmPropertyDefinition* prop;
if (it == this->end()) {
prop = &(*this)[name];
@@ -26,7 +26,7 @@ bool cmPropertyDefinitionMap::IsPropertyDefined(const std::string& name) const
bool cmPropertyDefinitionMap::IsPropertyChained(const std::string& name) const
{
cmPropertyDefinitionMap::const_iterator it = this->find(name);
auto it = this->find(name);
if (it == this->end()) {
return false;
}
+4 -6
View File
@@ -24,8 +24,6 @@ void MergeOptions(std::vector<std::string>& baseOpts,
std::vector<std::string> const& newOpts,
std::initializer_list<cm::string_view> valueOpts, bool isQt5)
{
using Iter = std::vector<std::string>::iterator;
using CIter = std::vector<std::string>::const_iterator;
if (newOpts.empty()) {
return;
}
@@ -35,10 +33,10 @@ void MergeOptions(std::vector<std::string>& baseOpts,
}
std::vector<std::string> extraOpts;
for (CIter fit = newOpts.begin(), fitEnd = newOpts.end(); fit != fitEnd;
for (auto fit = newOpts.begin(), fitEnd = newOpts.end(); fit != fitEnd;
++fit) {
std::string const& newOpt = *fit;
Iter existIt = std::find(baseOpts.begin(), baseOpts.end(), newOpt);
auto existIt = std::find(baseOpts.begin(), baseOpts.end(), newOpt);
if (existIt != baseOpts.end()) {
if (newOpt.size() >= 2) {
// Acquire the option name
@@ -55,8 +53,8 @@ void MergeOptions(std::vector<std::string>& baseOpts,
}
// Test if this is a value option and change the existing value
if (!optName.empty() && cmContains(valueOpts, optName)) {
const Iter existItNext(existIt + 1);
const CIter fitNext(fit + 1);
const auto existItNext(existIt + 1);
const auto fitNext(fit + 1);
if ((existItNext != baseOpts.end()) && (fitNext != fitEnd)) {
*existItNext = *fitNext;
++fit;
+1 -1
View File
@@ -1797,7 +1797,7 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile)
BaseConst().ProjectBinaryDir, BaseConst().ProjectSourceDir
};
for (cm::string_view const& ppath : movePaths) {
std::list<std::string>::iterator it = includes.begin();
auto it = includes.begin();
while (it != includes.end()) {
std::string const& path = *it;
if (cmHasPrefix(path, ppath)) {
+5 -6
View File
@@ -320,8 +320,7 @@ std::string cmRST::ReplaceSubstitutions(std::string const& line)
std::string::size_type start = this->Substitution.start(2);
std::string::size_type end = this->Substitution.end(2);
std::string substitute = this->Substitution.match(3);
std::map<std::string, std::string>::iterator replace =
this->Replace.find(substitute);
auto replace = this->Replace.find(substitute);
if (replace != this->Replace.end()) {
std::pair<std::set<std::string>::iterator, bool> replaced =
this->Replaced.insert(substitute);
@@ -451,10 +450,10 @@ void cmRST::UnindentLines(std::vector<std::string>& lines)
}
}
std::vector<std::string>::const_iterator it = lines.begin();
auto it = lines.cbegin();
size_t leadingEmpty = std::distance(it, cmFindNot(lines, std::string()));
std::vector<std::string>::const_reverse_iterator rit = lines.rbegin();
auto rit = lines.crbegin();
size_t trailingEmpty =
std::distance(rit, cmFindNot(cmReverseRange(lines), std::string()));
@@ -464,7 +463,7 @@ void cmRST::UnindentLines(std::vector<std::string>& lines)
return;
}
std::vector<std::string>::iterator contentEnd = cmRotate(
lines.begin(), lines.begin() + leadingEmpty, lines.end() - trailingEmpty);
auto contentEnd = cmRotate(lines.begin(), lines.begin() + leadingEmpty,
lines.end() - trailingEmpty);
lines.erase(contentEnd, lines.end());
}
+2 -4
View File
@@ -235,8 +235,7 @@ std::string cmRulePlaceholderExpander::ExpandRuleVariable(
cmOutputConverter::SHELL);
}
std::map<std::string, std::string>::iterator compIt =
this->Compilers.find(variable);
auto compIt = this->Compilers.find(variable);
if (compIt != this->Compilers.end()) {
std::string ret = outputConverter->ConvertToOutputForExisting(
@@ -292,8 +291,7 @@ std::string cmRulePlaceholderExpander::ExpandRuleVariable(
return ret;
}
std::map<std::string, std::string>::iterator mapIt =
this->VariableMappings.find(variable);
auto mapIt = this->VariableMappings.find(variable);
if (mapIt != this->VariableMappings.end()) {
if (variable.find("_FLAG") == std::string::npos) {
return outputConverter->ConvertToOutputForExisting(mapIt->second);
+1 -2
View File
@@ -375,8 +375,7 @@ bool HandleTestMode(cmExecutionStatus& status, std::set<std::string>& names,
{
// Look for tests with all names given.
std::set<std::string>::iterator next;
for (std::set<std::string>::iterator ni = names.begin(); ni != names.end();
ni = next) {
for (auto ni = names.begin(); ni != names.end(); ni = next) {
next = ni;
++next;
if (cmTest* test = status.GetMakefile().GetTest(*ni)) {
+1 -2
View File
@@ -284,8 +284,7 @@ bool cmSourceGroupCommand::checkSingleParameterArgumentPreconditions(
const std::string& argument, const ParsedArguments& parsedArguments,
std::string& errorMsg) const
{
ParsedArguments::const_iterator foundArgument =
parsedArguments.find(argument);
auto foundArgument = parsedArguments.find(argument);
if (foundArgument != parsedArguments.end()) {
const std::vector<std::string>& optionArguments = foundArgument->second;
+4 -6
View File
@@ -350,8 +350,7 @@ cmPropertyDefinition const* cmState::GetPropertyDefinition(
bool cmState::IsPropertyDefined(const std::string& name,
cmProperty::ScopeType scope) const
{
std::map<cmProperty::ScopeType, cmPropertyDefinitionMap>::const_iterator it =
this->PropertyDefinitions.find(scope);
auto it = this->PropertyDefinitions.find(scope);
if (it == this->PropertyDefinitions.end()) {
return false;
}
@@ -361,8 +360,7 @@ bool cmState::IsPropertyDefined(const std::string& name,
bool cmState::IsPropertyChained(const std::string& name,
cmProperty::ScopeType scope) const
{
std::map<cmProperty::ScopeType, cmPropertyDefinitionMap>::const_iterator it =
this->PropertyDefinitions.find(scope);
auto it = this->PropertyDefinitions.find(scope);
if (it == this->PropertyDefinitions.end()) {
return false;
}
@@ -371,8 +369,8 @@ bool cmState::IsPropertyChained(const std::string& name,
void cmState::SetLanguageEnabled(std::string const& l)
{
std::vector<std::string>::iterator it = std::lower_bound(
this->EnabledLanguages.begin(), this->EnabledLanguages.end(), l);
auto it = std::lower_bound(this->EnabledLanguages.begin(),
this->EnabledLanguages.end(), l);
if (it == this->EnabledLanguages.end() || *it != l) {
this->EnabledLanguages.insert(it, l);
}
+18 -33
View File
@@ -175,11 +175,9 @@ cmStateDirectory::cmStateDirectory(
template <typename T, typename U>
cmStringRange GetPropertyContent(T const& content, U contentEndPosition)
{
std::vector<std::string>::const_iterator end =
content.begin() + contentEndPosition;
auto end = content.begin() + contentEndPosition;
std::vector<std::string>::const_reverse_iterator rbegin =
cmMakeReverseIterator(end);
auto rbegin = cmMakeReverseIterator(end);
rbegin = std::find(rbegin, content.rend(), cmPropertySentinal);
return cmMakeRange(rbegin.base(), end);
@@ -189,17 +187,14 @@ template <typename T, typename U, typename V>
cmBacktraceRange GetPropertyBacktraces(T const& content, U const& backtraces,
V contentEndPosition)
{
std::vector<std::string>::const_iterator entryEnd =
content.begin() + contentEndPosition;
auto entryEnd = content.begin() + contentEndPosition;
std::vector<std::string>::const_reverse_iterator rbegin =
cmMakeReverseIterator(entryEnd);
auto rbegin = cmMakeReverseIterator(entryEnd);
rbegin = std::find(rbegin, content.rend(), cmPropertySentinal);
std::vector<cmListFileBacktrace>::const_iterator it =
backtraces.begin() + std::distance(content.begin(), rbegin.base());
auto it = backtraces.begin() + std::distance(content.begin(), rbegin.base());
std::vector<cmListFileBacktrace>::const_iterator end = backtraces.end();
auto end = backtraces.end();
return cmMakeRange(it, end);
}
@@ -271,22 +266,17 @@ void cmStateDirectory::AppendIncludeDirectoriesEntry(
void cmStateDirectory::PrependIncludeDirectoriesEntry(
const std::string& vec, const cmListFileBacktrace& lfbt)
{
std::vector<std::string>::iterator entryEnd =
this->DirectoryState->IncludeDirectories.begin() +
auto entryEnd = this->DirectoryState->IncludeDirectories.begin() +
this->Snapshot_.Position->IncludeDirectoryPosition;
std::vector<std::string>::reverse_iterator rend =
this->DirectoryState->IncludeDirectories.rend();
std::vector<std::string>::reverse_iterator rbegin =
cmMakeReverseIterator(entryEnd);
auto rend = this->DirectoryState->IncludeDirectories.rend();
auto rbegin = cmMakeReverseIterator(entryEnd);
rbegin = std::find(rbegin, rend, cmPropertySentinal);
std::vector<std::string>::iterator entryIt = rbegin.base();
std::vector<std::string>::iterator entryBegin =
this->DirectoryState->IncludeDirectories.begin();
auto entryIt = rbegin.base();
auto entryBegin = this->DirectoryState->IncludeDirectories.begin();
std::vector<cmListFileBacktrace>::iterator btIt =
this->DirectoryState->IncludeDirectoryBacktraces.begin() +
auto btIt = this->DirectoryState->IncludeDirectoryBacktraces.begin() +
std::distance(entryBegin, entryIt);
this->DirectoryState->IncludeDirectories.insert(entryIt, vec);
@@ -446,22 +436,17 @@ void cmStateDirectory::AppendLinkDirectoriesEntry(
void cmStateDirectory::PrependLinkDirectoriesEntry(
const std::string& vec, const cmListFileBacktrace& lfbt)
{
std::vector<std::string>::iterator entryEnd =
this->DirectoryState->LinkDirectories.begin() +
auto entryEnd = this->DirectoryState->LinkDirectories.begin() +
this->Snapshot_.Position->LinkDirectoriesPosition;
std::vector<std::string>::reverse_iterator rend =
this->DirectoryState->LinkDirectories.rend();
std::vector<std::string>::reverse_iterator rbegin =
cmMakeReverseIterator(entryEnd);
auto rend = this->DirectoryState->LinkDirectories.rend();
auto rbegin = cmMakeReverseIterator(entryEnd);
rbegin = std::find(rbegin, rend, cmPropertySentinal);
std::vector<std::string>::iterator entryIt = rbegin.base();
std::vector<std::string>::iterator entryBegin =
this->DirectoryState->LinkDirectories.begin();
auto entryIt = rbegin.base();
auto entryBegin = this->DirectoryState->LinkDirectories.begin();
std::vector<cmListFileBacktrace>::iterator btIt =
this->DirectoryState->LinkDirectoriesBacktraces.begin() +
auto btIt = this->DirectoryState->LinkDirectoriesBacktraces.begin() +
std::distance(entryBegin, entryIt);
this->DirectoryState->LinkDirectories.insert(entryIt, vec);
+7 -11
View File
@@ -276,22 +276,18 @@ void InitializeContentFromParent(T& parentContent, T& thisContent,
U& parentBacktraces, U& thisBacktraces,
V& contentEndPosition)
{
std::vector<std::string>::const_iterator parentBegin = parentContent.begin();
std::vector<std::string>::const_iterator parentEnd = parentContent.end();
auto parentBegin = parentContent.begin();
auto parentEnd = parentContent.end();
std::vector<std::string>::const_reverse_iterator parentRbegin =
cmMakeReverseIterator(parentEnd);
std::vector<std::string>::const_reverse_iterator parentRend =
parentContent.rend();
auto parentRbegin = cmMakeReverseIterator(parentEnd);
auto parentRend = parentContent.rend();
parentRbegin = std::find(parentRbegin, parentRend, cmPropertySentinal);
std::vector<std::string>::const_iterator parentIt = parentRbegin.base();
auto parentIt = parentRbegin.base();
thisContent = std::vector<std::string>(parentIt, parentEnd);
std::vector<cmListFileBacktrace>::const_iterator btIt =
parentBacktraces.begin() + std::distance(parentBegin, parentIt);
std::vector<cmListFileBacktrace>::const_iterator btEnd =
parentBacktraces.end();
auto btIt = parentBacktraces.begin() + std::distance(parentBegin, parentIt);
auto btEnd = parentBacktraces.end();
thisBacktraces = std::vector<cmListFileBacktrace>(btIt, btEnd);
+3 -4
View File
@@ -1633,8 +1633,8 @@ int cmSystemTools::WaitForLine(cmsysProcess* process, std::string& line,
std::vector<char>& err)
{
line.clear();
std::vector<char>::iterator outiter = out.begin();
std::vector<char>::iterator erriter = err.begin();
auto outiter = out.begin();
auto erriter = err.begin();
cmProcessOutput processOutput;
std::string strdata;
while (true) {
@@ -2540,8 +2540,7 @@ bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg,
// Adjust the entry list as necessary to remove the run path
unsigned long entriesErased = 0;
for (cmELF::DynamicEntryList::iterator it = dentries.begin();
it != dentries.end();) {
for (auto it = dentries.begin(); it != dentries.end();) {
if (it->first == cmELF::TagRPath || it->first == cmELF::TagRunPath) {
it = dentries.erase(it);
entriesErased++;
+18 -27
View File
@@ -1361,13 +1361,11 @@ void cmTarget::AppendBuildInterfaceIncludes()
void cmTarget::InsertInclude(std::string const& entry,
cmListFileBacktrace const& bt, bool before)
{
std::vector<std::string>::iterator position = before
? impl->IncludeDirectoriesEntries.begin()
: impl->IncludeDirectoriesEntries.end();
auto position = before ? impl->IncludeDirectoriesEntries.begin()
: impl->IncludeDirectoriesEntries.end();
std::vector<cmListFileBacktrace>::iterator btPosition = before
? impl->IncludeDirectoriesBacktraces.begin()
: impl->IncludeDirectoriesBacktraces.end();
auto btPosition = before ? impl->IncludeDirectoriesBacktraces.begin()
: impl->IncludeDirectoriesBacktraces.end();
impl->IncludeDirectoriesEntries.insert(position, entry);
impl->IncludeDirectoriesBacktraces.insert(btPosition, bt);
@@ -1376,13 +1374,11 @@ void cmTarget::InsertInclude(std::string const& entry,
void cmTarget::InsertCompileOption(std::string const& entry,
cmListFileBacktrace const& bt, bool before)
{
std::vector<std::string>::iterator position = before
? impl->CompileOptionsEntries.begin()
: impl->CompileOptionsEntries.end();
auto position = before ? impl->CompileOptionsEntries.begin()
: impl->CompileOptionsEntries.end();
std::vector<cmListFileBacktrace>::iterator btPosition = before
? impl->CompileOptionsBacktraces.begin()
: impl->CompileOptionsBacktraces.end();
auto btPosition = before ? impl->CompileOptionsBacktraces.begin()
: impl->CompileOptionsBacktraces.end();
impl->CompileOptionsEntries.insert(position, entry);
impl->CompileOptionsBacktraces.insert(btPosition, bt);
@@ -1398,12 +1394,11 @@ void cmTarget::InsertCompileDefinition(std::string const& entry,
void cmTarget::InsertLinkOption(std::string const& entry,
cmListFileBacktrace const& bt, bool before)
{
std::vector<std::string>::iterator position =
auto position =
before ? impl->LinkOptionsEntries.begin() : impl->LinkOptionsEntries.end();
std::vector<cmListFileBacktrace>::iterator btPosition = before
? impl->LinkOptionsBacktraces.begin()
: impl->LinkOptionsBacktraces.end();
auto btPosition = before ? impl->LinkOptionsBacktraces.begin()
: impl->LinkOptionsBacktraces.end();
impl->LinkOptionsEntries.insert(position, entry);
impl->LinkOptionsBacktraces.insert(btPosition, bt);
@@ -1412,13 +1407,11 @@ void cmTarget::InsertLinkOption(std::string const& entry,
void cmTarget::InsertLinkDirectory(std::string const& entry,
cmListFileBacktrace const& bt, bool before)
{
std::vector<std::string>::iterator position = before
? impl->LinkDirectoriesEntries.begin()
: impl->LinkDirectoriesEntries.end();
auto position = before ? impl->LinkDirectoriesEntries.begin()
: impl->LinkDirectoriesEntries.end();
std::vector<cmListFileBacktrace>::iterator btPosition = before
? impl->LinkDirectoriesBacktraces.begin()
: impl->LinkDirectoriesBacktraces.end();
auto btPosition = before ? impl->LinkDirectoriesBacktraces.begin()
: impl->LinkDirectoriesBacktraces.end();
impl->LinkDirectoriesEntries.insert(position, entry);
impl->LinkDirectoriesBacktraces.insert(btPosition, bt);
@@ -1496,8 +1489,7 @@ static void cmTargetCheckIMPORTED_GLOBAL(const cmTarget* target,
cmMakefile* context)
{
std::vector<cmTarget*> targets = context->GetOwnedImportedTargets();
std::vector<cmTarget*>::const_iterator it =
std::find(targets.begin(), targets.end(), target);
auto it = std::find(targets.begin(), targets.end(), target);
if (it == targets.end()) {
std::ostringstream e;
e << "Attempt to promote imported target \"" << target->GetName()
@@ -1947,7 +1939,7 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config,
(this->IsAIX() && this->IsExecutableWithExports());
// If a mapping was found, check its configurations.
for (std::vector<std::string>::const_iterator mci = mappedConfigs.begin();
for (auto mci = mappedConfigs.begin();
!*loc && !*imp && mci != mappedConfigs.end(); ++mci) {
// Look for this configuration.
if (mci->empty()) {
@@ -2018,8 +2010,7 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config,
if (const char* iconfigs = this->GetProperty("IMPORTED_CONFIGURATIONS")) {
cmExpandList(iconfigs, availableConfigs);
}
for (std::vector<std::string>::const_iterator aci =
availableConfigs.begin();
for (auto aci = availableConfigs.begin();
!*loc && !*imp && aci != availableConfigs.end(); ++aci) {
suffix = cmStrCat('_', cmSystemTools::UpperCase(*aci));
std::string locProp = cmStrCat(locPropBase, suffix);
+1 -1
View File
@@ -20,7 +20,7 @@ bool cmUtilitySourceCommand(std::vector<std::string> const& args,
return false;
}
std::vector<std::string>::const_iterator arg = args.begin();
auto arg = args.begin();
// The first argument is the cache entry name.
std::string const& cacheEntry = *arg++;
+1 -2
View File
@@ -66,8 +66,7 @@ bool cmVariableWatch::VariableAccessed(const std::string& variable,
int access_type, const char* newValue,
const cmMakefile* mf) const
{
cmVariableWatch::StringToVectorOfPairs::const_iterator mit =
this->WatchMap.find(variable);
auto mit = this->WatchMap.find(variable);
if (mit != this->WatchMap.end()) {
// The strategy here is to copy the list of callbacks, and ignore
// new callbacks that existing ones may add.
+1 -1
View File
@@ -19,7 +19,7 @@ bool cmWriteFileCommand(std::vector<std::string> const& args,
return false;
}
std::string message;
std::vector<std::string>::const_iterator i = args.begin();
auto i = args.begin();
std::string const& fileName = *i;
bool overwrite = true;
+1 -2
View File
@@ -106,8 +106,7 @@ public:
bool HasComment() const { return (!this->Comment.empty()); }
cmXCodeObject* GetObject(const char* name) const
{
std::map<std::string, cmXCodeObject*>::const_iterator i =
this->ObjectAttributes.find(name);
auto const i = this->ObjectAttributes.find(name);
if (i != this->ObjectAttributes.end()) {
return i->second;
}
+5 -8
View File
@@ -1271,8 +1271,7 @@ int cmake::HandleDeleteCacheVariables(const std::string& var)
<< "Configure will be re-run and you may have to reset some variables.\n"
<< "The following variables have changed:\n";
/* clang-format on */
for (std::vector<std::string>::iterator i = argsSplit.begin();
i != argsSplit.end(); ++i) {
for (auto i = argsSplit.begin(); i != argsSplit.end(); ++i) {
SaveCacheEntry save;
save.key = *i;
warning << *i << "= ";
@@ -2188,7 +2187,7 @@ int cmake::CheckBuildSystem()
}
// Find the newest dependency.
std::vector<std::string>::iterator dep = depends.begin();
auto dep = depends.begin();
std::string dep_newest = *dep++;
for (; dep != depends.end(); ++dep) {
int result = 0;
@@ -2206,7 +2205,7 @@ int cmake::CheckBuildSystem()
}
// Find the oldest output.
std::vector<std::string>::iterator out = outputs.begin();
auto out = outputs.begin();
std::string out_oldest = *out++;
for (; out != outputs.end(); ++out) {
int result = 0;
@@ -2308,8 +2307,7 @@ bool cmake::GetPropertyAsBool(const std::string& prop)
cmInstalledFile* cmake::GetOrCreateInstalledFile(cmMakefile* mf,
const std::string& name)
{
std::map<std::string, cmInstalledFile>::iterator i =
this->InstalledFiles.find(name);
auto i = this->InstalledFiles.find(name);
if (i != this->InstalledFiles.end()) {
cmInstalledFile& file = i->second;
@@ -2322,8 +2320,7 @@ cmInstalledFile* cmake::GetOrCreateInstalledFile(cmMakefile* mf,
cmInstalledFile const* cmake::GetInstalledFile(const std::string& name) const
{
std::map<std::string, cmInstalledFile>::const_iterator i =
this->InstalledFiles.find(name);
auto i = this->InstalledFiles.find(name);
if (i != this->InstalledFiles.end()) {
cmInstalledFile const& file = i->second;
+1 -1
View File
@@ -1730,7 +1730,7 @@ bool cmVSLink::Parse(std::vector<std::string>::const_iterator argBeg,
{
// Parse our own arguments.
std::string intDir;
std::vector<std::string>::const_iterator arg = argBeg;
auto arg = argBeg;
while (arg != argEnd && cmHasLiteralPrefix(*arg, "-")) {
if (*arg == "--") {
++arg;
+1 -1
View File
@@ -18,7 +18,7 @@ public:
public:
std::string const& at(std::string const& k) const
{
const_iterator i = this->find(k);
auto i = this->find(k);
if (i != this->end()) {
return i->second;
}