forked from qt-creator/qt-creator
ClangCodeModel: Do not highlight argument of operator*
... as output parameter with clangd. Task-number: QTCREATORBUG-27111 Change-Id: I5def562dcb9b8b0dac036fd46ed7e996c0297c95 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:
@@ -2711,7 +2711,8 @@ static void semanticHighlighter(QFutureInterface<HighlightingResult> &future,
|
||||
if (detail.startsWith("operator")) {
|
||||
return !detail.contains('=')
|
||||
&& !detail.contains("++") && !detail.contains("--")
|
||||
&& !detail.contains("<<") && !detail.contains(">>");
|
||||
&& !detail.contains("<<") && !detail.contains(">>")
|
||||
&& !detail.contains("*");
|
||||
}
|
||||
firstChildTree << n.children().value_or(QList<AstNode>());
|
||||
}
|
||||
|
@@ -1308,6 +1308,8 @@ void ClangdTestHighlighting::test_data()
|
||||
<< QList<int>{C_PREPROCESSOR} << 0;
|
||||
QTest::newRow("built-in define 3") << 952 << 21 << 952 << 40
|
||||
<< QList<int>{C_PREPROCESSOR} << 0;
|
||||
QTest::newRow("deref operator (object)") << 960 << 10 << 960 << 11 << QList<int>{C_LOCAL} << 0;
|
||||
QTest::newRow("deref operator (member)") << 960 << 12 << 960 << 13 << QList<int>{C_FIELD} << 0;
|
||||
}
|
||||
|
||||
void ClangdTestHighlighting::test()
|
||||
|
@@ -951,3 +951,12 @@ void builtinDefines()
|
||||
const auto f2 = __FUNCTION__;
|
||||
const auto f3 = __PRETTY_FUNCTION__;
|
||||
}
|
||||
|
||||
void derefOperator()
|
||||
{
|
||||
struct S { bool operator*(); };
|
||||
struct S2 { S s; };
|
||||
S2 s;
|
||||
if (*s.s)
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user