forked from qt-creator/qt-creator
CPlusPlus: Fix "find usages" categorization for sizeof and array access
Task-number: QTCREATORBUG-24894 Change-Id: I65fa097785b19e181f15178ad6d30608899316c0 Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
@@ -342,12 +342,12 @@ Usage::Type FindUsages::getType(int line, int column, int tokenIndex)
|
||||
return Usage::Type::Read;
|
||||
if ((*it)->asIfStatement())
|
||||
return Usage::Type::Read;
|
||||
if ((*it)->asLambdaCapture() || (*it)->asNamedTypeSpecifier()
|
||||
|| (*it)->asElaboratedTypeSpecifier()) {
|
||||
if ((*it)->asLambdaCapture())
|
||||
return Usage::Type::Other;
|
||||
}
|
||||
if ((*it)->asTypenameTypeParameter())
|
||||
return Usage::Type::Declaration;
|
||||
if ((*it)->asNewExpression())
|
||||
return Usage::Type::Other;
|
||||
if (ClassSpecifierAST *classSpec = (*it)->asClassSpecifier()) {
|
||||
if (classSpec->name == *(it - 1))
|
||||
return Usage::Type::Declaration;
|
||||
@@ -381,6 +381,16 @@ Usage::Type FindUsages::getType(int line, int column, int tokenIndex)
|
||||
return Usage::Type::Read;
|
||||
}
|
||||
}
|
||||
if (const auto sizeofExpr = (*it)->asSizeofExpression()) {
|
||||
if (containsToken(sizeofExpr->expression))
|
||||
return Usage::Type::Read;
|
||||
return Usage::Type::Other;
|
||||
}
|
||||
if (const auto arrayExpr = (*it)->asArrayAccess()) {
|
||||
if (containsToken(arrayExpr->expression))
|
||||
return Usage::Type::Read;
|
||||
continue;
|
||||
}
|
||||
if (const auto postIncrDecrOp = (*it)->asPostIncrDecr())
|
||||
return checkPotentialWrite(Usage::Type::Write, it + 1);
|
||||
if (const auto declaratorId = (*it)->asDeclaratorId()) {
|
||||
|
||||
Reference in New Issue
Block a user