From ccf3244932fb763f792782268a54def2704740b0 Mon Sep 17 00:00:00 2001 From: Roberto Raggi <roberto.raggi@nokia.com> Date: Thu, 5 Aug 2010 13:38:27 +0200 Subject: [PATCH] Check only NameId and TemplateNameId --- src/libs/cplusplus/FindUsages.cpp | 19 ++++++++++++++++++- src/libs/cplusplus/FindUsages.h | 1 + 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/libs/cplusplus/FindUsages.cpp b/src/libs/cplusplus/FindUsages.cpp index 40dd61b2c53..4991efa8064 100644 --- a/src/libs/cplusplus/FindUsages.cpp +++ b/src/libs/cplusplus/FindUsages.cpp @@ -170,13 +170,30 @@ bool FindUsages::compareFullyQualifiedName(const QList<const Name *> &path, cons return false; for (int i = 0; i < path.length(); ++i) { - if (! path.at(i)->isEqualTo(other.at(i))) + if (! compareName(path.at(i), other.at(i))) return false; } return true; } +bool FindUsages::compareName(const Name *name, const Name *other) +{ + if (name == other) + return true; + + else if (name && other) { + const Identifier *id = name->identifier(); + const Identifier *otherId = other->identifier(); + + if (id == otherId || (id && id->isEqualTo(otherId))) + return true; + } + + return false; +} + + bool FindUsages::checkCandidates(const QList<LookupItem> &candidates) const { for (int i = candidates.size() - 1; i != -1; --i) { diff --git a/src/libs/cplusplus/FindUsages.h b/src/libs/cplusplus/FindUsages.h index 05a71e9e966..a10e1ac4829 100644 --- a/src/libs/cplusplus/FindUsages.h +++ b/src/libs/cplusplus/FindUsages.h @@ -106,6 +106,7 @@ protected: unsigned startOfTemplateDeclaration(TemplateDeclarationAST *ast) const; static bool compareFullyQualifiedName(const QList<const Name *> &path, const QList<const Name *> &other); + static bool compareName(const Name *name, const Name *other); private: const Identifier *_id; -- GitLab