Fixed #6308: Properly associate Function with Scope for destructors in SymbolDatabase
This commit is contained in:
parent
cef324435f
commit
e9bc3b7acf
|
@ -3462,7 +3462,10 @@ Function * SymbolDatabase::findFunctionInScope(const Token *func, const Scope *n
|
||||||
if (!function) {
|
if (!function) {
|
||||||
const Scope * scope = ns->findRecordInNestedList(func->str());
|
const Scope * scope = ns->findRecordInNestedList(func->str());
|
||||||
if (scope && func->strAt(1) == "::") {
|
if (scope && func->strAt(1) == "::") {
|
||||||
function = findFunctionInScope(func->tokAt(2), scope);
|
func = func->tokAt(2);
|
||||||
|
if (func->str() == "~")
|
||||||
|
func = func->next();
|
||||||
|
function = findFunctionInScope(func, scope);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -219,6 +219,7 @@ private:
|
||||||
TEST_CASE(symboldatabase44);
|
TEST_CASE(symboldatabase44);
|
||||||
TEST_CASE(symboldatabase45); // #6125
|
TEST_CASE(symboldatabase45); // #6125
|
||||||
TEST_CASE(symboldatabase46); // #6171 (anonymous namespace)
|
TEST_CASE(symboldatabase46); // #6171 (anonymous namespace)
|
||||||
|
TEST_CASE(symboldatabase47); // #6308
|
||||||
|
|
||||||
TEST_CASE(isImplicitlyVirtual);
|
TEST_CASE(isImplicitlyVirtual);
|
||||||
|
|
||||||
|
@ -1998,6 +1999,19 @@ private:
|
||||||
ASSERT_EQUALS(scope->className, "S");
|
ASSERT_EQUALS(scope->className, "S");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void symboldatabase47() { // #6308 - associate Function and Scope for destructors
|
||||||
|
GET_SYMBOL_DB("namespace NS {\n"
|
||||||
|
" class MyClass {\n"
|
||||||
|
" ~MyClass();\n"
|
||||||
|
" };\n"
|
||||||
|
"}\n"
|
||||||
|
"using namespace NS;\n"
|
||||||
|
"MyClass::~MyClass() {\n"
|
||||||
|
" delete Example;\n"
|
||||||
|
"}");
|
||||||
|
ASSERT(db && !db->functionScopes.empty() && db->functionScopes.front()->function && db->functionScopes.front()->function->functionScope == db->functionScopes.front());
|
||||||
|
}
|
||||||
|
|
||||||
void isImplicitlyVirtual() {
|
void isImplicitlyVirtual() {
|
||||||
{
|
{
|
||||||
GET_SYMBOL_DB("class Base {\n"
|
GET_SYMBOL_DB("class Base {\n"
|
||||||
|
|
Loading…
Reference in New Issue