@@ -1517,8 +1517,8 @@ bool CheckUnusedVar::isRecordTypeWithoutSideEffects(const Type* type)
15171517 return withoutSideEffects = false ;
15181518 }
15191519 const Function* initValueFunc = valueToken->function ();
1520- if (initValueFunc && !isFunctionWithoutSideEffects (*initValueFunc, valueToken,
1521- std::list<const Function*>{})) {
1520+ if (initValueFunc && !isFunctionWithoutSideEffects (*initValueFunc, valueToken,
1521+ std::list<const Function*> {})) {
15221522 return withoutSideEffects = false ;
15231523 }
15241524 }
@@ -1594,7 +1594,8 @@ bool CheckUnusedVar::isEmptyType(const Type* type)
15941594}
15951595
15961596bool CheckUnusedVar::isFunctionWithoutSideEffects (const Function& func, const Token* functionUsageToken,
1597- std::list<const Function*> checkedFuncs) {
1597+ std::list<const Function*> checkedFuncs)
1598+ {
15981599 // no body to analyze
15991600 if (!func.hasBody ()) {
16001601 return false ;
@@ -1608,17 +1609,16 @@ bool CheckUnusedVar::isFunctionWithoutSideEffects(const Function& func, const To
16081609 }
16091610
16101611 bool sideEffectReturnFound = false ;
1611- for (Token* bodyToken = func.functionScope ->bodyStart ->next (); bodyToken != func.functionScope ->bodyEnd ;
1612- bodyToken = bodyToken->next ())
1613- {
1612+ for (Token* bodyToken = func.functionScope ->bodyStart ->next (); bodyToken != func.functionScope ->bodyEnd ;
1613+ bodyToken = bodyToken->next ()) {
16141614 const Variable* bodyVariable = bodyToken->variable ();
16151615 if (bodyVariable) {
16161616 // check variable for side-effects
16171617 if (!isVariableWithoutSideEffects (*bodyVariable)) {
16181618 return false ;
16191619 }
16201620 // check if global variable is changed
1621- if (bodyVariable->isGlobal ()) {
1621+ if (bodyVariable->isGlobal ()) {
16221622 return false ; // TODO: analyze global variable usage
16231623 }
16241624 }
@@ -1645,7 +1645,7 @@ bool CheckUnusedVar::isFunctionWithoutSideEffects(const Function& func, const To
16451645 }
16461646 // simple one-token return
16471647 const Variable* returnVariable = returnValueToken->variable ();
1648- if (returnValueToken->isLiteral () ||
1648+ if (returnValueToken->isLiteral () ||
16491649 (returnVariable && isVariableWithoutSideEffects (*returnVariable))) {
16501650 continue ;
16511651 }
0 commit comments