ClangCodeModel: Fix local renamings with clangd

This functionality somehow stayed in the proof-of-concept
stage, working only for free functions.

Fixes: QTCREATORBUG-27249
Change-Id: I840beae66314330ce643e159c596e702a0ec3273
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2022-03-30 17:31:26 +02:00
parent bd8537fc77
commit a1b910724d
2 changed files with 6 additions and 3 deletions

View File

@@ -1989,7 +1989,10 @@ void ClangdClient::findLocalUsages(TextDocument *document, const QTextCursor &cu
const QList<AstNode> astPath = getAstPath(ast, linkPos);
bool isVar = false;
for (auto it = astPath.rbegin(); it != astPath.rend(); ++it) {
if (it->role() == "declaration" && it->kind() == "Function") {
if (it->role() == "declaration"
&& (it->kind() == "Function" || it->kind() == "CXXMethod"
|| it->kind() == "CXXConstructor" || it->kind() == "CXXDestructor"
|| it->kind() == "Lambda")) {
if (!isVar)
break;