Fixed #8538 (SymbolDatabase: wrong parsing of noexcept)

This commit is contained in:
Daniel Marjamäki 2018-05-05 08:31:56 +02:00
parent 64b85b474c
commit 4408628107
2 changed files with 13 additions and 3 deletions

View File

@ -1787,9 +1787,8 @@ Function::Function(const Tokenizer *_tokenizer, const Token *tok, const Scope *s
setFlag(fHasFinalSpecifier, true);
else if (tok->str() == "noexcept") {
isNoExcept(!Token::simpleMatch(tok->next(), "( false )"));
tok = tok->next();
if (tok->str() == "(")
tok = tok->link();
if (tok->next()->str() == "(")
tok = tok->linkAt(1);
} else if (Token::simpleMatch(tok, "throw (")) {
isThrow(true);
if (tok->strAt(2) != ")")

View File

@ -284,6 +284,7 @@ private:
TEST_CASE(symboldatabase64);
TEST_CASE(symboldatabase65);
TEST_CASE(symboldatabase66); // #8540
TEST_CASE(symboldatabase67); // #8538
TEST_CASE(enum1);
TEST_CASE(enum2);
@ -2858,6 +2859,7 @@ private:
if (db) {
ASSERT_EQUALS(1U, db->functionScopes.size());
ASSERT_EQUALS("getReg", db->functionScopes.front()->className);
ASSERT_EQUALS(true, db->functionScopes.front()->function->hasOverrideSpecifier());
}
}
@ -3827,6 +3829,15 @@ private:
ASSERT(db && db->typeList.size() == 3);
}
void symboldatabase67() { // #8538
GET_SYMBOL_DB("std::string get_endpoint_url() const noexcept override;");
const Function *f = db ? &db->scopeList.front().functionList.front() : nullptr;
ASSERT(f != nullptr);
ASSERT(f && f->hasOverrideSpecifier());
ASSERT(f && f->isConst());
ASSERT(f && f->isNoExcept());
}
void enum1() {
GET_SYMBOL_DB("enum BOOL { FALSE, TRUE }; enum BOOL b;");