C++: Fix Find Usages false positive results for function arguments

Code snippet:
void bar();         // call find usages for bar from here
void foo(int bar);  // bar from here should not be in results

Add test for member function false positives, that is part of
QTCREATORBUG-2176. That was already fixed before.

Fixes: QTCREATORBUG-2176
Change-Id: I9a079caa83bbaea1edb7ba6aeb151d4d4c77952f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Volodymyr Zibarov
2020-06-15 10:52:29 +03:00
parent 48be20cf48
commit 9be4a5f839
2 changed files with 115 additions and 1 deletions

View File

@@ -2170,6 +2170,7 @@ bool FindUsages::visit(NestedDeclaratorAST *ast)
bool FindUsages::visit(FunctionDeclaratorAST *ast)
{
// unsigned lparen_token = ast->lparen_token;
Scope *previousScope = switchScope(ast->symbol);
this->parameterDeclarationClause(ast->parameter_declaration_clause);
// unsigned rparen_token = ast->rparen_token;
for (SpecifierListAST *it = ast->cv_qualifier_list; it; it = it->next) {
@@ -2178,7 +2179,7 @@ bool FindUsages::visit(FunctionDeclaratorAST *ast)
this->exceptionSpecification(ast->exception_specification);
this->trailingReturnType(ast->trailing_return_type);
this->expression(ast->as_cpp_initializer);
// Function *symbol = ast->symbol;
(void) switchScope(previousScope);
return false;
}