mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Cosmetics.
This commit is contained in:
parent
f7f3825ef8
commit
8f2ea4c665
11 changed files with 45 additions and 54 deletions
|
@ -28,10 +28,11 @@ public interface IType extends Cloneable {
|
|||
public Object clone();
|
||||
|
||||
/**
|
||||
* Test whether this type is the same as the given one. A typedef is considered to be the same type as
|
||||
* it's target type.
|
||||
* See {@link ICPPTemplateTemplateParameter#isSameType(IType)} or {@link ICPPTemplateTypeParameter#isSameType(IType)}
|
||||
* for the semantics of comparing template parameters denoting types.
|
||||
* Test whether this type is the same as the given one. A typedef is considered to be the same
|
||||
* type as it's target type.
|
||||
* See {@link ICPPTemplateTemplateParameter#isSameType(IType)} or
|
||||
* {@link ICPPTemplateTypeParameter#isSameType(IType)} for the semantics of comparing template
|
||||
* parameters denoting types.
|
||||
*/
|
||||
public boolean isSameType(IType type);
|
||||
}
|
||||
|
|
|
@ -35,16 +35,16 @@ public interface ICPPBase extends Cloneable {
|
|||
* In the case of typedefs, the target type will be returned instead of the typedef itself.
|
||||
*/
|
||||
public IBinding getBaseClass();
|
||||
|
||||
|
||||
/**
|
||||
* The base class. Generally a ICPPClassType, but may be an {@link ICPPUnknownType}.
|
||||
* The base class. Generally a ICPPClassType, but may be an {@link ICPPUnknownType}.
|
||||
* In the case of typedefs, the target type will be returned instead of the typedef itself.
|
||||
* @since 5.5
|
||||
*/
|
||||
public IType getBaseClassType();
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated don't use it, a base class may be specified without the use of a name.
|
||||
* @deprecated Don't use it, a base class may be specified without the use of a name.
|
||||
*/
|
||||
@Deprecated
|
||||
public IName getBaseClassSpecifierName();
|
||||
|
@ -54,24 +54,22 @@ public interface ICPPBase extends Cloneable {
|
|||
* @since 5.5
|
||||
*/
|
||||
public IName getClassDefinitionName();
|
||||
|
||||
|
||||
/**
|
||||
* The visibility qualifier applied to the base class.
|
||||
*
|
||||
*/
|
||||
public int getVisibility();
|
||||
|
||||
|
||||
/**
|
||||
* Whether this is a virtual base class.
|
||||
*/
|
||||
public boolean isVirtual();
|
||||
|
||||
|
||||
/**
|
||||
* @since 5.1
|
||||
*/
|
||||
public ICPPBase clone();
|
||||
|
||||
|
||||
/**
|
||||
* Used internally to change cloned bases.
|
||||
* @noreference This method is not intended to be referenced by clients.
|
||||
|
|
|
@ -21,7 +21,7 @@ public interface ICPPClassScope extends ICPPScope {
|
|||
/**
|
||||
* Returns the binding for the class this scope is associated with.
|
||||
*/
|
||||
ICPPClassType getClassType();
|
||||
public ICPPClassType getClassType();
|
||||
|
||||
/**
|
||||
* Returns an array of methods that were implicitly added to this class
|
||||
|
|
|
@ -116,17 +116,15 @@ public class SemanticQueries {
|
|||
* we need to be able to keep track of more than one at a time.
|
||||
*/
|
||||
private static class FinalOverriderMap {
|
||||
private Map<ICPPMethod, Map<Integer, List<ICPPMethod>>> fMap
|
||||
= new HashMap<ICPPMethod, Map<Integer, List<ICPPMethod>>>();
|
||||
private Map<ICPPMethod, Map<Integer, List<ICPPMethod>>> fMap = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Add 'overrider' as a final ovverider of 'method' in subobject
|
||||
* 'subobjectNumber'.
|
||||
* Add 'overrider' as a final overrider of 'method' in subobject 'subobjectNumber'.
|
||||
*/
|
||||
public void add(ICPPMethod method, int subobjectNumber, ICPPMethod overrider) {
|
||||
Map<Integer, List<ICPPMethod>> overriders = fMap.get(method);
|
||||
if (overriders == null) {
|
||||
overriders = new HashMap<Integer, List<ICPPMethod>>();
|
||||
overriders = new HashMap<>();
|
||||
fMap.put(method, overriders);
|
||||
}
|
||||
CollectionUtils.listMapGet(overriders, subobjectNumber).add(overrider);
|
||||
|
@ -154,7 +152,7 @@ public class SemanticQueries {
|
|||
for (ICPPMethod method : other.fMap.keySet()) {
|
||||
Map<Integer, List<ICPPMethod>> overriders = fMap.get(method);
|
||||
if (overriders == null) {
|
||||
overriders = new HashMap<Integer, List<ICPPMethod>>();
|
||||
overriders = new HashMap<>();
|
||||
fMap.put(method, overriders);
|
||||
}
|
||||
Map<Integer, List<ICPPMethod>> otherOverriders = other.fMap.get(method);
|
||||
|
@ -171,7 +169,7 @@ public class SemanticQueries {
|
|||
* which is themself, meaning they have not been overridden.
|
||||
*/
|
||||
public ICPPMethod[] collectPureVirtualMethods() {
|
||||
List<ICPPMethod> pureVirtualMethods = new ArrayList<ICPPMethod>();
|
||||
List<ICPPMethod> pureVirtualMethods = new ArrayList<>();
|
||||
for (ICPPMethod method : fMap.keySet()) {
|
||||
if (method.isPureVirtual()) {
|
||||
Map<Integer, List<ICPPMethod>> finalOverriders = fMap.get(method);
|
||||
|
@ -190,12 +188,12 @@ public class SemanticQueries {
|
|||
// The last subobject number used for each type in the hierarchy. This is used to
|
||||
// assign subobject numbers to subobjects. Virtual subobjects get a subobject
|
||||
// number of zero, while non-virtual subobjects are number starting from one.
|
||||
private Map<ICPPClassType, Integer> subobjectNumbers = new HashMap<ICPPClassType, Integer>();
|
||||
private Map<ICPPClassType, Integer> subobjectNumbers = new HashMap<>();
|
||||
|
||||
// Cache of final overrider maps for virtual base subobjects. Since such subobjects
|
||||
// only occur once in the hierarchy, we can cache the final overrider maps we
|
||||
// compute for them.
|
||||
private Map<ICPPClassType, FinalOverriderMap> virtualBaseCache = new HashMap<ICPPClassType, FinalOverriderMap>();
|
||||
private Map<ICPPClassType, FinalOverriderMap> virtualBaseCache = new HashMap<>();
|
||||
|
||||
public ICPPMethod[] collect(ICPPClassType root, IASTNode point) {
|
||||
FinalOverriderMap finalOverriderMap = collectFinalOverriders(root, false, new HashSet<ICPPClassType>(),
|
||||
|
|
|
@ -63,27 +63,17 @@ public class CPPBaseClause implements ICPPBase, ICPPInternalBase {
|
|||
return baseClass;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBase#getVisibility()
|
||||
*/
|
||||
@Override
|
||||
public int getVisibility() {
|
||||
int vis = base.getVisibility();
|
||||
|
||||
if (vis == 0) {
|
||||
ICPPASTCompositeTypeSpecifier compSpec = (ICPPASTCompositeTypeSpecifier) base.getParent();
|
||||
int key = compSpec.getKey();
|
||||
if (key == ICPPClassType.k_class)
|
||||
vis = ICPPBase.v_private;
|
||||
else
|
||||
vis = ICPPBase.v_public;
|
||||
vis = compSpec.getKey() == ICPPClassType.k_class ? ICPPBase.v_private : ICPPBase.v_public;
|
||||
}
|
||||
return vis;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBase#isVirtual()
|
||||
*/
|
||||
@Override
|
||||
public boolean isVirtual() {
|
||||
return base.isVirtual();
|
||||
|
@ -105,9 +95,6 @@ public class CPPBaseClause implements ICPPBase, ICPPInternalBase {
|
|||
return base.getName();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBase#getClassDefinitionName()
|
||||
*/
|
||||
@Override
|
||||
public IName getClassDefinitionName() {
|
||||
IASTNode parent = base.getParent();
|
||||
|
|
|
@ -44,10 +44,9 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
|
|||
/**
|
||||
* A template template parameter.
|
||||
*/
|
||||
public class CPPTemplateTemplateParameter extends CPPTemplateParameter implements
|
||||
ICPPTemplateTemplateParameter, ICPPInternalTemplate, ICPPUnknownBinding,
|
||||
public class CPPTemplateTemplateParameter extends CPPTemplateParameter
|
||||
implements ICPPTemplateTemplateParameter, ICPPInternalTemplate, ICPPUnknownBinding,
|
||||
ICPPUnknownType {
|
||||
|
||||
private ICPPTemplateParameter[] templateParameters;
|
||||
private ObjectMap instances;
|
||||
private ICPPScope unknownScope;
|
||||
|
@ -139,30 +138,37 @@ public class CPPTemplateTemplateParameter extends CPPTemplateParameter implement
|
|||
public ICPPBase[] getBases() {
|
||||
return ICPPBase.EMPTY_BASE_ARRAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IField[] getFields() {
|
||||
return IField.EMPTY_FIELD_ARRAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IField findField(String name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICPPField[] getDeclaredFields() {
|
||||
return ICPPField.EMPTY_CPPFIELD_ARRAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICPPMethod[] getMethods() {
|
||||
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICPPMethod[] getAllDeclaredMethods() {
|
||||
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICPPMethod[] getDeclaredMethods() {
|
||||
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICPPConstructor[] getConstructors() {
|
||||
return ICPPConstructor.EMPTY_CONSTRUCTOR_ARRAY;
|
||||
|
@ -171,6 +177,7 @@ public class CPPTemplateTemplateParameter extends CPPTemplateParameter implement
|
|||
public IBinding[] getFriends() {
|
||||
return IBinding.EMPTY_BINDING_ARRAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICPPClassType[] getNestedClasses() {
|
||||
return ICPPClassType.EMPTY_CLASS_ARRAY;
|
||||
|
|
|
@ -187,16 +187,17 @@ public class ClassTypeHelper {
|
|||
return ICPPBase.EMPTY_BASE_ARRAY;
|
||||
}
|
||||
}
|
||||
ICPPASTBaseSpecifier[] bases = host.getCompositeTypeSpecifier().getBaseSpecifiers();
|
||||
if (bases.length == 0)
|
||||
|
||||
ICPPASTBaseSpecifier[] baseSpecifiers = host.getCompositeTypeSpecifier().getBaseSpecifiers();
|
||||
if (baseSpecifiers.length == 0)
|
||||
return ICPPBase.EMPTY_BASE_ARRAY;
|
||||
|
||||
ICPPBase[] bindings = new ICPPBase[bases.length];
|
||||
for (int i = 0; i < bases.length; i++) {
|
||||
bindings[i] = new CPPBaseClause(bases[i]);
|
||||
ICPPBase[] bases = new ICPPBase[baseSpecifiers.length];
|
||||
for (int i = 0; i < baseSpecifiers.length; i++) {
|
||||
bases[i] = new CPPBaseClause(baseSpecifiers[i]);
|
||||
}
|
||||
|
||||
return bindings;
|
||||
return bases;
|
||||
}
|
||||
|
||||
public static ICPPField[] getDeclaredFields(ICPPInternalClassTypeMixinHost host) {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* QNX - Initial API and implementation
|
||||
* QNX - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
|
@ -15,13 +15,12 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
|
|||
|
||||
/**
|
||||
* @author Bryan Wilkinson
|
||||
*
|
||||
*/
|
||||
public interface ICPPInternalBase extends Cloneable {
|
||||
public Object clone();
|
||||
|
||||
/**
|
||||
* Set the base class.
|
||||
* Sets the base class.
|
||||
*/
|
||||
public void setBaseClass(IBinding binding) throws DOMException;
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ public abstract class CompositeScope implements IIndexScope {
|
|||
*/
|
||||
protected final IBinding processUncertainBinding(IBinding binding) {
|
||||
if (binding instanceof IIndexFragmentBinding) {
|
||||
return cf.getCompositeBinding((IIndexFragmentBinding)binding);
|
||||
return cf.getCompositeBinding((IIndexFragmentBinding) binding);
|
||||
} else if (binding instanceof ProblemBinding) {
|
||||
return binding;
|
||||
} else if (binding instanceof CPPCompositeBinding /* AST composite */) {
|
||||
|
|
|
@ -41,7 +41,7 @@ class CompositeCPPClassScope extends CompositeScope implements ICPPClassScope {
|
|||
|
||||
@Override
|
||||
public ICPPMethod[] getImplicitMethods() {
|
||||
ICPPClassScope rscope = (ICPPClassScope) ((ICPPClassType)rbinding).getCompositeScope();
|
||||
ICPPClassScope rscope = (ICPPClassScope) ((ICPPClassType) rbinding).getCompositeScope();
|
||||
ICPPMethod[] result = rscope.getImplicitMethods();
|
||||
for (int i= 0; i < result.length; i++) {
|
||||
result[i] = (ICPPMethod) cf.getCompositeBinding((IIndexFragmentBinding) result[i]);
|
||||
|
@ -51,7 +51,7 @@ class CompositeCPPClassScope extends CompositeScope implements ICPPClassScope {
|
|||
|
||||
@Override
|
||||
public ICPPConstructor[] getConstructors() {
|
||||
ICPPClassScope rscope = (ICPPClassScope) ((ICPPClassType)rbinding).getCompositeScope();
|
||||
ICPPClassScope rscope = (ICPPClassScope) ((ICPPClassType) rbinding).getCompositeScope();
|
||||
ICPPConstructor[] result = rscope.getConstructors();
|
||||
for (int i= 0; i < result.length; i++) {
|
||||
result[i] = (ICPPConstructor) cf.getCompositeBinding((IIndexFragmentBinding) result[i]);
|
||||
|
|
|
@ -94,13 +94,13 @@ class PDOMCPPUsingDeclaration extends PDOMCPPBinding implements ICPPUsingDeclara
|
|||
do {
|
||||
IBinding delegate = alias.getBinding();
|
||||
if (delegate != null) {
|
||||
delegates= ArrayUtil.appendAt(IBinding.class, delegates, i++, delegate);
|
||||
delegates= ArrayUtil.appendAt(delegates, i++, delegate);
|
||||
}
|
||||
} while ((alias = alias.getNext()) != null);
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
}
|
||||
delegates = ArrayUtil.trim(IBinding.class, delegates);
|
||||
delegates = ArrayUtil.trim(delegates, i);
|
||||
}
|
||||
return delegates;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue