Fixed #2148 (uninitialized variable: false negative, function parameter that is passed by value)

This commit is contained in:
Daniel Marjamäki 2010-11-12 17:06:14 +01:00
parent 6b489230e8
commit 1204043556
2 changed files with 2 additions and 1 deletions

View File

@ -925,7 +925,7 @@ public:
}
if (tok->str() != "::" && Token::Match(tok->next(), "%var% ( %type%"))
{
if (!Token::simpleMatch(tok->tokAt(2)->link(), ") {"))
if (!Token::Match(tok->tokAt(2)->link(), ") [{;]"))
continue;
const Token *tok2 = tok->tokAt(3);
while (tok2 && tok2->str() != ")")

View File

@ -1128,6 +1128,7 @@ private:
{
// function analysis..
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(int &x) { ++x; }"));
ASSERT_EQUALS("", analyseFunctions("void foo(int &x) { x = 0; }"));