forked from qt-creator/qt-creator
ClangCodeModel: Fix another false positive
... in output argument highlighting. If there is not enough information for clang to determine the const-ness of the argument passing (as it can happen in templates), do not report an output argument. Change-Id: I8d0143042f02ac44d8d971398014828cff14697f 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:
@@ -2712,8 +2712,12 @@ static void semanticHighlighter(QFutureInterface<HighlightingResult> &future,
|
||||
if (it->kind() == "Call") {
|
||||
// The first child is e.g. a called lambda or an object on which
|
||||
// the call happens, and should not be highlighted as an output argument.
|
||||
// If the call is not fully resolved (as in templates), we don't
|
||||
// know whether the argument is passed as const or not.
|
||||
const QList<AstNode> children = it->children().value_or(QList<AstNode>());
|
||||
return children.isEmpty() || children.first().range() != (it - 1)->range();
|
||||
return children.isEmpty()
|
||||
|| (children.first().range() != (it - 1)->range()
|
||||
&& children.first().kind() != "UnresolvedLookup");
|
||||
}
|
||||
|
||||
// The token should get marked for e.g. lambdas, but not for assignment operators,
|
||||
|
||||
Reference in New Issue
Block a user