@@ -4598,7 +4598,7 @@ struct ConditionHandler {
45984598 if (Token::Match(tok, ":|;|,"))
45994599 continue;
46004600
4601- const Token* top = tok->astTop ();
4601+ const Token* top = tok->astFinalTop ();
46024602
46034603 if (!Token::Match(top->previous(), "if|while|for (") && !Token::Match(tok->astParent(), "&&|%oror%|?|!"))
46044604 continue;
@@ -4632,7 +4632,7 @@ struct ConditionHandler {
46324632 if (tok->hasKnownIntValue())
46334633 return;
46344634
4635- Token* top = tok->astTop ();
4635+ Token* top = tok->astFinalTop ();
46364636
46374637 if (Token::Match(top, "%assign%"))
46384638 return;
@@ -4851,7 +4851,7 @@ struct ConditionHandler {
48514851 }
48524852 }
48534853
4854- Token* top = condTok->astTop ();
4854+ Token* top = condTok->astFinalTop ();
48554855
48564856 if (top->previous()->isExpandedMacro()) {
48574857 for (std::list<ValueFlow::Value>* values : {&thenValues, &elseValues}) {
@@ -5413,7 +5413,7 @@ static void valueFlowForLoopSimplify(Token* const bodyStart,
54135413 }
54145414
54155415 if (Token::Match(tok2, "%oror%|&&")) {
5416- const ProgramMemory programMemory(getProgramMemory(tok2->astTop (), expr, ValueFlow::Value(value), settings));
5416+ const ProgramMemory programMemory(getProgramMemory(tok2->astFinalTop (), expr, ValueFlow::Value(value), settings));
54175417 if ((tok2->str() == "&&" && !conditionIsTrue(tok2->astOperand1(), programMemory, settings)) ||
54185418 (tok2->str() == "||" && !conditionIsFalse(tok2->astOperand1(), programMemory, settings))) {
54195419 // Skip second expression..
@@ -5438,11 +5438,11 @@ static void valueFlowForLoopSimplify(Token* const bodyStart,
54385438
54395439 if ((tok2->str() == "&&" &&
54405440 conditionIsFalse(tok2->astOperand1(),
5441- getProgramMemory(tok2->astTop (), expr, ValueFlow::Value(value), settings),
5441+ getProgramMemory(tok2->astFinalTop (), expr, ValueFlow::Value(value), settings),
54425442 settings)) ||
54435443 (tok2->str() == "||" &&
54445444 conditionIsTrue(tok2->astOperand1(),
5445- getProgramMemory(tok2->astTop (), expr, ValueFlow::Value(value), settings),
5445+ getProgramMemory(tok2->astFinalTop (), expr, ValueFlow::Value(value), settings),
54465446 settings)))
54475447 break;
54485448
@@ -6797,7 +6797,7 @@ static void valueFlowContainerSize(const TokenList& tokenlist,
67976797 !Token::Match(nameToken, "%name% ("))
67986798 continue;
67996799 }
6800- if (Token::Match(nameToken->astTop ()->previous(), "for|while"))
6800+ if (Token::Match(nameToken->astFinalTop ()->previous(), "for|while"))
68016801 known = !isVariableChanged(var, settings);
68026802 std::vector<ValueFlow::Value> values{ValueFlow::Value{size}};
68036803 values.back().valueType = ValueFlow::Value::ValueType::CONTAINER_SIZE;
0 commit comments