From 10e693a8c3fae53e7629f4468e3657cc4fff73fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 26 Jun 2018 23:14:12 +0200 Subject: [PATCH] Revert "SymbolDatabase: Improved lookup of function calls" This reverts commit 3c87d60d5db1bcb10a0079c2acc5d5899ce226d6. --- lib/symboldatabase.cpp | 11 ----------- test/testsymboldatabase.cpp | 25 ------------------------- 2 files changed, 36 deletions(-) diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 564cfcdd0..24e242ac5 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -4021,17 +4021,6 @@ const Function* Scope::findFunction(const Token *tok, bool requireConst) const } } - // using namespace.. - for (const Scope *scope = this; scope; scope = scope->nestedIn) { - for (const UsingInfo &usingInfo : scope->usingList) { - if (!usingInfo.scope) - continue; - const Function *func = usingInfo.scope->findFunction(tok,requireConst); - if (func) - matches.push_back(func); - } - } - // check in base classes findFunctionInBase(tok->str(), args, matches); diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index 38d7eb092..0dafd2730 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -325,7 +325,6 @@ private: TEST_CASE(findFunction18); TEST_CASE(findFunction19); TEST_CASE(findFunction20); // #8280 - TEST_CASE(findFunction21); // #8592 - using namespace TEST_CASE(noexceptFunction1); TEST_CASE(noexceptFunction2); @@ -5159,30 +5158,6 @@ private: ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 12); } - void findFunction21() { // using namespace .. - { - GET_SYMBOL_DB("namespace NS { void f(); };\n" - "void foo() {\n" - " using namespace NS;\n" - " f();\n" - "}"); - const Scope *foo = db->findScopeByName("foo"); - const Token *ftok = Token::findsimplematch(foo->bodyStart, "f ("); - ASSERT(foo->findFunction(ftok,false)); - } - - { - GET_SYMBOL_DB("namespace NS { void f(); };\n" - "void foo() {\n" - " using namespace NS;\n" - " if (abc) { f(); }\n" - "}"); - const Scope *foo = db->findScopeByName("foo"); - const Token *ftok = Token::findsimplematch(foo->bodyStart, "f ("); - ASSERT(foo->findFunction(ftok,false)); - } - } - #define FUNC(x) const Function *x = findFunctionByName(#x, &db->scopeList.front()); \ ASSERT_EQUALS(true, x != nullptr); \ if (x) ASSERT_EQUALS(true, x->isNoExcept());