31
31
32
32
namespace ValueFlow
33
33
{
34
- static Library::Container::Yield findIteratorYield (Token* tok, const Token** ftok, const Settings &settings)
34
+ static Library::Container::Yield findIteratorYield (Token* tok, const Token*& ftok, const Settings &settings)
35
35
{
36
- auto yield = astContainerYield (tok, ftok);
37
- if (ftok && *ftok )
36
+ auto yield = astContainerYield (tok, & ftok);
37
+ if (ftok)
38
38
return yield;
39
39
40
40
if (!tok->astParent ())
41
41
return yield;
42
42
43
43
// begin/end free functions
44
- return astFunctionYield (tok->astParent ()->previous (), settings, ftok);
44
+ return astFunctionYield (tok->astParent ()->previous (), settings, & ftok);
45
45
}
46
46
47
47
void analyzeIterators (TokenList &tokenlist, const Settings &settings)
@@ -53,18 +53,18 @@ namespace ValueFlow
53
53
continue ;
54
54
if (!astIsContainer (tok))
55
55
continue ;
56
- Token* ftok = nullptr ;
57
- const Library::Container::Yield yield = findIteratorYield (tok, const_cast < const Token**>(& ftok) , settings);
58
- if (ftok) {
59
- Value v ( 0 ) ;
60
- v. setKnown ( );
61
- if (yield == Library::Container::Yield::START_ITERATOR) {
62
- v. valueType = Value::ValueType::ITERATOR_START;
63
- setTokenValue (ftok-> next (), std::move (v), settings) ;
64
- } else if (yield == Library::Container::Yield::END_ITERATOR) {
65
- v. valueType = Value::ValueType::ITERATOR_END;
66
- setTokenValue (ftok-> next (), std::move (v), settings) ;
67
- }
56
+ const Token* ftok = nullptr ;
57
+ const Library::Container::Yield yield = findIteratorYield (tok, ftok, settings);
58
+ if (! ftok)
59
+ continue ;
60
+ Value v ( 0 );
61
+ v. setKnown ();
62
+ if (yield == Library::Container::Yield::START_ITERATOR) {
63
+ v. valueType = Value::ValueType::ITERATOR_START ;
64
+ setTokenValue ( const_cast <Token*>(ftok)-> next (), std::move (v), settings);
65
+ } else if (yield == Library::Container::Yield::END_ITERATOR) {
66
+ v. valueType = Value::ValueType::ITERATOR_END ;
67
+ setTokenValue ( const_cast <Token*>(ftok)-> next (), std::move (v), settings);
68
68
}
69
69
}
70
70
}
0 commit comments