@@ -56,7 +56,7 @@ namespace {
5656
5757 inline bool isPureWithoutBody (Function const & func)
5858 {
59- return func.isPure && !func.hasBody ;
59+ return func.isPure () && !func.hasBody () ;
6060 }
6161}
6262
@@ -120,8 +120,8 @@ void CheckClass::constructors()
120120 std::vector<Usage> usage (scope->varlist .size ());
121121
122122 for (func = scope->functionList .begin (); func != scope->functionList .end (); ++func) {
123- if (!func->hasBody || !(func->isConstructor () ||
124- func->type == Function::eOperatorEqual))
123+ if (!func->hasBody () || !(func->isConstructor () ||
124+ func->type == Function::eOperatorEqual))
125125 continue ;
126126
127127 // Mark all variables not used
@@ -143,7 +143,7 @@ void CheckClass::constructors()
143143 if (usage[count].assign || usage[count].init || var->isStatic ())
144144 continue ;
145145
146- if (var->isConst () && func->isOperator ) // We can't set const members in assignment operator
146+ if (var->isConst () && func->isOperator () ) // We can't set const members in assignment operator
147147 continue ;
148148
149149 // Check if this is a class constructor
@@ -456,7 +456,7 @@ void CheckClass::initializeVarList(const Function &func, std::list<const Functio
456456 }
457457
458458 // member function has implementation
459- if (member->hasBody ) {
459+ if (member->hasBody () ) {
460460 // initialize variable use list using member function
461461 callstack.push_back (member);
462462 initializeVarList (*member, callstack, scope, usage);
@@ -584,7 +584,7 @@ void CheckClass::initializeVarList(const Function &func, std::list<const Functio
584584 }
585585
586586 // member function has implementation
587- if (member->hasBody ) {
587+ if (member->hasBody () ) {
588588 // initialize variable use list using member function
589589 callstack.push_back (member);
590590 initializeVarList (*member, callstack, scope, usage);
@@ -626,7 +626,7 @@ void CheckClass::initializeVarList(const Function &func, std::list<const Functio
626626 }
627627
628628 // member function has implementation
629- if (member->hasBody ) {
629+ if (member->hasBody () ) {
630630 // initialize variable use list using member function
631631 callstack.push_back (member);
632632 initializeVarList (*member, callstack, scope, usage);
@@ -864,7 +864,7 @@ void CheckClass::privateFunctions()
864864 std::list<const Function*> privateFuncs;
865865 for (std::list<Function>::const_iterator func = scope->functionList .begin (); func != scope->functionList .end (); ++func) {
866866 // Get private functions..
867- if (func->type == Function::eFunction && func->access == Private && !func->isOperator ) // TODO: There are smarter ways to check private operator usage
867+ if (func->type == Function::eFunction && func->access == Private && !func->isOperator () ) // TODO: There are smarter ways to check private operator usage
868868 privateFuncs.push_back (&*func);
869869 }
870870
@@ -1019,7 +1019,7 @@ void CheckClass::checkMemsetType(const Scope *start, const Token *tok, const Sco
10191019 std::list<Function>::const_iterator func;
10201020
10211021 for (func = type->functionList .begin (); func != type->functionList .end (); ++func) {
1022- if (func->isVirtual ) {
1022+ if (func->isVirtual () ) {
10231023 if (allocation)
10241024 mallocOnClassError (tok, tok->str (), type->classDef , " virtual method" );
10251025 else
@@ -1119,7 +1119,7 @@ void CheckClass::operatorEq()
11191119 for (func = scope->functionList .begin (); func != scope->functionList .end (); ++func) {
11201120 if (func->type == Function::eOperatorEqual && func->access == Public) {
11211121 // skip "deleted" functions - cannot be called anyway
1122- if (func->isDelete )
1122+ if (func->isDelete () )
11231123 continue ;
11241124 // use definition for check so we don't have to deal with qualification
11251125 if (!(Token::Match (func->retDef , " %type% &" ) && func->retDef ->str () == scope->className )) {
@@ -1160,7 +1160,7 @@ void CheckClass::operatorEqRetRefThis()
11601160 std::list<Function>::const_iterator func;
11611161
11621162 for (func = scope->functionList .begin (); func != scope->functionList .end (); ++func) {
1163- if (func->type == Function::eOperatorEqual && func->hasBody ) {
1163+ if (func->type == Function::eOperatorEqual && func->hasBody () ) {
11641164 // make sure return signature is correct
11651165 if (Token::Match (func->retDef , " %type% &" ) && func->retDef ->str () == scope->className ) {
11661166 checkReturnPtrThis (&(*scope), &(*func), func->functionScope ->classStart , func->functionScope ->classEnd );
@@ -1196,13 +1196,13 @@ void CheckClass::checkReturnPtrThis(const Scope *scope, const Function *func, co
11961196 // check if it is a member function
11971197 for (it = scope->functionList .begin (); it != scope->functionList .end (); ++it) {
11981198 // check for a regular function with the same name and a body
1199- if (it->type == Function::eFunction && it->hasBody &&
1199+ if (it->type == Function::eFunction && it->hasBody () &&
12001200 it->token ->str () == tok->next ()->str ()) {
12011201 // check for the proper return type
12021202 if (it->tokenDef ->previous ()->str () == " &" &&
12031203 it->tokenDef ->strAt (-2 ) == scope->className ) {
12041204 // make sure it's not a const function
1205- if (!it->isConst ) {
1205+ if (!it->isConst () ) {
12061206 /* * @todo make sure argument types match */
12071207 // avoid endless recursions
12081208 if (analyzedFunctions.find (&*it) == analyzedFunctions.end ()) {
@@ -1265,7 +1265,7 @@ void CheckClass::operatorEqToSelf()
12651265
12661266 std::list<Function>::const_iterator func;
12671267 for (func = scope->functionList .begin (); func != scope->functionList .end (); ++func) {
1268- if (func->type == Function::eOperatorEqual && func->hasBody ) {
1268+ if (func->type == Function::eOperatorEqual && func->hasBody () ) {
12691269 // make sure that the operator takes an object of the same type as *this, otherwise we can't detect self-assignment checks
12701270 if (func->argumentList .empty ())
12711271 continue ;
@@ -1381,10 +1381,10 @@ void CheckClass::virtualDestructor()
13811381 if (scope->definedType ->derivedFrom .empty ()) {
13821382 if (_settings->inconclusive ) {
13831383 const Function *destructor = scope->getDestructor ();
1384- if (destructor && !destructor->isVirtual ) {
1384+ if (destructor && !destructor->isVirtual () ) {
13851385 std::list<Function>::const_iterator func;
13861386 for (func = scope->functionList .begin (); func != scope->functionList .end (); ++func) {
1387- if (func->isVirtual ) {
1387+ if (func->isVirtual () ) {
13881388 inconclusive_errors.push_back (destructor);
13891389 break ;
13901390 }
@@ -1398,7 +1398,7 @@ void CheckClass::virtualDestructor()
13981398 const Function *destructor = scope->getDestructor ();
13991399
14001400 // Check for destructor with implementation
1401- if (!destructor || !destructor->hasBody )
1401+ if (!destructor || !destructor->hasBody () )
14021402 continue ;
14031403
14041404 // Empty destructor
@@ -1477,7 +1477,7 @@ void CheckClass::virtualDestructor()
14771477 if (found != inconclusive_errors.end ())
14781478 inconclusive_errors.erase (found);
14791479 }
1480- } else if (!base_destructor->isVirtual ) {
1480+ } else if (!base_destructor->isVirtual () ) {
14811481 // TODO: This is just a temporary fix, better solution is needed.
14821482 // Skip situations where base class has base classes of its own, because
14831483 // some of the base classes might have virtual destructor.
@@ -1564,7 +1564,7 @@ void CheckClass::checkConst()
15641564
15651565 for (func = scope->functionList .begin (); func != scope->functionList .end (); ++func) {
15661566 // does the function have a body?
1567- if (func->type == Function::eFunction && func->hasBody && !func->isFriend && !func->isStatic && !func->isVirtual ) {
1567+ if (func->type == Function::eFunction && func->hasBody () && !func->isFriend () && !func->isStatic () && !func->isVirtual () ) {
15681568 // get last token of return type
15691569 const Token *previous = func->tokenDef ->previous ();
15701570
@@ -1586,7 +1586,7 @@ void CheckClass::checkConst()
15861586
15871587 if (!foundConst)
15881588 continue ;
1589- } else if (func->isOperator && Token::Match (previous, " ;|{|}|public:|private:|protected:" )) { // Operator without return type: conversion operator
1589+ } else if (func->isOperator () && Token::Match (previous, " ;|{|}|public:|private:|protected:" )) { // Operator without return type: conversion operator
15901590 const std::string& opName = func->tokenDef ->str ();
15911591 if (opName.compare (8 , 5 , " const" ) != 0 && opName[opName.size ()-1 ] == ' &' )
15921592 continue ;
@@ -1621,11 +1621,11 @@ void CheckClass::checkConst()
16211621 else if (func->tokenDef ->str () == " [" )
16221622 functionName += " ]" ;
16231623
1624- if (!func->isConst || (!memberAccessed && !func->isOperator )) {
1625- if (func->isInline )
1626- checkConstError (func->token , classname, functionName, !memberAccessed && !func->isOperator );
1624+ if (!func->isConst () || (!memberAccessed && !func->isOperator () )) {
1625+ if (func->isInline () )
1626+ checkConstError (func->token , classname, functionName, !memberAccessed && !func->isOperator () );
16271627 else // not inline
1628- checkConstError2 (func->token , func->tokenDef , classname, functionName, !memberAccessed && !func->isOperator );
1628+ checkConstError2 (func->token , func->tokenDef , classname, functionName, !memberAccessed && !func->isOperator () );
16291629 }
16301630 }
16311631 }
@@ -1688,7 +1688,7 @@ bool CheckClass::isMemberVar(const Scope *scope, const Token *tok) const
16881688bool CheckClass::isMemberFunc (const Scope *scope, const Token *tok) const
16891689{
16901690 if (tok->function () && tok->function ()->nestedIn == scope)
1691- return !tok->function ()->isStatic ;
1691+ return !tok->function ()->isStatic () ;
16921692
16931693 // not found in this class
16941694 if (!scope->definedType ->derivedFrom .empty ()) {
@@ -1711,7 +1711,7 @@ bool CheckClass::isMemberFunc(const Scope *scope, const Token *tok) const
17111711bool CheckClass::isConstMemberFunc (const Scope *scope, const Token *tok) const
17121712{
17131713 if (tok->function () && tok->function ()->nestedIn == scope)
1714- return tok->function ()->isConst ;
1714+ return tok->function ()->isConst () ;
17151715
17161716 // not found in this class
17171717 if (!scope->definedType ->derivedFrom .empty ()) {
@@ -1919,7 +1919,7 @@ void CheckClass::initializerListOrder()
19191919
19201920 // iterate through all member functions looking for constructors
19211921 for (func = info->functionList .begin (); func != info->functionList .end (); ++func) {
1922- if ((func->isConstructor ()) && func->hasBody ) {
1922+ if ((func->isConstructor ()) && func->hasBody () ) {
19231923 // check for initializer list
19241924 const Token *tok = func->arg ->link ()->next ();
19251925
@@ -2015,7 +2015,7 @@ void CheckClass::checkPureVirtualFunctionCall()
20152015 std::map<const Function *, std::list<const Token *> > callsPureVirtualFunctionMap;
20162016 for (std::size_t i = 0 ; i < functions; ++i) {
20172017 const Scope * scope = symbolDatabase->functionScopes [i];
2018- if (scope->function == 0 || !scope->function ->hasBody ||
2018+ if (scope->function == 0 || !scope->function ->hasBody () ||
20192019 !(scope->function ->isConstructor () ||
20202020 scope->function ->isDestructor ()))
20212021 continue ;
@@ -2041,7 +2041,7 @@ const std::list<const Token *> & CheckClass::callsPureVirtualFunction(const Func
20412041 callsPureVirtualFunctionMap.insert (std::pair<const Function *, std::list< const Token *> >(&function, std::list<const Token *>()));
20422042 std::list<const Token *> & pureFunctionCalls = found.first ->second ;
20432043 if (found.second ) {
2044- if (function.hasBody ) {
2044+ if (function.hasBody () ) {
20452045 for (const Token *tok = function.arg ->link ();
20462046 tok && tok != function.functionScope ->classEnd ;
20472047 tok = tok->next ()) {
0 commit comments