ClangCodeModel: Fix erroneous marking of lambda parameter

... as output argument when using clangd.

Change-Id: I35ef2da235cb317bb7eb1f08b865ea62c27d3b76
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2021-11-10 15:35:26 +01:00
parent 9ba2d2758a
commit af647841cf
3 changed files with 10 additions and 0 deletions

View File

@@ -2453,6 +2453,8 @@ static void semanticHighlighter(QFutureInterface<HighlightingResult> &future,
return true;
}
if (it->kind() == "Lambda")
return false;
if (it->kind().endsWith("Cast") && it->hasConstType())
return false;
if (it->kind() == "Member" && it->arcanaContains("(")

View File

@@ -1250,6 +1250,8 @@ void ClangdTestHighlighting::test_data()
<< QList<int>{C_LOCAL} << 0;
QTest::newRow("simple assignment") << 835 << 5 << 835 << 6 << QList<int>{C_LOCAL} << 0;
QTest::newRow("simple return") << 841 << 12 << 841 << 15 << QList<int>{C_LOCAL} << 0;
QTest::newRow("lambda parameter") << 847 << 49 << 847 << 52
<< QList<int>{C_PARAMETER, C_DECLARATION} << 0;
}
void ClangdTestHighlighting::test()

View File

@@ -840,3 +840,9 @@ FooPtrVector returnTest() {
FooPtrVector foo;
return foo;
}
template <typename Container, typename Func> inline void useContainer(const Container &, Func) {}
void testConstRefAutoLambdaArgs()
{
useContainer(FooPtrVector(), [](const auto &arg) {});
}