Fixed #7343 (SymbolDatabase: handling of override)

This commit is contained in:
Daniel Marjamäki 2016-01-22 19:22:24 +01:00
parent 8ce813f241
commit f64930b7f5
2 changed files with 16 additions and 0 deletions

View File

@ -1334,6 +1334,7 @@ bool SymbolDatabase::isFunction(const Token *tok, const Scope* outerScope, const
(tok2->isUpperCaseName() && Token::Match(tok2, "%name% (") && tok2->next()->link()->strAt(1) == "{") ||
Token::Match(tok2, ": ::| %name% (|::|<|{") ||
Token::Match(tok2, "const| &|&&| ;|{") ||
Token::Match(tok2, "const| override ;|{") ||
Token::Match(tok2, "= delete|default ;") ||
Token::Match(tok2, "const| noexcept {|:|;|=") ||
(Token::Match(tok2, "const| noexcept|throw (") &&

View File

@ -236,6 +236,7 @@ private:
TEST_CASE(symboldatabase51); // #6538
TEST_CASE(symboldatabase52); // #6581
TEST_CASE(symboldatabase53); // #7124 (library podtype)
TEST_CASE(symboldatabase54); // #7257
TEST_CASE(isImplicitlyVirtual);
TEST_CASE(isPure);
@ -2207,6 +2208,20 @@ private:
}
}
void symboldatabase54() { // #7343
GET_SYMBOL_DB("class A {\n"
" void getReg() const override {\n"
" assert(Kind == k_ShiftExtend);\n"
" }\n"
"};");
ASSERT(db != nullptr);
if (db) {
ASSERT_EQUALS(1U, db->functionScopes.size());
ASSERT_EQUALS("getReg", db->functionScopes.front()->className);
}
}
void isImplicitlyVirtual() {
{
GET_SYMBOL_DB("class Base {\n"