Fixed #2377 (Technically the member function xxx can be const)

TODO: Add unit test for getVarList() and refactor variable check.

[Removed my testcase for #2377 and removed two TODOs.]
This commit is contained in:
Pete Johns 2010-12-30 17:47:05 +11:00
parent ac42c0ba3b
commit 5d0ace3a50
2 changed files with 17 additions and 2 deletions

View File

@ -1150,6 +1150,20 @@ void SymbolDatabase::SpaceInfo::getVarList()
typetok = vartok->previous(); typetok = vartok->previous();
tok = vartok->next(); tok = vartok->next();
} }
else if (Token::Match(tok, "%type% :: %type% :: %type% :: %type% %var% ;"))
{
isClass = true;
vartok = tok->tokAt(7);
typetok = vartok->previous();
tok = vartok->next();
}
else if (Token::Match(tok, ":: %type% :: %type% :: %type% :: %type% %var% ;"))
{
isClass = true;
vartok = tok->tokAt(8);
typetok = vartok->previous();
tok = vartok->next();
}
// Structure? // Structure?
else if (Token::Match(tok, "struct|union %type% %var% ;")) else if (Token::Match(tok, "struct|union %type% %var% ;"))

View File

@ -4813,7 +4813,7 @@ private:
" a = b;\n" " a = b;\n"
"}\n"); "}\n");
TODO_ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
checkConst("namespace AA\n" checkConst("namespace AA\n"
"{\n" "{\n"
@ -4837,7 +4837,7 @@ private:
" }\n" " }\n"
"};\n"); "};\n");
TODO_ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
checkConst("namespace ZZ\n" checkConst("namespace ZZ\n"
"{\n" "{\n"
@ -5360,6 +5360,7 @@ private:
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
} }
}; };
REGISTER_TEST(TestClass) REGISTER_TEST(TestClass)