Fix #11385 debug: SymbolDatabase::findFunction found '>' without link. (#4583)

This commit is contained in:
chrchr-github 2022-11-14 21:08:15 +01:00 committed by GitHub
parent 436c5c8efc
commit 4ce76d0b58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View File

@ -5455,11 +5455,8 @@ const Function* SymbolDatabase::findFunction(const Token *tok) const
if (tok1->strAt(-2) == ">") { if (tok1->strAt(-2) == ">") {
if (tok1->linkAt(-2)) if (tok1->linkAt(-2))
tok1 = tok1->linkAt(-2)->tokAt(-1); tok1 = tok1->linkAt(-2)->tokAt(-1);
else { else
if (mSettings->debugwarnings) break;
debugMessage(tok1->tokAt(-2), "debug", "SymbolDatabase::findFunction found '>' without link.");
return nullptr;
}
} else } else
tok1 = tok1->tokAt(-2); tok1 = tok1->tokAt(-2);
} }

View File

@ -4380,7 +4380,13 @@ private:
void symboldatabase65() { void symboldatabase65() {
// don't crash on missing links from instantiation of template with typedef // don't crash on missing links from instantiation of template with typedef
check("int ( * X0 ) ( long ) < int ( ) ( long ) > :: f0 ( int * ) { return 0 ; }"); check("int ( * X0 ) ( long ) < int ( ) ( long ) > :: f0 ( int * ) { return 0 ; }");
ASSERT_EQUALS("[test.cpp:1]: (debug) SymbolDatabase::findFunction found '>' without link.\n", errout.str()); ASSERT_EQUALS("", errout.str());
check("int g();\n" // #11385
"void f(int i) {\n"
" if (i > ::g()) {}\n"
"}\n");
ASSERT_EQUALS("", errout.str());
} }
void symboldatabase66() { // #8540 void symboldatabase66() { // #8540