forked from qt-creator/qt-creator
CPlusPlus: Check for static member functions in FindUsages
Static member functions cannot modify the object and therefore must not be reported as writable references. Note that this does not have an effect yet, as the function type lacks information about the "static" specifier. Task-number: QTCREATORBUG-24894 Change-Id: Ib04a17864a0ca5b7610579a2f5efbcfde257e08a Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -285,8 +285,13 @@ Usage::Type FindUsages::getType(int line, int column, int tokenIndex)
|
||||
if (items.isEmpty())
|
||||
return Usage::Type::Other;
|
||||
for (const LookupItem &item : qAsConst(items)) {
|
||||
if (item.type()->isFunctionType())
|
||||
return item.type().isConst() ? Usage::Type::Read : Usage::Type::WritableRef;
|
||||
if (item.type()->isFunctionType()) {
|
||||
if (item.type().isConst())
|
||||
return Usage::Type::Read;
|
||||
if (item.type().isStatic())
|
||||
return Usage::Type::Other;
|
||||
return Usage::Type::WritableRef;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Usage::Type::Other;
|
||||
|
||||
Reference in New Issue
Block a user