Fixed hang on garbage code (#4193)
This commit is contained in:
parent
3e58472cd3
commit
929f16d892
|
@ -1630,7 +1630,7 @@ void Function::addArguments(const SymbolDatabase *symbolDatabase, const Scope *s
|
|||
// skip default values
|
||||
if (tok->str() == "=") {
|
||||
while (tok->str() != "," && tok->str() != ")") {
|
||||
if (tok->link())
|
||||
if (tok->link() && Token::Match(tok, "[{[(<]"))
|
||||
tok = tok->link();
|
||||
tok = tok->next();
|
||||
}
|
||||
|
|
|
@ -154,6 +154,8 @@ private:
|
|||
TEST_CASE(symboldatabase28);
|
||||
|
||||
TEST_CASE(isImplicitlyVirtual);
|
||||
|
||||
TEST_CASE(garbage);
|
||||
}
|
||||
|
||||
void array() {
|
||||
|
@ -1380,6 +1382,11 @@ private:
|
|||
ASSERT(db && db->findScopeByName("Deri") && db->findScopeByName("Deri")->functionList.front().isImplicitlyVirtual(false)); // Default false, but we saw "virtual" -> true
|
||||
}
|
||||
}
|
||||
|
||||
void garbage() {
|
||||
GET_SYMBOL_DB("void f( { u = 1 ; } ) { }");
|
||||
(void)db;
|
||||
}
|
||||
};
|
||||
|
||||
REGISTER_TEST(TestSymbolDatabase)
|
||||
|
|
Loading…
Reference in New Issue