Fixed #7310 (ValueFlow: Value of NULL in function call)
This commit is contained in:
parent
5c9be4a0df
commit
462b98afbc
|
@ -584,6 +584,12 @@ static void valueFlowNumber(TokenList *tokenlist)
|
|||
ValueFlow::Value value(tok->str() == "true");
|
||||
value.setKnown();
|
||||
setTokenValue(tok, value);
|
||||
} else if (Token::Match(tok, "[(,] NULL [,)]")) {
|
||||
// NULL function parameters are not simplified in the
|
||||
// normal tokenlist
|
||||
ValueFlow::Value value(0);
|
||||
value.setKnown();
|
||||
setTokenValue(tok->next(), value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -167,6 +167,7 @@ private:
|
|||
ASSERT_EQUALS(123, valueOfTok("x=123;", "123").intvalue);
|
||||
ASSERT_EQUALS(0, valueOfTok("x=false;", "false").intvalue);
|
||||
ASSERT_EQUALS(1, valueOfTok("x=true;", "true").intvalue);
|
||||
ASSERT_EQUALS(0, valueOfTok("x(NULL);", "NULL").intvalue);
|
||||
ASSERT_EQUALS((int)('a'), valueOfTok("x='a';", "'a'").intvalue);
|
||||
ASSERT_EQUALS((int)('\n'), valueOfTok("x='\\n';", "'\\n'").intvalue);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue