* Fix #10174 debug: Executable scope 'x' with unknown function * Format
This commit is contained in:
parent
aae810dd2c
commit
b79885c6af
|
@ -2692,6 +2692,7 @@ bool Function::argsMatch(const Scope *scope, const Token *first, const Token *se
|
||||||
(Token::Match(second->next(), "%name% <") &&
|
(Token::Match(second->next(), "%name% <") &&
|
||||||
Token::Match(second->linkAt(1), "> :: %name%"))) &&
|
Token::Match(second->linkAt(1), "> :: %name%"))) &&
|
||||||
((second->next()->str() == scope->className) ||
|
((second->next()->str() == scope->className) ||
|
||||||
|
(scope->nestedIn && second->next()->str() == scope->nestedIn->className) ||
|
||||||
(scope->definedType && scope->definedType->isDerivedFrom(second->next()->str()))) &&
|
(scope->definedType && scope->definedType->isDerivedFrom(second->next()->str()))) &&
|
||||||
(first->next()->str() == second->strAt(3))) {
|
(first->next()->str() == second->strAt(3))) {
|
||||||
if (Token::Match(second->next(), "%name% <"))
|
if (Token::Match(second->next(), "%name% <"))
|
||||||
|
|
|
@ -357,6 +357,7 @@ private:
|
||||||
TEST_CASE(symboldatabase96); // #10126
|
TEST_CASE(symboldatabase96); // #10126
|
||||||
TEST_CASE(symboldatabase97); // #10598 - final class
|
TEST_CASE(symboldatabase97); // #10598 - final class
|
||||||
TEST_CASE(symboldatabase98); // #10451
|
TEST_CASE(symboldatabase98); // #10451
|
||||||
|
TEST_CASE(symboldatabase100); // #10174
|
||||||
|
|
||||||
TEST_CASE(createSymbolDatabaseFindAllScopes1);
|
TEST_CASE(createSymbolDatabaseFindAllScopes1);
|
||||||
TEST_CASE(createSymbolDatabaseFindAllScopes2);
|
TEST_CASE(createSymbolDatabaseFindAllScopes2);
|
||||||
|
@ -4879,6 +4880,23 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void symboldatabase100() { // #10174
|
||||||
|
GET_SYMBOL_DB("namespace N {\n"
|
||||||
|
" struct S {};\n"
|
||||||
|
" struct T { void f(S s); };\n"
|
||||||
|
" void T::f(N::S s) {}\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT(db);
|
||||||
|
ASSERT_EQUALS(1, db->functionScopes.size());
|
||||||
|
auto it = std::find_if(db->scopeList.begin(), db->scopeList.end(), [](const Scope& s) {
|
||||||
|
return s.className == "T";
|
||||||
|
});
|
||||||
|
ASSERT(it != db->scopeList.end());
|
||||||
|
const Function* function = findFunctionByName("f", &*it);
|
||||||
|
ASSERT(function && function->token->str() == "f");
|
||||||
|
ASSERT(function->hasBody());
|
||||||
|
}
|
||||||
|
|
||||||
void createSymbolDatabaseFindAllScopes1() {
|
void createSymbolDatabaseFindAllScopes1() {
|
||||||
GET_SYMBOL_DB("void f() { union {int x; char *p;} a={0}; }");
|
GET_SYMBOL_DB("void f() { union {int x; char *p;} a={0}; }");
|
||||||
ASSERT(db->scopeList.size() == 3);
|
ASSERT(db->scopeList.size() == 3);
|
||||||
|
|
Loading…
Reference in New Issue