fix daca error: Internal Error: Invalid syntax (#2452)
* fix daca error: Internal Error: Invalid syntax * fix cppcheck warnings
This commit is contained in:
parent
3fdf1b806a
commit
ec4c979cd8
|
@ -2411,7 +2411,9 @@ void SymbolDatabase::addClassFunction(Scope **scope, const Token **tok, const To
|
|||
if (!func->hasBody()) {
|
||||
const Token *closeParen = (*tok)->next()->link();
|
||||
if (closeParen) {
|
||||
if (Token::Match(closeParen, ") noexcept| = default ;")) {
|
||||
if (Token::Match(closeParen, ") noexcept| = default ;") ||
|
||||
(Token::simpleMatch(closeParen, ") noexcept (") &&
|
||||
Token::simpleMatch(closeParen->linkAt(2), ") = default ;"))) {
|
||||
func->isDefault(true);
|
||||
return;
|
||||
}
|
||||
|
@ -2483,7 +2485,9 @@ void SymbolDatabase::addClassFunction(Scope **scope, const Token **tok, const To
|
|||
// normal function?
|
||||
const Token *closeParen = (*tok)->next()->link();
|
||||
if (closeParen) {
|
||||
if (Token::Match(closeParen, ") noexcept| = default ;")) {
|
||||
if (Token::Match(closeParen, ") noexcept| = default ;") ||
|
||||
(Token::simpleMatch(closeParen, ") noexcept (") &&
|
||||
Token::simpleMatch(closeParen->linkAt(2), ") = default ;"))) {
|
||||
func->isDefault(true);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -308,6 +308,7 @@ private:
|
|||
TEST_CASE(symboldatabase81); // #9411
|
||||
TEST_CASE(symboldatabase82);
|
||||
TEST_CASE(symboldatabase83); // #9431
|
||||
TEST_CASE(symboldatabase84);
|
||||
|
||||
TEST_CASE(createSymbolDatabaseFindAllScopes1);
|
||||
|
||||
|
@ -4442,6 +4443,41 @@ private:
|
|||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void symboldatabase84() {
|
||||
{
|
||||
const bool old = settings1.debugwarnings;
|
||||
settings1.debugwarnings = true;
|
||||
GET_SYMBOL_DB("struct a { a() noexcept(false); };\n"
|
||||
"a::a() noexcept(false) = default;");
|
||||
settings1.debugwarnings = old;
|
||||
const Scope *scope = db->findScopeByName("a");
|
||||
ASSERT(scope);
|
||||
ASSERT(scope->functionList.size() == 1);
|
||||
ASSERT(scope->functionList.front().name() == "a");
|
||||
ASSERT(scope->functionList.front().hasBody() == false);
|
||||
ASSERT(scope->functionList.front().isConstructor() == true);
|
||||
ASSERT(scope->functionList.front().isDefault() == true);
|
||||
ASSERT(scope->functionList.front().isNoExcept() == false);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
{
|
||||
const bool old = settings1.debugwarnings;
|
||||
settings1.debugwarnings = true;
|
||||
GET_SYMBOL_DB("struct a { a() noexcept(true); };\n"
|
||||
"a::a() noexcept(true) = default;");
|
||||
settings1.debugwarnings = old;
|
||||
const Scope *scope = db->findScopeByName("a");
|
||||
ASSERT(scope);
|
||||
ASSERT(scope->functionList.size() == 1);
|
||||
ASSERT(scope->functionList.front().name() == "a");
|
||||
ASSERT(scope->functionList.front().hasBody() == false);
|
||||
ASSERT(scope->functionList.front().isConstructor() == true);
|
||||
ASSERT(scope->functionList.front().isDefault() == true);
|
||||
ASSERT(scope->functionList.front().isNoExcept() == true);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
}
|
||||
|
||||
void createSymbolDatabaseFindAllScopes1() {
|
||||
GET_SYMBOL_DB("void f() { union {int x; char *p;} a={0}; }");
|
||||
ASSERT(db->scopeList.size() == 3);
|
||||
|
|
Loading…
Reference in New Issue