Symbol database: Bug fix
This commit is contained in:
parent
c0100bac94
commit
cf0403434d
|
@ -446,8 +446,20 @@ void CheckClass::createSymbolDatabase()
|
|||
const Token *argStart = 0;
|
||||
|
||||
// function?
|
||||
if (tok->previous()->str() == "::" && isFunction(tok, &funcStart, &argStart))
|
||||
addFunction(&info, &tok);
|
||||
if (isFunction(tok, &funcStart, &argStart))
|
||||
{
|
||||
// has body?
|
||||
if (Token::Match(argStart->link(), ") const| {|:"))
|
||||
{
|
||||
// class function
|
||||
if (tok->previous()->str() == "::")
|
||||
addFunction(&info, &tok);
|
||||
|
||||
// regular function
|
||||
else
|
||||
addNewFunction(&info, &tok);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -460,13 +472,17 @@ void CheckClass::createSymbolDatabase()
|
|||
// function?
|
||||
if (isFunction(tok, &funcStart, &argStart))
|
||||
{
|
||||
// class function
|
||||
if (tok->previous()->str() == "::")
|
||||
addFunction(&info, &tok);
|
||||
// has body?
|
||||
if (Token::Match(argStart->link(), ") const| {|:"))
|
||||
{
|
||||
// class function
|
||||
if (tok->previous() && tok->previous()->str() == "::")
|
||||
addFunction(&info, &tok);
|
||||
|
||||
// regular function
|
||||
else
|
||||
addNewFunction(&info, &tok);
|
||||
// regular function
|
||||
else
|
||||
addNewFunction(&info, &tok);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -165,6 +165,7 @@ private:
|
|||
TEST_CASE(symboldatabase1);
|
||||
TEST_CASE(symboldatabase2);
|
||||
TEST_CASE(symboldatabase3); // ticket #2000
|
||||
TEST_CASE(symboldatabase4);
|
||||
}
|
||||
|
||||
// Check the operator Equal
|
||||
|
@ -4739,6 +4740,34 @@ private:
|
|||
"};\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void symboldatabase4()
|
||||
{
|
||||
checkConst("static void function_declaration_before(void) __attribute__((__used__));\n"
|
||||
"static void function_declaration_before(void) {}\n"
|
||||
"static void function_declaration_after(void) {}\n"
|
||||
"static void function_declaration_after(void) __attribute__((__used__));\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
checkConst("main(int argc, char *argv[]) { }\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
checkConst("namespace boost {\n"
|
||||
" std::locale generate_locale()\n"
|
||||
" {\n"
|
||||
" return std::locale();\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
checkConst("namespace X {\n"
|
||||
" static void function_declaration_before(void) __attribute__((__used__));\n"
|
||||
" static void function_declaration_before(void) {}\n"
|
||||
" static void function_declaration_after(void) {}\n"
|
||||
" static void function_declaration_after(void) __attribute__((__used__));\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
};
|
||||
|
||||
REGISTER_TEST(TestClass)
|
||||
|
|
Loading…
Reference in New Issue