forked from qt-creator/qt-creator
C++: fix scope matching for templates in FindUsages
When the cursor is on the name of declaration of a templated function,
then since f93758b8e1 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 <nikolai.kosjar@digia.com>
This commit is contained in:
committed by
Nikolai Kosjar
parent
07c0a8348c
commit
d70a33c0d0
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user