* Partial fix for #11638 Library::getFunctionName: SIGSEGV * Fix test * simpleMatch()
This commit is contained in:
parent
28ed9d30e0
commit
89ec148199
|
@ -8044,6 +8044,8 @@ void Tokenizer::findGarbageCode() const
|
|||
if (!isCPP() || mSettings->standards.cpp < Standards::CPP20 || !Token::Match(tok->previous(), "%name% : %num% ="))
|
||||
syntaxError(tok, tok->next()->str() + " " + tok->strAt(2));
|
||||
}
|
||||
else if (Token::simpleMatch(tok, ") return") && !Token::Match(tok->link()->previous(), "if|while|for ("))
|
||||
syntaxError(tok);
|
||||
|
||||
if (tok->isControlFlowKeyword() && Token::Match(tok, "if|while|for|switch")) { // if|while|for|switch (EXPR) { ... }
|
||||
if (tok->previous() && !Token::Match(tok->previous(), "%name%|:|;|{|}|)")) {
|
||||
|
|
|
@ -6782,6 +6782,8 @@ private:
|
|||
|
||||
ASSERT_THROW_EQUALS(tokenizeAndStringify("enum : { };"), InternalError, "syntax error: Unexpected token '{'");
|
||||
ASSERT_THROW_EQUALS(tokenizeAndStringify("enum : 3 { };"), InternalError, "syntax error: Unexpected token '3'");
|
||||
|
||||
ASSERT_THROW_EQUALS(tokenizeAndStringify("int a() { b((c)return 0) }"), InternalError, "syntax error");
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue