aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/cplusplus/FindUsages.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <[email protected]>2013-07-08 12:30:06 +0200
committerNikolai Kosjar <[email protected]>2013-07-08 15:05:10 +0200
commitd70a33c0d0437661e3ccc7b5cab3fa9926e252d9 (patch)
tree7034e5d36bd33d79b0b6e7770fa8b41b85c11c39 /src/libs/cplusplus/FindUsages.cpp
parent07c0a8348c59945465e9f2330a40f625543f7f8a (diff)
C++: fix scope matching for templates in FindUsages
When the cursor is on the name of declaration of a templated function, then since f93758b8e1d68ed28dc1a84b71c906d58784cb70 the scope returned by Document::findScopeAt is the scope of the template declaration. Before it was the parent scope of the template declaration. The check in FindUsages::checkCandidates did not check all combinations of template(-child symbol) scopes for the searched symbol and its occurrences. Task-number: QTCREATORBUG-9749 Change-Id: Idc84a2ba718721ce54683a67635a93352784ddd1 Reviewed-by: Nikolai Kosjar <[email protected]>
Diffstat (limited to 'src/libs/cplusplus/FindUsages.cpp')
-rw-r--r--src/libs/cplusplus/FindUsages.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/libs/cplusplus/FindUsages.cpp b/src/libs/cplusplus/FindUsages.cpp
index 07a912b8faf..7fe56b90e4e 100644
--- a/src/libs/cplusplus/FindUsages.cpp
+++ b/src/libs/cplusplus/FindUsages.cpp
@@ -208,7 +208,15 @@ bool FindUsages::checkCandidates(const QList<LookupItem> &candidates) const
if (isLocalScope(_declSymbol->enclosingScope()) || isLocalScope(s->enclosingScope())) {
if (s->enclosingScope()->isTemplate()) {
- if (s->enclosingScope()->enclosingScope() != _declSymbol->enclosingScope())
+ if (_declSymbol->enclosingScope()->isTemplate()) {
+ if (s->enclosingScope()->enclosingScope() != _declSymbol->enclosingScope()->enclosingScope())
+ return false;
+ } else {
+ if (s->enclosingScope()->enclosingScope() != _declSymbol->enclosingScope())
+ return false;
+ }
+ } else if (_declSymbol->enclosingScope()->isTemplate() && s->isTemplate()) {
+ if (_declSymbol->enclosingScope()->enclosingScope() != s->enclosingScope())
return false;
} else if (! s->isUsingDeclaration() && s->enclosingScope() != _declSymbol->enclosingScope()) {
return false;