aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/cplusplus/FindUsages.cpp
diff options
context:
space:
mode:
authorOrgad Shaneh <[email protected]>2014-05-19 18:22:03 +0300
committerOrgad Shaneh <[email protected]>2014-05-21 15:44:32 +0200
commit804eb7178a597a194772b1d187b35ba93f1d7be6 (patch)
tree24252b03ad9261633d4cbb69a4c34eb8c23312e1 /src/libs/cplusplus/FindUsages.cpp
parent480e8134e9a867e8ed49dd13aa51ebd2e440fbbe (diff)
C++: Avoid repetitive calls
Change-Id: I6f04b98c14567d344907ac635df7eeee2f7aeac7 Reviewed-by: Nikolai Kosjar <[email protected]>
Diffstat (limited to 'src/libs/cplusplus/FindUsages.cpp')
-rw-r--r--src/libs/cplusplus/FindUsages.cpp36
1 files changed, 19 insertions, 17 deletions
diff --git a/src/libs/cplusplus/FindUsages.cpp b/src/libs/cplusplus/FindUsages.cpp
index 91fa156c2fe..19fcbed30b9 100644
--- a/src/libs/cplusplus/FindUsages.cpp
+++ b/src/libs/cplusplus/FindUsages.cpp
@@ -206,45 +206,47 @@ bool FindUsages::checkCandidates(const QList<LookupItem> &candidates) const
return false;
}
- if (isLocalScope(_declSymbol->enclosingScope()) || isLocalScope(s->enclosingScope())) {
- if (_declSymbol->isClass() && _declSymbol->enclosingScope()->isTemplate()
- && s->isClass() && s->enclosingScope()->isTemplate()) {
+ Scope *declEnclosingScope = _declSymbol->enclosingScope();
+ Scope *enclosingScope = s->enclosingScope();
+ if (isLocalScope(declEnclosingScope) || isLocalScope(enclosingScope)) {
+ if (_declSymbol->isClass() && declEnclosingScope->isTemplate()
+ && s->isClass() && enclosingScope->isTemplate()) {
// for definition of functions of class defined outside the class definition
- Scope *templEnclosingDeclSymbol = _declSymbol->enclosingScope();
+ Scope *templEnclosingDeclSymbol = declEnclosingScope;
Scope *scopeOfTemplEnclosingDeclSymbol
= templEnclosingDeclSymbol->enclosingScope();
- Scope *templEnclosingCandidateSymbol = s->enclosingScope();
+ Scope *templEnclosingCandidateSymbol = enclosingScope;
Scope *scopeOfTemplEnclosingCandidateSymbol
= templEnclosingCandidateSymbol->enclosingScope();
if (scopeOfTemplEnclosingCandidateSymbol != scopeOfTemplEnclosingDeclSymbol)
return false;
- } else if (_declSymbol->isClass() && _declSymbol->enclosingScope()->isTemplate()
- && s->enclosingScope()->isClass()
- && s->enclosingScope()->enclosingScope()->isTemplate()) {
+ } else if (_declSymbol->isClass() && declEnclosingScope->isTemplate()
+ && enclosingScope->isClass()
+ && enclosingScope->enclosingScope()->isTemplate()) {
// for declaration inside template class
- Scope *templEnclosingDeclSymbol = _declSymbol->enclosingScope();
+ Scope *templEnclosingDeclSymbol = declEnclosingScope;
Scope *scopeOfTemplEnclosingDeclSymbol
= templEnclosingDeclSymbol->enclosingScope();
- Scope *templEnclosingCandidateSymbol = s->enclosingScope()->enclosingScope();
+ Scope *templEnclosingCandidateSymbol = enclosingScope->enclosingScope();
Scope *scopeOfTemplEnclosingCandidateSymbol
= templEnclosingCandidateSymbol->enclosingScope();
if (scopeOfTemplEnclosingCandidateSymbol != scopeOfTemplEnclosingDeclSymbol)
return false;
- } else if (s->enclosingScope()->isTemplate() && ! _declSymbol->isTypenameArgument()) {
- if (_declSymbol->enclosingScope()->isTemplate()) {
- if (s->enclosingScope()->enclosingScope() != _declSymbol->enclosingScope()->enclosingScope())
+ } else if (enclosingScope->isTemplate() && ! _declSymbol->isTypenameArgument()) {
+ if (declEnclosingScope->isTemplate()) {
+ if (enclosingScope->enclosingScope() != declEnclosingScope->enclosingScope())
return false;
} else {
- if (s->enclosingScope()->enclosingScope() != _declSymbol->enclosingScope())
+ if (enclosingScope->enclosingScope() != declEnclosingScope)
return false;
}
- } else if (_declSymbol->enclosingScope()->isTemplate() && s->isTemplate()) {
- if (_declSymbol->enclosingScope()->enclosingScope() != s->enclosingScope())
+ } else if (declEnclosingScope->isTemplate() && s->isTemplate()) {
+ if (declEnclosingScope->enclosingScope() != enclosingScope)
return false;
} else if (! s->isUsingDeclaration()
- && s->enclosingScope() != _declSymbol->enclosingScope()) {
+ && enclosingScope != declEnclosingScope) {
return false;
}
}