1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-10 09:45:39 +02:00

Minor performance optimization.

This commit is contained in:
Sergey Prigogin 2013-09-30 15:59:09 -07:00
parent 1e598a2202
commit 709e3fa878

View file

@ -1197,10 +1197,10 @@ public class CPPVisitor extends ASTQueries {
if (parent instanceof ICPPASTQualifiedName) { if (parent instanceof ICPPASTQualifiedName) {
final ICPPASTQualifiedName qname= (ICPPASTQualifiedName) parent; final ICPPASTQualifiedName qname= (ICPPASTQualifiedName) parent;
final ICPPASTNameSpecifier[] segments= qname.getAllSegments(); final ICPPASTNameSpecifier[] qualifiers= qname.getQualifier();
int i = 0; int i = 0;
for (; i < segments.length; i++) { for (; i < qualifiers.length; i++) {
if (segments[i] == name) if (qualifiers[i] == name)
break; break;
} }
final IASTTranslationUnit tu = parent.getTranslationUnit(); final IASTTranslationUnit tu = parent.getTranslationUnit();
@ -1214,10 +1214,10 @@ public class CPPVisitor extends ASTQueries {
name= qname; name= qname;
parent= name.getParent(); parent= name.getParent();
} }
} else if (i > 0) { } else { // i > 0
// For template functions we may need to resolve a template parameter // For template functions we may need to resolve a template parameter
// as a parent of an unknown type used as parameter type. // as a parent of an unknown type used as parameter type.
IBinding binding = segments[i - 1].resolvePreBinding(); IBinding binding = qualifiers[i - 1].resolvePreBinding();
// 7.1.3-7 Unwrap typedefs, delete cv-qualifiers. // 7.1.3-7 Unwrap typedefs, delete cv-qualifiers.
if (binding instanceof ITypedef) { if (binding instanceof ITypedef) {
@ -1247,7 +1247,7 @@ public class CPPVisitor extends ASTQueries {
} }
if (done) { if (done) {
if (scope == null) { if (scope == null) {
return new CPPScope.CPPScopeProblem(segments[i - 1], IProblemBinding.SEMANTIC_BAD_SCOPE, null); return new CPPScope.CPPScopeProblem(qualifiers[i - 1], IProblemBinding.SEMANTIC_BAD_SCOPE, null);
} }
return scope; return scope;
} }