ClangCodeModel: Do not highlight objects in method calls

... as output arguments with clangd.
We might want to do so in the future, but right now it's not intended.

Task-number: QTCREATORBUG-27111
Change-Id: Ie6941f18943a1d6942901c526c62999cba6c1125
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2022-02-28 17:00:27 +01:00
parent c5187da4ab
commit 8247f4f3dd
4 changed files with 40 additions and 0 deletions

View File

@@ -2723,6 +2723,19 @@ static void semanticHighlighter(QFutureInterface<HighlightingResult> &future,
return false;
if (it->hasConstType())
return false;
if (it->kind() == "CXXMemberCall") {
if (it == path.rbegin())
return false;
const QList<AstNode> children = it->children().value_or(QList<AstNode>());
QTC_ASSERT(!children.isEmpty(), return false);
// The called object is never displayed as an output parameter.
// TODO: A good argument can be made to display objects on which a non-const
// operator or function is called as output parameters.
return (it - 1)->range() != children.first().range();
}
if (it->kind() == "Member" && it->arcanaContains("(")
&& !it->arcanaContains("bound member function type")) {
return false;