Throw syntaxError when encounter one in symboldatabase (fixes #5572)

This commit is contained in:
PKEuS 2014-03-27 19:06:13 +01:00
parent efe3f834be
commit a6ca3cf2cf
2 changed files with 8 additions and 13 deletions

View File

@ -147,8 +147,7 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti
// make sure we have valid code
if (!tok2) {
scopeList.pop_back();
break;
_tokenizer->syntaxError(tok);
}
}
@ -157,8 +156,7 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti
// make sure we have valid code
if (!new_scope->classEnd) {
scopeList.pop_back();
break;
_tokenizer->syntaxError(tok);
}
// make the new scope the current scope

View File

@ -1402,16 +1402,12 @@ private:
void symboldatabase14() {
// ticket #2589 - segmentation fault
check("struct B : A\n");
ASSERT_EQUALS("", errout.str());
ASSERT_THROW(check("struct B : A\n"), InternalError);
}
void symboldatabase15() {
// ticket #2591 - segmentation fault
check("struct A :\n");
ASSERT_EQUALS("", errout.str());
ASSERT_THROW(check("struct A :\n"), InternalError);
}
void symboldatabase16() {
@ -1444,9 +1440,7 @@ private:
void symboldatabase20() {
// ticket #3013 - segmentation fault
check("struct x : virtual y\n");
ASSERT_EQUALS("", errout.str());
ASSERT_THROW(check("struct x : virtual y\n"), InternalError);
}
void symboldatabase21() {
@ -1851,6 +1845,9 @@ private:
GET_SYMBOL_DB("{ }; void namespace A::f; { g() { int } }");
(void)db;
}
{
ASSERT_THROW(GET_SYMBOL_DB("class Foo {}; class Bar : public Foo"), InternalError);
}
}
void findFunction1() {