forked from qt-creator/qt-creator
ClangCodeModel: Fix another mis-highlighting with clangd
Output parameter marking strikes again. Change-Id: Id98e07e87824a9db435d09482235d56c6808d42e Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -2489,8 +2489,10 @@ static void semanticHighlighter(QFutureInterface<HighlightingResult> &future,
|
||||
while (!firstChildTree.isEmpty()) {
|
||||
const AstNode n = firstChildTree.takeFirst();
|
||||
const QString detail = n.detail().value_or(QString());
|
||||
if (detail.startsWith("operator"))
|
||||
return !detail.contains('=');
|
||||
if (detail.startsWith("operator")) {
|
||||
return !detail.contains('=') && !detail.contains("++")
|
||||
&& !detail.contains("--");
|
||||
}
|
||||
firstChildTree << n.children().value_or(QList<AstNode>());
|
||||
}
|
||||
return true;
|
||||
|
@@ -1256,6 +1256,8 @@ void ClangdTestHighlighting::test_data()
|
||||
<< QList<int>{C_STRING} << 0;
|
||||
QTest::newRow("string literal passed to macro from header file") << 854 << 32 << 854 << 38
|
||||
<< QList<int>{C_STRING} << 0;
|
||||
QTest::newRow("user-defined operator call") << 860 << 7 << 860 << 8
|
||||
<< QList<int>{C_LOCAL} << 0;
|
||||
}
|
||||
|
||||
void ClangdTestHighlighting::test()
|
||||
|
@@ -853,3 +853,9 @@ void useString()
|
||||
const char *s = USE_STRING("TEXT");
|
||||
s = USE_STRING_FROM_HEADER("TEXT");
|
||||
}
|
||||
|
||||
void useOperator()
|
||||
{
|
||||
struct S { S& operator++(); } s;
|
||||
++s;
|
||||
}
|
||||
|
Reference in New Issue
Block a user