CPlusPlus: Consider member initializations

... when checking usage types.

Change-Id: Ic875f3bcae9cf045dbb062670e8cf941de533404
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2020-09-11 16:18:51 +02:00
parent d4c7dee48a
commit f244a7ea4c
2 changed files with 32 additions and 13 deletions

View File

@@ -341,6 +341,11 @@ Usage::Type FindUsages::getType(int line, int column, int tokenIndex)
return Usage::Type::Declaration;
continue;
}
if (const auto memInitAst = (*it)->asMemInitializer()) {
if (memInitAst->name == *(it - 1))
return Usage::Type::Write;
return Usage::Type::Read;
}
if ((*it)->asCall())
return checkPotentialWrite(getUsageTypeForCall(it), it + 1);
if (const auto binExpr = (*it)->asBinaryExpression()) {