From 5d0ace3a500f0fe40667d32730708e1338d31ade Mon Sep 17 00:00:00 2001 From: Pete Johns Date: Thu, 30 Dec 2010 17:47:05 +1100 Subject: [PATCH] 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.] --- lib/symboldatabase.cpp | 14 ++++++++++++++ test/testclass.cpp | 5 +++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 7fd4e8322..106a338f4 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -1150,6 +1150,20 @@ void SymbolDatabase::SpaceInfo::getVarList() typetok = vartok->previous(); 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? else if (Token::Match(tok, "struct|union %type% %var% ;")) diff --git a/test/testclass.cpp b/test/testclass.cpp index a2182f740..e0c20c0a0 100644 --- a/test/testclass.cpp +++ b/test/testclass.cpp @@ -4813,7 +4813,7 @@ private: " a = b;\n" "}\n"); - TODO_ASSERT_EQUALS("", errout.str()); + ASSERT_EQUALS("", errout.str()); checkConst("namespace AA\n" "{\n" @@ -4837,7 +4837,7 @@ private: " }\n" "};\n"); - TODO_ASSERT_EQUALS("", errout.str()); + ASSERT_EQUALS("", errout.str()); checkConst("namespace ZZ\n" "{\n" @@ -5360,6 +5360,7 @@ private: ASSERT_EQUALS("", errout.str()); } + }; REGISTER_TEST(TestClass)