Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 21, 2015, 7:05:53 PM (8 years ago)
Author:
muemart
Message:

Run clang-modernize -loop-convert

  • Again, not all possible loops were converted
  • It can do pretty cool transformations, but I had to fix a few compile errors, so there might be some runtime errors lurking around too
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/libraries/core/ClassTreeMask.cc

    r10768 r10821  
    293293        {
    294294            // No it's not: Search for classes inheriting from the given class and add the rules for them
    295             for (std::set<const Identifier*>::const_iterator it = subclass->getDirectChildren().begin(); it != subclass->getDirectChildren().end(); ++it)
    296                 if ((*it)->isA(this->root_->getClass()))
    297                     if (overwrite || (!this->nodeExists(*it))) // If we don't want to overwrite, only add nodes that don't already exist
    298                         this->add(this->root_, *it, bInclude, overwrite);
     295            for (const auto & elem : subclass->getDirectChildren())
     296                if ((elem)->isA(this->root_->getClass()))
     297                    if (overwrite || (!this->nodeExists(elem))) // If we don't want to overwrite, only add nodes that don't already exist
     298                        this->add(this->root_, elem, bInclude, overwrite);
    299299        }
    300300
     
    325325        {
    326326            // Search for an already existing node, containing the subclass we want to add
    327             for (std::list<ClassTreeMaskNode*>::iterator it = node->subnodes_.begin(); it != node->subnodes_.end(); ++it)
     327            for (auto & elem : node->subnodes_)
    328328            {
    329                 if (subclass->isA((*it)->getClass()))
     329                if (subclass->isA((elem)->getClass()))
    330330                {
    331331                    // We've found an existing node -> delegate the work with a recursive function-call and return
    332                     this->add(*it, subclass, bInclude, overwrite);
     332                    this->add(elem, subclass, bInclude, overwrite);
    333333                    return;
    334334                }
     
    392392        if (!subclass)
    393393            return;
    394         for (std::set<const Identifier*>::const_iterator it = subclass->getDirectChildren().begin(); it != subclass->getDirectChildren().end(); ++it)
    395             this->add(*it, this->isIncluded(*it), false, false);
     394        for (const auto & elem : subclass->getDirectChildren())
     395            this->add(elem, this->isIncluded(elem), false, false);
    396396
    397397        this->add(subclass, bInclude, false, clean);
     
    435435
    436436            // Go through the list of subnodes and look for a node containing the searched subclass and delegate the request by a recursive function-call.
    437             for (std::list<ClassTreeMaskNode*>::iterator it = node->subnodes_.begin(); it != node->subnodes_.end(); ++it)
    438                 if (subclass->isA((*it)->getClass()))
    439                     return isIncluded(*it, subclass);
     437            for (auto & elem : node->subnodes_)
     438                if (subclass->isA((elem)->getClass()))
     439                    return isIncluded(elem, subclass);
    440440
    441441            // There is no subnode containing our class -> the rule of the current node takes in effect
     
    957957            // The bool is "false", meaning they have no subnodes and therefore need no further checks
    958958            if (node->isIncluded())
    959                 for (std::set<const Identifier*>::iterator it = directChildren.begin(); it != directChildren.end(); ++it)
    960                     this->subclasses_.insert(this->subclasses_.end(), std::pair<const Identifier*, bool>(*it, false));
     959                for (const auto & elem : directChildren)
     960                    this->subclasses_.insert(this->subclasses_.end(), std::pair<const Identifier*, bool>(elem, false));
    961961        }
    962962    }
Note: See TracChangeset for help on using the changeset viewer.