Fixed #2148 (uninitialized variable: false negative, function parameter that is passed by value)
This commit is contained in:
parent
6b489230e8
commit
1204043556
|
@ -925,7 +925,7 @@ public:
|
||||||
}
|
}
|
||||||
if (tok->str() != "::" && Token::Match(tok->next(), "%var% ( %type%"))
|
if (tok->str() != "::" && Token::Match(tok->next(), "%var% ( %type%"))
|
||||||
{
|
{
|
||||||
if (!Token::simpleMatch(tok->tokAt(2)->link(), ") {"))
|
if (!Token::Match(tok->tokAt(2)->link(), ") [{;]"))
|
||||||
continue;
|
continue;
|
||||||
const Token *tok2 = tok->tokAt(3);
|
const Token *tok2 = tok->tokAt(3);
|
||||||
while (tok2 && tok2->str() != ")")
|
while (tok2 && tok2->str() != ")")
|
||||||
|
|
|
@ -1128,6 +1128,7 @@ private:
|
||||||
{
|
{
|
||||||
// function analysis..
|
// function analysis..
|
||||||
ASSERT_EQUALS("foo", analyseFunctions("void foo(int x) { }"));
|
ASSERT_EQUALS("foo", analyseFunctions("void foo(int x) { }"));
|
||||||
|
ASSERT_EQUALS("foo", analyseFunctions("void foo(int x);"));
|
||||||
ASSERT_EQUALS("foo", analyseFunctions("void foo(const int &x) { }"));
|
ASSERT_EQUALS("foo", analyseFunctions("void foo(const int &x) { }"));
|
||||||
ASSERT_EQUALS("foo", analyseFunctions("void foo(int &x) { ++x; }"));
|
ASSERT_EQUALS("foo", analyseFunctions("void foo(int &x) { ++x; }"));
|
||||||
ASSERT_EQUALS("", analyseFunctions("void foo(int &x) { x = 0; }"));
|
ASSERT_EQUALS("", analyseFunctions("void foo(int &x) { x = 0; }"));
|
||||||
|
|
Loading…
Reference in New Issue