Fixed #9055 (SymbolDatabase: second argument is missing in the symbol database)

This commit is contained in:
Daniel Marjamäki 2019-03-30 07:44:36 +01:00
parent d88ee2d6a2
commit fe285f1df3
2 changed files with 14 additions and 1 deletions

View File

@ -3034,7 +3034,11 @@ void Function::addArguments(const SymbolDatabase *symbolDatabase, const Scope *s
const Token* nameTok = nullptr;
do {
if (tok->varId() != 0) {
if (tok != startTok && !nameTok && Token::Match(tok, "( & %var% ) [")) {
nameTok = tok->tokAt(2);
endTok = nameTok->previous();
tok = tok->link();
} else if (tok->varId() != 0) {
nameTok = tok;
endTok = tok->previous();
} else if (tok->str() == "[") {

View File

@ -215,6 +215,7 @@ private:
TEST_CASE(functionArgs11);
TEST_CASE(functionArgs12); // #7661
TEST_CASE(functionArgs13); // #7697
TEST_CASE(functionArgs14); // #9055
TEST_CASE(functionImplicitlyVirtual);
@ -2219,6 +2220,14 @@ private:
}
}
void functionArgs14() { // #7697
GET_SYMBOL_DB("void f(int (&a)[10], int (&b)[10]);");
(void)db;
const Function *func = tokenizer.tokens()->next()->function();
ASSERT_EQUALS(true, func != nullptr);
ASSERT_EQUALS(2, func ? func->argCount() : 0);
}
void functionImplicitlyVirtual() {
GET_SYMBOL_DB("class base { virtual void f(); };\n"
"class derived : base { void f(); };\n"