Throw more syntaxErrors from SymbolDatabase, fixing #5663
This commit is contained in:
parent
25b1f2f541
commit
e39b89efc3
|
@ -665,6 +665,8 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti
|
||||||
// regular function
|
// regular function
|
||||||
else {
|
else {
|
||||||
Function* function = addGlobalFunction(scope, tok, argStart, funcStart);
|
Function* function = addGlobalFunction(scope, tok, argStart, funcStart);
|
||||||
|
if (!function)
|
||||||
|
_tokenizer->syntaxError(tok);
|
||||||
function->retFuncPtr = retFuncPtr;
|
function->retFuncPtr = retFuncPtr;
|
||||||
|
|
||||||
// global functions can't be const but we have tests that are
|
// global functions can't be const but we have tests that are
|
||||||
|
@ -692,10 +694,8 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti
|
||||||
}
|
}
|
||||||
|
|
||||||
// syntax error?
|
// syntax error?
|
||||||
if (!scope) {
|
if (!scope)
|
||||||
scope = old_scope;
|
_tokenizer->syntaxError(tok);
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// function prototype?
|
// function prototype?
|
||||||
else if (scopeBegin->str() == ";") {
|
else if (scopeBegin->str() == ";") {
|
||||||
|
|
|
@ -1938,6 +1938,13 @@ private:
|
||||||
{
|
{
|
||||||
ASSERT_THROW(GET_SYMBOL_DB("class Foo {}; class Bar : public Foo"), InternalError);
|
ASSERT_THROW(GET_SYMBOL_DB("class Foo {}; class Bar : public Foo"), InternalError);
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
ASSERT_THROW(GET_SYMBOL_DB("YY_DECL { switch (yy_act) {\n"
|
||||||
|
" case 65: YY_BREAK\n"
|
||||||
|
" case YY_STATE_EOF(block):\n"
|
||||||
|
" yyterminate(); \n"
|
||||||
|
"} }"), InternalError); // #5663
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void findFunction1() {
|
void findFunction1() {
|
||||||
|
|
Loading…
Reference in New Issue