diff options
author | Regina Pfeifer <regina@mailbox.org> | 2019-09-04 20:17:22 (GMT) |
---|---|---|
committer | Regina Pfeifer <regina@mailbox.org> | 2019-09-10 20:21:41 (GMT) |
commit | d25a5a7ec91bfa072d3cf1a302830a54506c88c0 (patch) | |
tree | d06203c8e5b5fdd38645e0fb9b284ded26651f44 /Source/cmMakefile.cxx | |
parent | bbf48c494ad28d1c8ac5aa6e4cecb35c2cbf1b84 (diff) | |
download | CMake-d25a5a7ec91bfa072d3cf1a302830a54506c88c0.zip CMake-d25a5a7ec91bfa072d3cf1a302830a54506c88c0.tar.gz CMake-d25a5a7ec91bfa072d3cf1a302830a54506c88c0.tar.bz2 |
clang-tidy: modernize-use-auto
Set the MinTypeNameLength option to an impossibly high value in order
to limit the diagnostics to iterators. Leave new expressions and cast
expressions for later.
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 43 |
1 files changed, 18 insertions, 25 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 411add3..5f83746 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -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; } |