Fixed #914 (improve check: usage of uninitialized variable)

This commit is contained in:
Daniel Marjamäki 2010-11-12 17:14:37 +01:00
parent 1204043556
commit e523d5a3a3
2 changed files with 8 additions and 0 deletions

View File

@ -991,6 +991,12 @@ public:
continue;
}
if (Token::Match(tok2, "const %type% %var% [ ] ,|)") && tok2->next()->isStandardType())
{
tok2 = tok2->tokAt(5);
continue;
}
break;
}

View File

@ -1131,6 +1131,8 @@ private:
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("rename", analyseFunctions("int rename (const char* oldname, const char* newname);"));
ASSERT_EQUALS("rename", analyseFunctions("int rename (const char oldname[], const char newname[]);"));
ASSERT_EQUALS("", analyseFunctions("void foo(int &x) { x = 0; }"));
ASSERT_EQUALS("", analyseFunctions("void foo(s x) { }"));