diff --git a/src/libs/cplusplus/FindUsages.cpp b/src/libs/cplusplus/FindUsages.cpp index 9723dde51612d630941cce46e42828ab384512f1..905d9be4fc77b48c58a134c516aa017c3245f7e0 100644 --- a/src/libs/cplusplus/FindUsages.cpp +++ b/src/libs/cplusplus/FindUsages.cpp @@ -203,6 +203,16 @@ bool FindUsages::compareName(const Name *name, const Name *other) return false; } +bool FindUsages::isLocalScope(Scope *scope) +{ + if (scope) { + if (scope->isBlock() || scope->isTemplate() || scope->isFunction()) + return true; + } + + return false; +} + bool FindUsages::checkCandidates(const QList<LookupItem> &candidates) const { for (int i = candidates.size() - 1; i != -1; --i) { @@ -214,7 +224,7 @@ bool FindUsages::checkCandidates(const QList<LookupItem> &candidates) const return false; } - if (_declSymbol->scope() && (_declSymbol->scope()->isFunction() || _declSymbol->scope()->isBlock())) { + if (isLocalScope(_declSymbol->scope()) || isLocalScope(s->scope())) { if (s->scope() != _declSymbol->scope()) return false; } diff --git a/src/libs/cplusplus/FindUsages.h b/src/libs/cplusplus/FindUsages.h index d25a9f033514cdc2b64442a9df353d9a3984f02e..00c2baa8df1348c8665cef318abea73e558e83ad 100644 --- a/src/libs/cplusplus/FindUsages.h +++ b/src/libs/cplusplus/FindUsages.h @@ -83,6 +83,7 @@ protected: static bool compareFullyQualifiedName(const QList<const Name *> &path, const QList<const Name *> &other); static bool compareName(const Name *name, const Name *other); + static bool isLocalScope(Scope *scope); void statement(StatementAST *ast); void expression(ExpressionAST *ast);