CppEditor: Add second "Find References" Action

This one includes access type categorization, while the "normal" one
does not.
We need this now, because with clangd, the categorization is too slow to
enable it by default.

Change-Id: I2eb4608630d34452ae28f0836befd5d9053f42bf
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2021-05-26 17:24:18 +02:00
parent a09851ff1f
commit a5ba33cbeb
9 changed files with 102 additions and 64 deletions

View File

@@ -45,13 +45,15 @@
using namespace CPlusPlus;
FindUsages::FindUsages(const QByteArray &originalSource, Document::Ptr doc, const Snapshot &snapshot)
FindUsages::FindUsages(const QByteArray &originalSource, Document::Ptr doc,
const Snapshot &snapshot, bool categorize)
: ASTVisitor(doc->translationUnit()),
_doc(doc),
_snapshot(snapshot),
_context(doc, snapshot),
_originalSource(originalSource),
_source(_doc->utf8Source())
_source(_doc->utf8Source()),
_categorize(categorize)
{
_snapshot.insert(_doc);
typeofExpression.init(_doc, _snapshot, _context.bindings());
@@ -465,6 +467,8 @@ private:
Usage::Type FindUsages::getType(int line, int column, int tokenIndex)
{
if (!_categorize)
return Usage::Type::Other;
return GetUsageType(this, ASTPath(_doc)(line, column), tokenIndex).getUsageType();
}