diff options
author | Pavel Solodovnikov <hellyeahdominate@gmail.com> | 2017-09-11 10:40:26 (GMT) |
---|---|---|
committer | Pavel Solodovnikov <hellyeahdominate@gmail.com> | 2017-09-12 13:22:47 (GMT) |
commit | 7d5095796ab616cf9b709036387bb95ab9984141 (patch) | |
tree | c010e922adad95ef86ab4a3ac2a3abd63e9f33ef /Source/cmExtraKateGenerator.cxx | |
parent | 00975e926199eea21763470e2ab876246e36669a (diff) | |
download | CMake-7d5095796ab616cf9b709036387bb95ab9984141.zip CMake-7d5095796ab616cf9b709036387bb95ab9984141.tar.gz CMake-7d5095796ab616cf9b709036387bb95ab9984141.tar.bz2 |
Meta: modernize old-fashioned loops to range-based `for`.
Changes done via `clang-tidy` with some manual fine-tuning
for the variable naming and `auto` type deduction
where appropriate.
Diffstat (limited to 'Source/cmExtraKateGenerator.cxx')
-rw-r--r-- | Source/cmExtraKateGenerator.cxx | 50 |
1 files changed, 20 insertions, 30 deletions
diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx index a75a400..79cc6ef 100644 --- a/Source/cmExtraKateGenerator.cxx +++ b/Source/cmExtraKateGenerator.cxx @@ -112,18 +112,16 @@ void cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg, // add all executable and library targets and some of the GLOBAL // and UTILITY targets - for (std::vector<cmLocalGenerator*>::const_iterator it = - this->GlobalGenerator->GetLocalGenerators().begin(); - it != this->GlobalGenerator->GetLocalGenerators().end(); ++it) { + for (cmLocalGenerator* localGen : + this->GlobalGenerator->GetLocalGenerators()) { const std::vector<cmGeneratorTarget*>& targets = - (*it)->GetGeneratorTargets(); - std::string currentDir = (*it)->GetCurrentBinaryDirectory(); - bool topLevel = (currentDir == (*it)->GetBinaryDirectory()); - - for (std::vector<cmGeneratorTarget*>::const_iterator ti = targets.begin(); - ti != targets.end(); ++ti) { - std::string targetName = (*ti)->GetName(); - switch ((*ti)->GetType()) { + localGen->GetGeneratorTargets(); + std::string currentDir = localGen->GetCurrentBinaryDirectory(); + bool topLevel = (currentDir == localGen->GetBinaryDirectory()); + + for (cmGeneratorTarget* target : targets) { + std::string const& targetName = target->GetName(); + switch (target->GetType()) { case cmStateEnums::GLOBAL_TARGET: { bool insertTarget = false; // Only add the global targets from CMAKE_BINARY_DIR, @@ -134,7 +132,7 @@ void cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg, // this will not work within the IDE if (targetName == "edit_cache") { const char* editCommand = - (*it)->GetMakefile()->GetDefinition("CMAKE_EDIT_COMMAND"); + localGen->GetMakefile()->GetDefinition("CMAKE_EDIT_COMMAND"); if (editCommand == nullptr) { insertTarget = false; } else if (strstr(editCommand, "ccmake") != nullptr) { @@ -183,12 +181,9 @@ void cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg, // insert rules for compiling, preprocessing and assembling individual // files std::vector<std::string> objectFileTargets; - (*it)->GetIndividualFileTargets(objectFileTargets); - for (std::vector<std::string>::const_iterator fit = - objectFileTargets.begin(); - fit != objectFileTargets.end(); ++fit) { - this->AppendTarget(fout, *fit, make, makeArgs, currentDir, - homeOutputDir); + localGen->GetIndividualFileTargets(objectFileTargets); + for (std::string const& f : objectFileTargets) { + this->AppendTarget(fout, f, make, makeArgs, currentDir, homeOutputDir); } } @@ -251,22 +246,18 @@ std::string cmExtraKateGenerator::GenerateFilesString( const std::vector<cmLocalGenerator*>& lgs = this->GlobalGenerator->GetLocalGenerators(); - for (std::vector<cmLocalGenerator*>::const_iterator it = lgs.begin(); - it != lgs.end(); it++) { - cmMakefile* makefile = (*it)->GetMakefile(); + for (cmLocalGenerator* lgen : lgs) { + cmMakefile* makefile = lgen->GetMakefile(); const std::vector<std::string>& listFiles = makefile->GetListFiles(); - for (std::vector<std::string>::const_iterator lt = listFiles.begin(); - lt != listFiles.end(); lt++) { - tmp = *lt; + for (std::string const& listFile : listFiles) { + tmp = listFile; { files.insert(tmp); } } const std::vector<cmSourceFile*>& sources = makefile->GetSourceFiles(); - for (std::vector<cmSourceFile*>::const_iterator sfIt = sources.begin(); - sfIt != sources.end(); sfIt++) { - cmSourceFile* sf = *sfIt; + for (cmSourceFile* sf : sources) { if (sf->GetPropertyAsBool("GENERATED")) { continue; } @@ -278,11 +269,10 @@ std::string cmExtraKateGenerator::GenerateFilesString( const char* sep = ""; tmp = "\"list\": ["; - for (std::set<std::string>::const_iterator it = files.begin(); - it != files.end(); ++it) { + for (std::string const& f : files) { tmp += sep; tmp += " \""; - tmp += *it; + tmp += f; tmp += "\""; sep = ","; } |