forked from qt-creator/qt-creator
ClangCodeModel: Fix an instance of mis-highlighting with clangd
In the expression x.f(), x was wrongly categorized as an output parameter if f was a static function. Change-Id: I9167f98916963cdaa4b5ac6ead2c86fab43ad02e Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -2444,6 +2444,10 @@ static void semanticHighlighter(QFutureInterface<TextEditor::HighlightingResult>
|
|||||||
}
|
}
|
||||||
if (it->kind().endsWith("Cast") && it->hasConstType())
|
if (it->kind().endsWith("Cast") && it->hasConstType())
|
||||||
return false;
|
return false;
|
||||||
|
if (it->kind() == "Member" && it->arcanaContains("(")
|
||||||
|
&& !it->arcanaContains("bound member function type")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
@@ -1231,6 +1231,10 @@ void ClangdTestHighlighting::test_data()
|
|||||||
<< QList<int>{C_PREPROCESSOR, C_DECLARATION} << 0;
|
<< QList<int>{C_PREPROCESSOR, C_DECLARATION} << 0;
|
||||||
QTest::newRow("#ifdef'ed out code") << 800 << 1 << 800 << 17
|
QTest::newRow("#ifdef'ed out code") << 800 << 1 << 800 << 17
|
||||||
<< QList<int>{C_DISABLED_CODE} << 0;
|
<< QList<int>{C_DISABLED_CODE} << 0;
|
||||||
|
QTest::newRow("static function call (object)") << 819 << 5 << 819 << 6
|
||||||
|
<< QList<int>{C_LOCAL} << 0;
|
||||||
|
QTest::newRow("static function call (argument)") << 819 << 18 << 819 << 19
|
||||||
|
<< QList<int>{C_LOCAL, C_OUTPUT_ARGUMENT} << 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangdTestHighlighting::test()
|
void ClangdTestHighlighting::test()
|
||||||
|
@@ -811,3 +811,10 @@ std::vector<int
|
|||||||
>
|
>
|
||||||
>
|
>
|
||||||
vp3;
|
vp3;
|
||||||
|
|
||||||
|
void staticMemberFuncTest() {
|
||||||
|
struct S { static void staticFunc(int &); };
|
||||||
|
S s;
|
||||||
|
int i;
|
||||||
|
s.staticFunc(i);
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user