forked from qt-creator/qt-creator
ClangCodeModel: Tighten the check for qualified member function call
Just checking for the base cast is not enough. Change-Id: I455533b7da31cf5c52d8c1b9dd93b3bb2fb58929 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -156,11 +156,15 @@ public:
|
||||
{
|
||||
if (!isMemberFunctionCall())
|
||||
return false;
|
||||
const Utils::optional<QList<AstNode>> childList = children();
|
||||
if (!childList)
|
||||
return true;
|
||||
for (const AstNode &c : qAsConst(*childList)) {
|
||||
if (c.detailIs("UncheckedDerivedToBase"))
|
||||
bool hasBaseCast = false;
|
||||
bool hasRecordType = false;
|
||||
const QList<AstNode> childList = children().value_or(QList<AstNode>());
|
||||
for (const AstNode &c : childList) {
|
||||
if (!hasBaseCast && c.detailIs("UncheckedDerivedToBase"))
|
||||
hasBaseCast = true;
|
||||
if (!hasRecordType && c.role() == "specifier" && c.kind() == "TypeSpec")
|
||||
hasRecordType = true;
|
||||
if (hasBaseCast && hasRecordType)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -446,9 +446,6 @@ F2TestCase::F2TestCase(CppEditorAction action,
|
||||
});
|
||||
t.start(10000);
|
||||
l.exec();
|
||||
QEXPECT_FAIL("noSiblings_references", "FIXME: check why this fails", Abort);
|
||||
QEXPECT_FAIL("noSiblings_pointers", "FIXME: check why this fails", Abort);
|
||||
QEXPECT_FAIL("noSiblings_noBaseExpression", "FIXME: check why this fails", Abort);
|
||||
QVERIFY(immediateProposal);
|
||||
QVERIFY(finalProposal);
|
||||
immediateVirtualSymbolResults = VirtualFunctionTestAssistProvider::itemList(
|
||||
@@ -507,8 +504,12 @@ F2TestCase::F2TestCase(CppEditorAction action,
|
||||
expectedImmediate << OverrideItem(QLatin1String("collecting overrides ..."));
|
||||
}
|
||||
QCOMPARE(immediateVirtualSymbolResults, expectedImmediate);
|
||||
if (useClangd)
|
||||
QEXPECT_FAIL("allOverrides from base declaration", "FIXME: check why this fails", Abort);
|
||||
if (useClangd) {
|
||||
QEXPECT_FAIL("allOverrides from base declaration", "FIXME: too many results", Abort);
|
||||
QEXPECT_FAIL("noSiblings_references", "FIXME: too many results", Abort);
|
||||
QEXPECT_FAIL("noSiblings_pointers", "FIXME: too many results", Abort);
|
||||
QEXPECT_FAIL("noSiblings_noBaseExpression", "FIXME: too many results", Abort);
|
||||
}
|
||||
QCOMPARE(finalVirtualSymbolResults.size(), expectedVirtualFunctionProposal.size());
|
||||
QCOMPARE(finalVirtualSymbolResults, expectedVirtualFunctionProposal);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user