mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-03 22:35:43 +02:00
Cosmetics.
This commit is contained in:
parent
ce09756dad
commit
90e1dc0b1b
2 changed files with 18 additions and 45 deletions
|
@ -120,7 +120,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
||||||
//copy constructor: A(const A &)
|
//copy constructor: A(const A &)
|
||||||
|
|
||||||
ICPPMethod m = new CPPImplicitConstructor(this, className, ps);
|
ICPPMethod m = new CPPImplicitConstructor(this, className, ps);
|
||||||
implicits[i++]=m;
|
implicits[i++] = m;
|
||||||
addBinding(m);
|
addBinding(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,9 +150,6 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
||||||
return CPPVisitor.getContainingNonTemplateScope(compName);
|
return CPPVisitor.getContainingNonTemplateScope(compName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPScope#addBinding(org.eclipse.cdt.core.dom.ast.IBinding)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void addBinding(IBinding binding) {
|
public void addBinding(IBinding binding) {
|
||||||
if (binding instanceof ICPPConstructor) {
|
if (binding instanceof ICPPConstructor) {
|
||||||
|
@ -164,16 +161,16 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addName(IASTName name) {
|
public void addName(IASTName name) {
|
||||||
// don't add names from inactive code branches
|
// Don't add names from inactive code branches.
|
||||||
if (!name.isActive())
|
if (!name.isActive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (name instanceof ICPPASTQualifiedName) {
|
if (name instanceof ICPPASTQualifiedName) {
|
||||||
// check whether the qualification matches
|
// Check whether the qualification matches.
|
||||||
IBinding b= getClassType();
|
IBinding b= getClassType();
|
||||||
final ICPPASTQualifiedName qname = (ICPPASTQualifiedName) name;
|
final ICPPASTQualifiedName qname = (ICPPASTQualifiedName) name;
|
||||||
final IASTName[] names= qname.getNames();
|
final IASTName[] names= qname.getNames();
|
||||||
for (int i = names.length-2; i>=0; i--) {
|
for (int i = names.length - 1; --i >= 0;) {
|
||||||
if (b == null || !CharArrayUtils.equals(names[i].getLookupKey(), b.getNameCharArray()))
|
if (b == null || !CharArrayUtils.equals(names[i].getLookupKey(), b.getNameCharArray()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -211,9 +208,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
||||||
bindings.put(CONSTRUCTOR_KEY, constructor);
|
bindings.put(CONSTRUCTOR_KEY, constructor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPScope#getBinding(int, char[])
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet fileSet) {
|
public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet fileSet) {
|
||||||
char[] c = name.getLookupKey();
|
char[] c = name.getLookupKey();
|
||||||
|
@ -231,8 +226,8 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet fileSet,
|
public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup,
|
||||||
boolean checkPointOfDecl) {
|
IIndexFileSet fileSet, boolean checkPointOfDecl) {
|
||||||
char[] c = name.getLookupKey();
|
char[] c = name.getLookupKey();
|
||||||
|
|
||||||
ICPPASTCompositeTypeSpecifier compType = (ICPPASTCompositeTypeSpecifier) getPhysicalNode();
|
ICPPASTCompositeTypeSpecifier compType = (ICPPASTCompositeTypeSpecifier) getPhysicalNode();
|
||||||
|
@ -299,7 +294,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
||||||
return ArrayUtil.trim(ICPPConstructor.class, bs);
|
return ArrayUtil.trim(ICPPConstructor.class, bs);
|
||||||
} else if (o instanceof IASTName) {
|
} else if (o instanceof IASTName) {
|
||||||
if (shouldResolve(forceResolve, (IASTName) o, forName) || ((IASTName) o).getBinding() != null) {
|
if (shouldResolve(forceResolve, (IASTName) o, forName) || ((IASTName) o).getBinding() != null) {
|
||||||
// always store the name, rather than the binding, such that we can properly flush the scope.
|
// Always store the name, rather than the binding, such that we can properly flush the scope.
|
||||||
nameMap.put(CONSTRUCTOR_KEY, o);
|
nameMap.put(CONSTRUCTOR_KEY, o);
|
||||||
binding = ((IASTName)o).resolveBinding();
|
binding = ((IASTName)o).resolveBinding();
|
||||||
}
|
}
|
||||||
|
@ -313,9 +308,6 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
||||||
return ICPPConstructor.EMPTY_CONSTRUCTOR_ARRAY;
|
return ICPPConstructor.EMPTY_CONSTRUCTOR_ARRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IScope#find(java.lang.String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IBinding[] find(String name) {
|
public IBinding[] find(String name) {
|
||||||
char[] n = name.toCharArray();
|
char[] n = name.toCharArray();
|
||||||
|
@ -359,9 +351,6 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope#getClassType()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public ICPPClassType getClassType() {
|
public ICPPClassType getClassType() {
|
||||||
ICPPASTCompositeTypeSpecifier compSpec = (ICPPASTCompositeTypeSpecifier) getPhysicalNode();
|
ICPPASTCompositeTypeSpecifier compSpec = (ICPPASTCompositeTypeSpecifier) getPhysicalNode();
|
||||||
|
@ -373,9 +362,6 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
||||||
return new CPPClassType.CPPClassTypeProblem(name, ISemanticProblem.BINDING_NO_CLASS, name.toCharArray());
|
return new CPPClassType.CPPClassTypeProblem(name, ISemanticProblem.BINDING_NO_CLASS, name.toCharArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope#getImplicitMethods()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public ICPPMethod[] getImplicitMethods() {
|
public ICPPMethod[] getImplicitMethods() {
|
||||||
if (implicits == null)
|
if (implicits == null)
|
||||||
|
@ -384,9 +370,6 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
||||||
return implicits;
|
return implicits;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPScope#getScopeName()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IName getScopeName() {
|
public IName getScopeName() {
|
||||||
IASTNode node = getPhysicalNode();
|
IASTNode node = getPhysicalNode();
|
||||||
|
@ -419,12 +402,12 @@ class ImplicitsAnalysis {
|
||||||
hasUserDeclaredCopyAssignmentOperator= false;
|
hasUserDeclaredCopyAssignmentOperator= false;
|
||||||
hasUserDeclaredDestructor= getUserDeclaredCtorOrDtor(compSpec, false).length>0;
|
hasUserDeclaredDestructor= getUserDeclaredCtorOrDtor(compSpec, false).length>0;
|
||||||
|
|
||||||
outer: for (int i=0; i<ctors.length; i++) {
|
outer: for (int i= 0; i < ctors.length; i++) {
|
||||||
ICPPASTFunctionDeclarator dcltor= ctors[i];
|
ICPPASTFunctionDeclarator dcltor= ctors[i];
|
||||||
IASTParameterDeclaration[] ps = dcltor.getParameters();
|
IASTParameterDeclaration[] ps = dcltor.getParameters();
|
||||||
if (ps.length >= 1) {
|
if (ps.length >= 1) {
|
||||||
if (hasTypeReferenceToClassType(ps[0])) {
|
if (hasTypeReferenceToClassType(ps[0])) {
|
||||||
// and all remaining arguments have initializers
|
// All remaining arguments have initializers.
|
||||||
for (int j = 1; j < ps.length; j++) {
|
for (int j = 1; j < ps.length; j++) {
|
||||||
if (ps[j].getDeclarator().getInitializer() == null) {
|
if (ps[j].getDeclarator().getInitializer() == null) {
|
||||||
continue outer;
|
continue outer;
|
||||||
|
@ -464,7 +447,6 @@ class ImplicitsAnalysis {
|
||||||
spec = ((IASTFunctionDefinition)member).getDeclSpecifier();
|
spec = ((IASTFunctionDefinition)member).getDeclSpecifier();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!(dcltor instanceof ICPPASTFunctionDeclarator) || !(spec instanceof IASTSimpleDeclSpecifier) ||
|
if (!(dcltor instanceof ICPPASTFunctionDeclarator) || !(spec instanceof IASTSimpleDeclSpecifier) ||
|
||||||
((IASTSimpleDeclSpecifier)spec).getType() != IASTSimpleDeclSpecifier.t_unspecified) {
|
((IASTSimpleDeclSpecifier)spec).getType() != IASTSimpleDeclSpecifier.t_unspecified) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2004, 2010 IBM Corporation and others.
|
* Copyright (c) 2004, 2010 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Andrew Niefer (IBM Corporation) - initial API and implementation
|
* Andrew Niefer (IBM Corporation) - initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
@ -42,9 +42,9 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
* Implementation of namespace scopes, including global scope.
|
* Implementation of namespace scopes, including global scope.
|
||||||
*/
|
*/
|
||||||
public class CPPNamespaceScope extends CPPScope implements ICPPInternalNamespaceScope {
|
public class CPPNamespaceScope extends CPPScope implements ICPPInternalNamespaceScope {
|
||||||
private static final ICPPInternalNamespaceScope[] NO_NAMESPACE_SCOPES = new ICPPInternalNamespaceScope[0];
|
private static final ICPPInternalNamespaceScope[] NO_NAMESPACE_SCOPES = {};
|
||||||
|
|
||||||
private List<ICPPUsingDirective> fUsingDirectives = null;
|
private List<ICPPUsingDirective> fUsingDirectives;
|
||||||
|
|
||||||
private boolean fIsInline;
|
private boolean fIsInline;
|
||||||
private boolean fIsInlineInitialized;
|
private boolean fIsInlineInitialized;
|
||||||
|
@ -64,9 +64,6 @@ public class CPPNamespaceScope extends CPPScope implements ICPPInternalNamespace
|
||||||
return EScopeKind.eNamespace;
|
return EScopeKind.eNamespace;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope#getUsingDirectives()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public ICPPUsingDirective[] getUsingDirectives() {
|
public ICPPUsingDirective[] getUsingDirectives() {
|
||||||
initUsingDirectives();
|
initUsingDirectives();
|
||||||
|
@ -86,18 +83,12 @@ public class CPPNamespaceScope extends CPPScope implements ICPPInternalNamespace
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope#addUsingDirective(org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDirective)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void addUsingDirective(ICPPUsingDirective directive) {
|
public void addUsingDirective(ICPPUsingDirective directive) {
|
||||||
initUsingDirectives();
|
initUsingDirectives();
|
||||||
fUsingDirectives.add(directive);
|
fUsingDirectives.add(directive);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPScope#getScopeName()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IName getScopeName() {
|
public IName getScopeName() {
|
||||||
IASTNode node = getPhysicalNode();
|
IASTNode node = getPhysicalNode();
|
||||||
|
|
Loading…
Add table
Reference in a new issue