CPlusPlus: Properly categorize usages in switch and case statements

Change-Id: Iafbbdcca23db38d82bbc5bb24a39dac2a6d0a764
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2020-10-30 15:18:12 +01:00
parent 9879820864
commit 89644e4a06
2 changed files with 22 additions and 3 deletions

View File

@@ -330,6 +330,10 @@ Usage::Type FindUsages::getType(int line, int column, int tokenIndex)
for (auto it = astPath.rbegin() + 1; it != astPath.rend(); ++it) {
if ((*it)->asExpressionStatement())
return Usage::Type::Read;
if ((*it)->asSwitchStatement())
return Usage::Type::Read;
if ((*it)->asCaseStatement())
return Usage::Type::Read;
if ((*it)->asLambdaCapture() || (*it)->asNamedTypeSpecifier()
|| (*it)->asElaboratedTypeSpecifier()) {
return Usage::Type::Other;