Variable usage: Added TODO testcases for handling pointer alias. Ticket: #1729

This commit is contained in:
Robert Reif 2010-06-06 20:37:48 +02:00 committed by Daniel Marjamäki
parent 0d34416bce
commit f37a7ba934
1 changed files with 33 additions and 0 deletions

View File

@ -86,6 +86,7 @@ private:
TEST_CASE(localvaralias3); // ticket #1639
TEST_CASE(localvaralias4); // ticket #1643
TEST_CASE(localvaralias5); // ticket #1647
TEST_CASE(localvaralias6); // ticket #1729
TEST_CASE(localvarasm);
// Don't give false positives for variables in structs/unions
@ -1688,6 +1689,38 @@ private:
ASSERT_EQUALS(std::string(""), errout.str());
}
void localvaralias6() // ticket 1729
{
functionVariableUsage("void foo()\n"
"{\n"
" char buf[8];\n"
" char *srcdata;\n"
" if (a()) {\n"
" buf[0] = 1;\n"
" srcdata = buf;\n"
" } else {\n"
" srcdata = vdata;\n"
" }\n"
" b(srcdata);\n"
"}");
TODO_ASSERT_EQUALS(std::string(""), errout.str());
functionVariableUsage("void foo()\n"
"{\n"
" char buf[8];\n"
" char *srcdata;\n"
" char vdata[8];\n"
" if (a()) {\n"
" buf[0] = 1;\n"
" srcdata = buf;\n"
" } else {\n"
" srcdata = vdata;\n"
" }\n"
" b(srcdata);\n"
"}");
TODO_ASSERT_EQUALS(std::string(""), errout.str());
}
void localvarasm()
{
functionVariableUsage("void foo(int &b)\n"