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()) {
|
while (!firstChildTree.isEmpty()) {
|
||||||
const AstNode n = firstChildTree.takeFirst();
|
const AstNode n = firstChildTree.takeFirst();
|
||||||
const QString detail = n.detail().value_or(QString());
|
const QString detail = n.detail().value_or(QString());
|
||||||
if (detail.startsWith("operator"))
|
if (detail.startsWith("operator")) {
|
||||||
return !detail.contains('=');
|
return !detail.contains('=') && !detail.contains("++")
|
||||||
|
&& !detail.contains("--");
|
||||||
|
}
|
||||||
firstChildTree << n.children().value_or(QList<AstNode>());
|
firstChildTree << n.children().value_or(QList<AstNode>());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@@ -1256,6 +1256,8 @@ void ClangdTestHighlighting::test_data()
|
|||||||
<< QList<int>{C_STRING} << 0;
|
<< QList<int>{C_STRING} << 0;
|
||||||
QTest::newRow("string literal passed to macro from header file") << 854 << 32 << 854 << 38
|
QTest::newRow("string literal passed to macro from header file") << 854 << 32 << 854 << 38
|
||||||
<< QList<int>{C_STRING} << 0;
|
<< QList<int>{C_STRING} << 0;
|
||||||
|
QTest::newRow("user-defined operator call") << 860 << 7 << 860 << 8
|
||||||
|
<< QList<int>{C_LOCAL} << 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangdTestHighlighting::test()
|
void ClangdTestHighlighting::test()
|
||||||
|
@@ -853,3 +853,9 @@ void useString()
|
|||||||
const char *s = USE_STRING("TEXT");
|
const char *s = USE_STRING("TEXT");
|
||||||
s = USE_STRING_FROM_HEADER("TEXT");
|
s = USE_STRING_FROM_HEADER("TEXT");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void useOperator()
|
||||||
|
{
|
||||||
|
struct S { S& operator++(); } s;
|
||||||
|
++s;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user