Skip to content

Commit e101d72

Browse files
committed
Check astIsLHS()
1 parent d1f76c1 commit e101d72

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/valueflow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4974,7 +4974,7 @@ static const Token* getConditionVariable(const Token* tok)
49744974
if (const Token* parent = tok->astParent()) {
49754975
if (Token::Match(parent, "%oror%|&&|?") ||
49764976
Token::Match(parent->previous(), "if|while (") ||
4977-
(parent->str() == ";" && Token::simpleMatch(parent->astParent(), ";"))) {
4977+
(parent->str() == ";" && astIsLHS(tok) && Token::simpleMatch(parent->astParent(), ";"))) { // for loop condition
49784978
if (Token::simpleMatch(tok, "="))
49794979
return tok->astOperand1();
49804980
if (!Token::Match(tok, "%comp%|%assign%"))

0 commit comments

Comments
 (0)