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:
Christian Kandeler
2021-05-28 16:06:07 +02:00
parent d4c36f43b0
commit 692995ec88
2 changed files with 15 additions and 10 deletions

View File

@@ -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;