@@ -4598,7 +4598,7 @@ struct ConditionHandler {
4598
4598
if (Token::Match (tok, " :|;|," ))
4599
4599
continue ;
4600
4600
4601
- const Token* top = tok->astTop ();
4601
+ const Token* top = tok->astFinalTop ();
4602
4602
4603
4603
if (!Token::Match (top->previous (), " if|while|for (" ) && !Token::Match (tok->astParent (), " &&|%oror%|?|!" ))
4604
4604
continue ;
@@ -4632,7 +4632,7 @@ struct ConditionHandler {
4632
4632
if (tok->hasKnownIntValue ())
4633
4633
return ;
4634
4634
4635
- Token* top = tok->astTop ();
4635
+ Token* top = tok->astFinalTop ();
4636
4636
4637
4637
if (Token::Match (top, " %assign%" ))
4638
4638
return ;
@@ -4851,7 +4851,7 @@ struct ConditionHandler {
4851
4851
}
4852
4852
}
4853
4853
4854
- Token* top = condTok->astTop ();
4854
+ Token* top = condTok->astFinalTop ();
4855
4855
4856
4856
if (top->previous ()->isExpandedMacro ()) {
4857
4857
for (std::list<ValueFlow::Value>* values : {&thenValues, &elseValues}) {
@@ -5413,7 +5413,7 @@ static void valueFlowForLoopSimplify(Token* const bodyStart,
5413
5413
}
5414
5414
5415
5415
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));
5417
5417
if ((tok2->str () == " &&" && !conditionIsTrue (tok2->astOperand1 (), programMemory, settings)) ||
5418
5418
(tok2->str () == " ||" && !conditionIsFalse (tok2->astOperand1 (), programMemory, settings))) {
5419
5419
// Skip second expression..
@@ -5438,11 +5438,11 @@ static void valueFlowForLoopSimplify(Token* const bodyStart,
5438
5438
5439
5439
if ((tok2->str () == " &&" &&
5440
5440
conditionIsFalse (tok2->astOperand1 (),
5441
- getProgramMemory (tok2->astTop (), expr, ValueFlow::Value (value), settings),
5441
+ getProgramMemory (tok2->astFinalTop (), expr, ValueFlow::Value (value), settings),
5442
5442
settings)) ||
5443
5443
(tok2->str () == " ||" &&
5444
5444
conditionIsTrue (tok2->astOperand1 (),
5445
- getProgramMemory (tok2->astTop (), expr, ValueFlow::Value (value), settings),
5445
+ getProgramMemory (tok2->astFinalTop (), expr, ValueFlow::Value (value), settings),
5446
5446
settings)))
5447
5447
break ;
5448
5448
@@ -6797,7 +6797,7 @@ static void valueFlowContainerSize(const TokenList& tokenlist,
6797
6797
!Token::Match (nameToken, " %name% (" ))
6798
6798
continue ;
6799
6799
}
6800
- if (Token::Match (nameToken->astTop ()->previous (), " for|while" ))
6800
+ if (Token::Match (nameToken->astFinalTop ()->previous (), " for|while" ))
6801
6801
known = !isVariableChanged (var, settings);
6802
6802
std::vector<ValueFlow::Value> values{ValueFlow::Value{size}};
6803
6803
values.back ().valueType = ValueFlow::Value::ValueType::CONTAINER_SIZE;
0 commit comments