@@ -1531,6 +1531,10 @@ static void valueFlowForLoop(TokenList *tokenlist, SymbolDatabase* symboldatabas
15311531 Token* tok = const_cast <Token*>(scope->classDef );
15321532 Token* const bodyStart = const_cast <Token*>(scope->classStart );
15331533
1534+ if (!Token::simpleMatch (tok->next ()->astOperand2 (), " ;" ) ||
1535+ !Token::simpleMatch (tok->next ()->astOperand2 ()->astOperand2 (), " ;" ))
1536+ continue ;
1537+
15341538 unsigned int varid (0 );
15351539 MathLib::bigint num1 (0 ), num2 (0 ), numAfter (0 );
15361540
@@ -1632,6 +1636,15 @@ static void valueFlowFunctionReturn(TokenList *tokenlist, ErrorLogger *errorLogg
16321636 if (tok->str () != " (" || !tok->astOperand1 () || !tok->astOperand1 ()->function ())
16331637 continue ;
16341638
1639+ // Get scope and args of function
1640+ const Function * const function = tok->astOperand1 ()->function ();
1641+ const Scope * const functionScope = function->functionScope ;
1642+ if (!functionScope || !Token::simpleMatch (functionScope->classStart , " { return" )) {
1643+ if (functionScope && settings->debugwarnings )
1644+ bailout (tokenlist, errorLogger, tok, " function return; nontrivial function body" );
1645+ continue ;
1646+ }
1647+
16351648 // Arguments..
16361649 std::vector<MathLib::bigint> parvalues;
16371650 {
@@ -1650,15 +1663,6 @@ static void valueFlowFunctionReturn(TokenList *tokenlist, ErrorLogger *errorLogg
16501663 continue ;
16511664 }
16521665
1653- // Get scope and args of function
1654- const Function * const function = tok->astOperand1 ()->function ();
1655- const Scope * const functionScope = function ? function->functionScope : nullptr ;
1656- if (!functionScope || !Token::simpleMatch (functionScope->classStart , " { return" )) {
1657- if (functionScope && settings->debugwarnings )
1658- bailout (tokenlist, errorLogger, tok, " function return; nontrivial function body" );
1659- continue ;
1660- }
1661-
16621666 std::map<unsigned int , MathLib::bigint> programMemory;
16631667 for (std::size_t i = 0 ; i < parvalues.size (); ++i) {
16641668 const Variable * const arg = function->getArgumentVar (i);
0 commit comments