@@ -6163,17 +6163,17 @@ static void valueFlowSmartPointer(TokenList &tokenlist, ErrorLogger & errorLogge
61636163 }
61646164}
61656165
6166- static Library::Container::Yield findIteratorYield (Token* tok, const Token** ftok, const Settings& settings)
6166+ static Library::Container::Yield findIteratorYield (Token* tok, const Token*& ftok, const Settings& settings)
61676167{
6168- auto yield = astContainerYield (tok, ftok);
6169- if (ftok && *ftok )
6168+ auto yield = astContainerYield (tok, & ftok);
6169+ if (ftok)
61706170 return yield;
61716171
61726172 if (!tok->astParent ())
61736173 return yield;
61746174
61756175 // begin/end free functions
6176- return astFunctionYield (tok->astParent ()->previous (), settings, ftok);
6176+ return astFunctionYield (tok->astParent ()->previous (), settings, & ftok);
61776177}
61786178
61796179static void valueFlowIterators (TokenList& tokenlist, const Settings& settings)
@@ -6185,18 +6185,18 @@ static void valueFlowIterators(TokenList& tokenlist, const Settings& settings)
61856185 continue ;
61866186 if (!astIsContainer (tok))
61876187 continue ;
6188- Token* ftok = nullptr ;
6189- const Library::Container::Yield yield = findIteratorYield (tok, const_cast < const Token**>(& ftok) , settings);
6190- if (ftok) {
6191- ValueFlow::Value v ( 0 ) ;
6192- v. setKnown ( );
6193- if (yield == Library::Container::Yield::START_ITERATOR) {
6194- v. valueType = ValueFlow::Value::ValueType::ITERATOR_START;
6195- setTokenValue (ftok-> next (), std::move (v), settings) ;
6196- } else if (yield == Library::Container::Yield::END_ITERATOR) {
6197- v. valueType = ValueFlow::Value::ValueType::ITERATOR_END;
6198- setTokenValue (ftok-> next (), std::move (v), settings) ;
6199- }
6188+ const Token* ftok = nullptr ;
6189+ const Library::Container::Yield yield = findIteratorYield (tok, ftok, settings);
6190+ if (! ftok)
6191+ continue ;
6192+ ValueFlow::Value v ( 0 );
6193+ v. setKnown ();
6194+ if (yield == Library::Container::Yield::START_ITERATOR) {
6195+ v. valueType = ValueFlow::Value::ValueType::ITERATOR_START ;
6196+ setTokenValue ( const_cast <Token*>(ftok)-> next (), std::move (v), settings);
6197+ } else if (yield == Library::Container::Yield::END_ITERATOR) {
6198+ v. valueType = ValueFlow::Value::ValueType::ITERATOR_END ;
6199+ setTokenValue ( const_cast <Token*>(ftok)-> next (), std::move (v), settings);
62006200 }
62016201 }
62026202}
@@ -7214,7 +7214,7 @@ void ValueFlow::setValues(TokenList& tokenlist,
72147214
72157215 runner.run_once ({
72167216 VFA (valueFlowDynamicBufferSize (tokenlist, symboldatabase, errorLogger, settings)),
7217- VFA (valueFlowDebug (tokenlist, errorLogger, settings)),
7217+ VFA (valueFlowDebug (tokenlist, errorLogger, settings)), // TODO: add option to print it after each step/iteration
72187218 });
72197219}
72207220
0 commit comments