Skip to content

Commit

Permalink
Update symboldatabase.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github committed Jul 23, 2024
1 parent 81e7614 commit 10e9f1c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/symboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2497,6 +2497,13 @@ static bool isOperator(const Token *tokenDef)
return name.size() > 8 && startsWith(name,"operator") && std::strchr("+-*/%&|~^<>!=[(", name[8]);
}

static bool isTrailingReturnType(const Token* tok)
{
while (tok && tok->isKeyword())
tok = tok->next();
return Token::Match(tok, "&|&&| .");
}

Function::Function(const Token *tok,
const Scope *scope,
const Token *tokDef,
Expand Down Expand Up @@ -2540,7 +2547,7 @@ Function::Function(const Token *tok,
if (!isConstructor() && !isDestructor()) {
// @todo auto type deduction should be checked
// @todo attributes and exception specification can also precede trailing return type
if (Token::Match(argDef->link()->next(), "const|volatile| &|&&| .")) { // Trailing return type
if (isTrailingReturnType(argDef->link()->next())) { // Trailing return type
hasTrailingReturnType(true);
if (argDef->link()->strAt(1) == ".")
retDef = argDef->link()->tokAt(2);
Expand Down

0 comments on commit 10e9f1c

Please sign in to comment.