@@ -1893,13 +1893,14 @@ struct ValueFlowAnalyzer : Analyzer {
18931893 } else {
18941894 if (rhsValue && !value->isImpossible () && value->equalValue (*rhsValue))
18951895 a = Action::Idempotent;
1896+ a |= Action::Incremental;
18961897 }
18971898 return a;
18981899 }
18991900
19001901 // increment/decrement
19011902 if (Token::Match (tok->previous (), " ++|-- %name%" ) || Token::Match (tok, " %name% ++|--" )) {
1902- return Action::Read | Action::Write;
1903+ return Action::Read | Action::Write | Action::Incremental ;
19031904 }
19041905 return Action::None;
19051906 }
@@ -5706,17 +5707,17 @@ struct ContainerVariableAnalyzer : VariableAnalyzer {
57065707 if (tok->valueType ()->container ->stdStringLike && Token::simpleMatch (parent, " +=" ) && astIsLHS (tok) && parent->astOperand2 ()) {
57075708 const Token* rhs = parent->astOperand2 ();
57085709 if (rhs->tokType () == Token::eString)
5709- return Action::Read | Action::Write;
5710+ return Action::Read | Action::Write | Action::Incremental ;
57105711 if (rhs->valueType () && rhs->valueType ()->container && rhs->valueType ()->container ->stdStringLike ) {
57115712 if (std::any_of (rhs->values ().begin (), rhs->values ().end (), [&](const ValueFlow::Value &rhsval) {
57125713 return rhsval.isKnown () && rhsval.isContainerSizeValue ();
57135714 }))
5714- return Action::Read | Action::Write;
5715+ return Action::Read | Action::Write | Action::Incremental ;
57155716 }
57165717 } else if (Token::Match (tok, " %name% . %name% (" )) {
57175718 Library::Container::Action action = tok->valueType ()->container ->getAction (tok->strAt (2 ));
57185719 if (action == Library::Container::Action::PUSH || action == Library::Container::Action::POP )
5719- return Action::Read | Action::Write;
5720+ return Action::Read | Action::Write | Action::Incremental ;
57205721 }
57215722 return Action::None;
57225723 }
0 commit comments