forked from qt-creator/qt-creator
ClangCodeModel: Fix more false output arguments with clangd
For some reason, we never checked the actual matching AST node for const-ness. Change-Id: Icb58ba169d82e1ec02c9ff8d17f0170f0a78f99d Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -2675,6 +2675,8 @@ static void semanticHighlighter(QFutureInterface<HighlightingResult> &future,
|
|||||||
|| path.rbegin()->kind() == "CXXConstruct")) {
|
|| path.rbegin()->kind() == "CXXConstruct")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (path.rbegin()->hasConstType())
|
||||||
|
return false;
|
||||||
for (auto it = path.rbegin() + 1; it != path.rend(); ++it) {
|
for (auto it = path.rbegin() + 1; it != path.rend(); ++it) {
|
||||||
if (it->kind() == "Call" || it->kind() == "CXXConstruct"
|
if (it->kind() == "Call" || it->kind() == "CXXConstruct"
|
||||||
|| it->kind() == "MemberInitializer") {
|
|| it->kind() == "MemberInitializer") {
|
||||||
|
|||||||
@@ -1298,6 +1298,10 @@ void ClangdTestHighlighting::test_data()
|
|||||||
QTest::newRow("operator<<") << 934 << 10 << 934 << 14 << QList<int>{C_GLOBAL} << 0;
|
QTest::newRow("operator<<") << 934 << 10 << 934 << 14 << QList<int>{C_GLOBAL} << 0;
|
||||||
QTest::newRow("operator>>") << 936 << 10 << 936 << 13 << QList<int>{C_GLOBAL} << 0;
|
QTest::newRow("operator>>") << 936 << 10 << 936 << 13 << QList<int>{C_GLOBAL} << 0;
|
||||||
QTest::newRow("operator>>") << 936 << 17 << 936 << 18 << QList<int>{C_LOCAL} << 0;
|
QTest::newRow("operator>>") << 936 << 17 << 936 << 18 << QList<int>{C_LOCAL} << 0;
|
||||||
|
QTest::newRow("input arg from passed object") << 945 << 17 << 945 << 18
|
||||||
|
<< QList<int>{C_FIELD} << 0;
|
||||||
|
QTest::newRow("output arg") << 945 << 20 << 945 << 23
|
||||||
|
<< QList<int>{C_LOCAL, C_OUTPUT_ARGUMENT} << 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangdTestHighlighting::test()
|
void ClangdTestHighlighting::test()
|
||||||
|
|||||||
@@ -935,3 +935,12 @@ void outputOperator()
|
|||||||
int i;
|
int i;
|
||||||
std::cin >> i;
|
std::cin >> i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename To, typename From, typename Op>
|
||||||
|
void transform(const From &from, To &&to, Op op) {}
|
||||||
|
struct WithVector { std::vector<int> v; };
|
||||||
|
void inputsAndOutputsFromObject(const WithVector &s)
|
||||||
|
{
|
||||||
|
std::vector<int> out;
|
||||||
|
transform(s.v, out, [] {});
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user