SymbolDatabase: Fixed addArguments
This commit is contained in:
parent
1008868506
commit
f093d23a36
|
@ -3552,6 +3552,9 @@ void Function::addArguments(const SymbolDatabase *symbolDatabase, const Scope *s
|
||||||
while (Token::Match(startTok, "enum|struct|const|volatile"))
|
while (Token::Match(startTok, "enum|struct|const|volatile"))
|
||||||
startTok = startTok->next();
|
startTok = startTok->next();
|
||||||
|
|
||||||
|
if (startTok == nameTok)
|
||||||
|
break;
|
||||||
|
|
||||||
argumentList.emplace_back(nameTok, startTok, endTok, count++, AccessControl::Argument, argType, functionScope, symbolDatabase->mSettings);
|
argumentList.emplace_back(nameTok, startTok, endTok, count++, AccessControl::Argument, argType, functionScope, symbolDatabase->mSettings);
|
||||||
|
|
||||||
if (tok->str() == ")") {
|
if (tok->str() == ")") {
|
||||||
|
|
|
@ -313,6 +313,7 @@ private:
|
||||||
TEST_CASE(symboldatabase82);
|
TEST_CASE(symboldatabase82);
|
||||||
TEST_CASE(symboldatabase83); // #9431
|
TEST_CASE(symboldatabase83); // #9431
|
||||||
TEST_CASE(symboldatabase84);
|
TEST_CASE(symboldatabase84);
|
||||||
|
TEST_CASE(symboldatabase85);
|
||||||
|
|
||||||
TEST_CASE(createSymbolDatabaseFindAllScopes1);
|
TEST_CASE(createSymbolDatabaseFindAllScopes1);
|
||||||
|
|
||||||
|
@ -4550,6 +4551,22 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void symboldatabase85() {
|
||||||
|
GET_SYMBOL_DB("class Fred {\n"
|
||||||
|
" enum Mode { Mode1, Mode2, Mode3 };\n"
|
||||||
|
" void f() { _mode = x; }\n"
|
||||||
|
" Mode _mode;\n"
|
||||||
|
" DECLARE_PROPERTY_FIELD(_mode);\n"
|
||||||
|
"};");
|
||||||
|
const Token *vartok1 = Token::findsimplematch(tokenizer.tokens(), "_mode =");
|
||||||
|
ASSERT(vartok1);
|
||||||
|
ASSERT(vartok1->variable());
|
||||||
|
ASSERT(vartok1->variable()->scope());
|
||||||
|
|
||||||
|
const Token *vartok2 = Token::findsimplematch(tokenizer.tokens(), "( _mode ) ;")->next();
|
||||||
|
ASSERT_EQUALS(std::intptr_t(vartok1->variable()), std::intptr_t(vartok2->variable()));
|
||||||
|
}
|
||||||
|
|
||||||
void createSymbolDatabaseFindAllScopes1() {
|
void createSymbolDatabaseFindAllScopes1() {
|
||||||
GET_SYMBOL_DB("void f() { union {int x; char *p;} a={0}; }");
|
GET_SYMBOL_DB("void f() { union {int x; char *p;} a={0}; }");
|
||||||
ASSERT(db->scopeList.size() == 3);
|
ASSERT(db->scopeList.size() == 3);
|
||||||
|
|
Loading…
Reference in New Issue