@@ -563,23 +563,23 @@ void CheckClass::initVar(nonneg int varid, const Scope *scope, std::vector<Usage
563563
564564void CheckClass::assignAllVar (std::vector<Usage> &usage)
565565{
566- for (int i = 0 ; i < usage. size (); ++i )
567- usage[i] .assign = true ;
566+ for (Usage & i : usage)
567+ i .assign = true ;
568568}
569569
570570void CheckClass::clearAllVar (std::vector<Usage> &usage)
571571{
572- for (int i = 0 ; i < usage. size (); ++i ) {
573- usage[i] .assign = false ;
574- usage[i] .init = false ;
572+ for (Usage & i : usage) {
573+ i .assign = false ;
574+ i .init = false ;
575575 }
576576}
577577
578578bool CheckClass::isBaseClassFunc (const Token *tok, const Scope *scope)
579579{
580580 // Iterate through each base class...
581- for (int i = 0 ; i < scope->definedType ->derivedFrom . size (); ++i ) {
582- const Type *derivedFrom = scope-> definedType -> derivedFrom [i] .type ;
581+ for (const Type::BaseInfo & i : scope->definedType ->derivedFrom ) {
582+ const Type *derivedFrom = i .type ;
583583
584584 // Check if base class exists in database
585585 if (derivedFrom && derivedFrom->classScope ) {
@@ -1222,8 +1222,8 @@ void CheckClass::checkMemsetType(const Scope *start, const Token *tok, const Sco
12221222 const bool printPortability = mSettings ->isEnabled (Settings::PORTABILITY );
12231223
12241224 // recursively check all parent classes
1225- for (int i = 0 ; i < type->definedType ->derivedFrom . size (); i++ ) {
1226- const Type* derivedFrom = type-> definedType -> derivedFrom [i] .type ;
1225+ for (const Type::BaseInfo & i : type->definedType ->derivedFrom ) {
1226+ const Type* derivedFrom = i .type ;
12271227 if (derivedFrom && derivedFrom->classScope )
12281228 checkMemsetType (start, tok, derivedFrom->classScope , allocation, parsedTypes);
12291229 }
@@ -1680,10 +1680,10 @@ void CheckClass::virtualDestructor()
16801680 const Token *derivedClass = derived->next ();
16811681
16821682 // Iterate through each base class...
1683- for (int j = 0 ; j < scope->definedType ->derivedFrom . size (); ++j ) {
1683+ for (const Type::BaseInfo & j : scope->definedType ->derivedFrom ) {
16841684 // Check if base class is public and exists in database
1685- if (scope-> definedType -> derivedFrom [j] .access != AccessControl::Private && scope-> definedType -> derivedFrom [j] .type ) {
1686- const Type *derivedFrom = scope-> definedType -> derivedFrom [j] .type ;
1685+ if (j .access != AccessControl::Private && j .type ) {
1686+ const Type *derivedFrom = j .type ;
16871687 const Scope *derivedFromScope = derivedFrom->classScope ;
16881688 if (!derivedFromScope)
16891689 continue ;
@@ -1937,9 +1937,9 @@ bool CheckClass::isMemberVar(const Scope *scope, const Token *tok) const
19371937 // not found in this class
19381938 if (!scope->definedType ->derivedFrom .empty ()) {
19391939 // check each base class
1940- for (int i = 0 ; i < scope->definedType ->derivedFrom . size (); ++i ) {
1940+ for (const Type::BaseInfo & i : scope->definedType ->derivedFrom ) {
19411941 // find the base class
1942- const Type *derivedFrom = scope-> definedType -> derivedFrom [i] .type ;
1942+ const Type *derivedFrom = i .type ;
19431943
19441944 // find the function in the base class
19451945 if (derivedFrom && derivedFrom->classScope ) {
@@ -1976,9 +1976,9 @@ bool CheckClass::isMemberFunc(const Scope *scope, const Token *tok) const
19761976 // not found in this class
19771977 if (!scope->definedType ->derivedFrom .empty ()) {
19781978 // check each base class
1979- for (int i = 0 ; i < scope->definedType ->derivedFrom . size (); ++i ) {
1979+ for (const Type::BaseInfo & i : scope->definedType ->derivedFrom ) {
19801980 // find the base class
1981- const Type *derivedFrom = scope-> definedType -> derivedFrom [i] .type ;
1981+ const Type *derivedFrom = i .type ;
19821982
19831983 // find the function in the base class
19841984 if (derivedFrom && derivedFrom->classScope ) {
@@ -2001,9 +2001,9 @@ bool CheckClass::isConstMemberFunc(const Scope *scope, const Token *tok) const
20012001 // not found in this class
20022002 if (!scope->definedType ->derivedFrom .empty ()) {
20032003 // check each base class
2004- for (int i = 0 ; i < scope->definedType ->derivedFrom . size (); ++i ) {
2004+ for (const Type::BaseInfo & i : scope->definedType ->derivedFrom ) {
20052005 // find the base class
2006- const Type *derivedFrom = scope-> definedType -> derivedFrom [i] .type ;
2006+ const Type *derivedFrom = i .type ;
20072007
20082008 // find the function in the base class
20092009 if (derivedFrom && derivedFrom->classScope ) {
0 commit comments