forked from qt-creator/qt-creator
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:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,8 @@ public:
|
||||
class CPLUSPLUS_EXPORT FindUsages: protected ASTVisitor
|
||||
{
|
||||
public:
|
||||
FindUsages(const QByteArray &originalSource, Document::Ptr doc, const Snapshot &snapshot);
|
||||
FindUsages(const QByteArray &originalSource, Document::Ptr doc, const Snapshot &snapshot,
|
||||
bool categorize);
|
||||
FindUsages(const LookupContext &context);
|
||||
|
||||
void operator()(Symbol *symbol);
|
||||
@@ -302,6 +303,7 @@ private:
|
||||
QSet<unsigned> _processed;
|
||||
TypeOfExpression typeofExpression;
|
||||
Scope *_currentScope = nullptr;
|
||||
const bool _categorize = false;
|
||||
class GetUsageType;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user