SymbolDatabase: Fixed parsing of unnamed arguments, properly detect pointers (#8052)
This commit is contained in:
parent
28b8bc57a8
commit
68d77b73da
|
@ -1725,7 +1725,10 @@ void Variable::evaluate(const Library* lib)
|
||||||
const Token* tok = _start;
|
const Token* tok = _start;
|
||||||
while (tok && tok->previous() && tok->previous()->isName())
|
while (tok && tok->previous() && tok->previous()->isName())
|
||||||
tok = tok->previous();
|
tok = tok->previous();
|
||||||
for (const Token* const end = _name?_name:_end; tok != end;) {
|
const Token* end = _end;
|
||||||
|
if (end)
|
||||||
|
end = end->next();
|
||||||
|
while (tok != end) {
|
||||||
if (tok->str() == "static")
|
if (tok->str() == "static")
|
||||||
setFlag(fIsStatic, true);
|
setFlag(fIsStatic, true);
|
||||||
else if (tok->str() == "extern")
|
else if (tok->str() == "extern")
|
||||||
|
|
|
@ -1615,6 +1615,12 @@ private:
|
||||||
ASSERT(g && g->type == Scope::eFunction && g->function && g->function->argumentList.size() == 1 && g->function->argumentList.front().hasDefault());
|
ASSERT(g && g->type == Scope::eFunction && g->function && g->function->argumentList.size() == 1 && g->function->argumentList.front().hasDefault());
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
GET_SYMBOL_DB("void g(int*) { }"); // unnamed pointer argument (#8052)
|
||||||
|
const Scope* g = db->findScopeByName("g");
|
||||||
|
ASSERT(g && g->type == Scope::eFunction && g->function && g->function->argumentList.size() == 1 && g->function->argumentList.front().nameToken() == nullptr && g->function->argumentList.front().isPointer());
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
}
|
||||||
{
|
{
|
||||||
GET_SYMBOL_DB("void g(int* const) { }"); // 'const' is not the name of the variable - #5882
|
GET_SYMBOL_DB("void g(int* const) { }"); // 'const' is not the name of the variable - #5882
|
||||||
const Scope* g = db->findScopeByName("g");
|
const Scope* g = db->findScopeByName("g");
|
||||||
|
|
Loading…
Reference in New Issue