1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2011-07-27 10:40:34 -07:00
parent 3427d95db8
commit acc49b9da2
7 changed files with 43 additions and 47 deletions

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.dom.ast.cpp; package org.eclipse.cdt.core.dom.ast.cpp;
@ -23,7 +23,6 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
* @noimplement This interface is not intended to be implemented by clients. * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPUsingDirective { public interface ICPPUsingDirective {
ICPPUsingDirective[] EMPTY_ARRAY = new ICPPUsingDirective[0]; ICPPUsingDirective[] EMPTY_ARRAY = new ICPPUsingDirective[0];
/** /**

View file

@ -6,8 +6,8 @@
* 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)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -24,7 +24,7 @@ import org.eclipse.cdt.internal.core.dom.parser.ITypeMarshalBuffer;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
/** /**
* Integral c++ type. * Built-in c++ type.
*/ */
public class CPPBasicType implements ICPPBasicType, ISerializableType { public class CPPBasicType implements ICPPBasicType, ISerializableType {
public static final CPPBasicType BOOLEAN = new CPPBasicType(Kind.eBoolean, 0, null); public static final CPPBasicType BOOLEAN = new CPPBasicType(Kind.eBoolean, 0, null);
@ -35,9 +35,9 @@ public class CPPBasicType implements ICPPBasicType, ISerializableType {
public CPPBasicType(Kind kind, int qualifiers, IASTExpression expression) { public CPPBasicType(Kind kind, int qualifiers, IASTExpression expression) {
if (kind == Kind.eUnspecified) { if (kind == Kind.eUnspecified) {
if ( (qualifiers & (IS_COMPLEX | IS_IMAGINARY)) != 0) { if ((qualifiers & (IS_COMPLEX | IS_IMAGINARY)) != 0) {
fKind= Kind.eFloat; fKind= Kind.eFloat;
} else if ( (qualifiers & (IS_LONG | IS_SHORT | IS_SIGNED | IS_UNSIGNED | IS_LONG_LONG)) != 0 ) { } else if ((qualifiers & (IS_LONG | IS_SHORT | IS_SIGNED | IS_UNSIGNED | IS_LONG_LONG)) != 0) {
fKind= Kind.eInt; fKind= Kind.eInt;
} else { } else {
fKind= Kind.eUnspecified; fKind= Kind.eUnspecified;
@ -54,18 +54,18 @@ public class CPPBasicType implements ICPPBasicType, ISerializableType {
} }
public CPPBasicType(ICPPASTSimpleDeclSpecifier sds) { public CPPBasicType(ICPPASTSimpleDeclSpecifier sds) {
this (getKind(sds), getModifiers(sds), null); this(getKind(sds), getModifiers(sds), null);
} }
private static int getModifiers(ICPPASTSimpleDeclSpecifier sds) { private static int getModifiers(ICPPASTSimpleDeclSpecifier sds) {
return return
( sds.isLong() ? IBasicType.IS_LONG : 0 ) | (sds.isLong() ? IBasicType.IS_LONG : 0) |
( sds.isShort() ? IBasicType.IS_SHORT : 0 ) | (sds.isShort() ? IBasicType.IS_SHORT : 0) |
( sds.isSigned() ? IBasicType.IS_SIGNED: 0 ) | (sds.isSigned() ? IBasicType.IS_SIGNED: 0) |
( sds.isUnsigned()? IBasicType.IS_UNSIGNED : 0 ) | (sds.isUnsigned() ? IBasicType.IS_UNSIGNED : 0) |
( sds.isLongLong()? IBasicType.IS_LONG_LONG : 0 ) | (sds.isLongLong() ? IBasicType.IS_LONG_LONG : 0) |
( sds.isComplex() ? IBasicType.IS_COMPLEX : 0 ) | (sds.isComplex() ? IBasicType.IS_COMPLEX : 0) |
( sds.isImaginary()?IBasicType.IS_IMAGINARY : 0 ); (sds.isImaginary() ? IBasicType.IS_IMAGINARY : 0);
} }
private static Kind getKind(ICPPASTSimpleDeclSpecifier sds) { private static Kind getKind(ICPPASTSimpleDeclSpecifier sds) {
@ -73,7 +73,7 @@ public class CPPBasicType implements ICPPBasicType, ISerializableType {
} }
static Kind getKind(final int simpleDeclSpecType) { static Kind getKind(final int simpleDeclSpecType) {
switch(simpleDeclSpecType) { switch (simpleDeclSpecType) {
case IASTSimpleDeclSpecifier.t_bool: case IASTSimpleDeclSpecifier.t_bool:
return Kind.eBoolean; return Kind.eBoolean;
case IASTSimpleDeclSpecifier.t_char: case IASTSimpleDeclSpecifier.t_char:
@ -97,7 +97,6 @@ public class CPPBasicType implements ICPPBasicType, ISerializableType {
} }
} }
public boolean isSameType(IType object) { public boolean isSameType(IType object) {
if (object == this) if (object == this)
return true; return true;
@ -208,13 +207,11 @@ public class CPPBasicType implements ICPPBasicType, ISerializableType {
return new CPPBasicType(Kind.values()[kind], modifiers); return new CPPBasicType(Kind.values()[kind], modifiers);
} }
@Deprecated @Deprecated
public int getQualifierBits() { public int getQualifierBits() {
return getModifiers(); return getModifiers();
} }
@Deprecated @Deprecated
public int getType() { public int getType() {
switch (fKind) { switch (fKind) {
@ -239,6 +236,7 @@ public class CPPBasicType implements ICPPBasicType, ISerializableType {
} }
return t_unspecified; return t_unspecified;
} }
/** /**
* @deprecated types don't have values * @deprecated types don't have values
*/ */

View file

@ -67,7 +67,7 @@ public abstract class CompositeIndexBinding implements IIndexBinding {
} }
public String[] getQualifiedName() { public String[] getQualifiedName() {
return new String[] {getName()}; return new String[] { getName() };
} }
public IIndexScope getScope() { public IIndexScope getScope() {
@ -88,7 +88,7 @@ public abstract class CompositeIndexBinding implements IIndexBinding {
} }
public boolean isFileLocal() throws CoreException { public boolean isFileLocal() throws CoreException {
return rbinding != null ? rbinding.isFileLocal() : false; return rbinding != null && rbinding.isFileLocal();
} }
public IIndexFile getLocalToFile() throws CoreException { public IIndexFile getLocalToFile() throws CoreException {

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Andrew Ferguson (Symbian) - Initial implementation * Andrew Ferguson (Symbian) - Initial implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.index.composite.cpp; package org.eclipse.cdt.internal.core.index.composite.cpp;
@ -103,7 +103,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
ICPPNamespace[] namespaces; ICPPNamespace[] namespaces;
if (rscope instanceof CompositeCPPNamespace) { if (rscope instanceof CompositeCPPNamespace) {
// avoid duplicating the search // avoid duplicating the search
namespaces = ((CompositeCPPNamespace)rscope).namespaces; namespaces = ((CompositeCPPNamespace) rscope).namespaces;
} else { } else {
namespaces = getNamespaces(rscope.getScopeBinding()); namespaces = getNamespaces(rscope.getScopeBinding());
} }
@ -233,7 +233,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
} }
protected IIndexFragmentBinding findOneBinding(IBinding binding) { protected IIndexFragmentBinding findOneBinding(IBinding binding) {
return super.findOneBinding(binding, false); return findOneBinding(binding, false);
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -259,7 +259,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
} else if (binding instanceof ICPPFunction) { } else if (binding instanceof ICPPFunction) {
return new CompositeCPPFunctionInstance(this, (ICPPFunction) binding); return new CompositeCPPFunctionInstance(this, (ICPPFunction) binding);
} else { } else {
throw new CompositingNotImplementedError("composite binding unavailable for "+binding+" "+binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$ throw new CompositingNotImplementedError("composite binding unavailable for " + binding + " " + binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
} }
} }
} else if (binding instanceof ICPPTemplateDefinition) { } else if (binding instanceof ICPPTemplateDefinition) {
@ -276,7 +276,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
} else if (binding instanceof ICPPFunctionType) { } else if (binding instanceof ICPPFunctionType) {
return new CompositeCPPFunctionTemplateSpecialization(this, (ICPPFunction) binding); return new CompositeCPPFunctionTemplateSpecialization(this, (ICPPFunction) binding);
} else { } else {
throw new CompositingNotImplementedError("composite binding unavailable for "+binding+" "+binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$ throw new CompositingNotImplementedError("composite binding unavailable for " + binding + " " + binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
} }
} else { } else {
if (binding instanceof ICPPClassType) { if (binding instanceof ICPPClassType) {
@ -294,7 +294,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
} else if (binding instanceof ITypedef) { } else if (binding instanceof ITypedef) {
return new CompositeCPPTypedefSpecialization(this, (ICPPBinding) binding); return new CompositeCPPTypedefSpecialization(this, (ICPPBinding) binding);
} else { } else {
throw new CompositingNotImplementedError("composite binding unavailable for "+binding+" "+binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$ throw new CompositingNotImplementedError("composite binding unavailable for " + binding + " " + binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
} }
} }
} else if(binding instanceof ICPPTemplateParameter) { } else if(binding instanceof ICPPTemplateParameter) {
@ -305,7 +305,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
} else if (binding instanceof ICPPTemplateTemplateParameter) { } else if (binding instanceof ICPPTemplateTemplateParameter) {
result = new CompositeCPPTemplateTemplateParameter(this, (ICPPTemplateTemplateParameter) binding); result = new CompositeCPPTemplateTemplateParameter(this, (ICPPTemplateTemplateParameter) binding);
} else { } else {
throw new CompositingNotImplementedError("composite binding unavailable for "+binding+" "+binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$ throw new CompositingNotImplementedError("composite binding unavailable for " + binding + " " + binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
} }
} else if (binding instanceof ICPPTemplateDefinition) { } else if (binding instanceof ICPPTemplateDefinition) {
if (binding instanceof ICPPClassTemplate) { if (binding instanceof ICPPClassTemplate) {
@ -318,7 +318,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
} else if (binding instanceof ICPPFunctionTemplate) { } else if (binding instanceof ICPPFunctionTemplate) {
return new CompositeCPPFunctionTemplate(this, (ICPPFunction) binding); return new CompositeCPPFunctionTemplate(this, (ICPPFunction) binding);
} else { } else {
throw new CompositingNotImplementedError("composite binding unavailable for "+binding+" "+binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$ throw new CompositingNotImplementedError("composite binding unavailable for " + binding + " " + binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
} }
} else if (binding instanceof ICPPParameter) { } else if (binding instanceof ICPPParameter) {
result = new CompositeCPPParameter(this, (ICPPParameter) binding); result = new CompositeCPPParameter(this, (ICPPParameter) binding);
@ -360,7 +360,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
} else if (binding instanceof IIndexMacroContainer) { } else if (binding instanceof IIndexMacroContainer) {
result= new CompositeMacroContainer(this, binding); result= new CompositeMacroContainer(this, binding);
} else { } else {
throw new CompositingNotImplementedError("composite binding unavailable for "+binding+" "+binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$ throw new CompositingNotImplementedError("composite binding unavailable for " + binding + " " + binding.getClass()); //$NON-NLS-1$ //$NON-NLS-2$
} }
} catch(CoreException ce) { } catch(CoreException ce) {
CCorePlugin.log(ce); CCorePlugin.log(ce);
@ -385,7 +385,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
int result = 1; int result = 1;
result = prime * result + (int) (i ^ (i >>> 32)); result = prime * result + (int) (i ^ (i >>> 32));
result = prime * result + j; result = prime * result + j;
result = prime * result + (int)k; result = prime * result + (int) k;
return result; return result;
} }
@Override @Override
@ -398,7 +398,7 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
} }
} }
public static Object createInstanceCacheKey(ICompositesFactory cf,IIndexFragmentBinding rbinding) { public static Object createInstanceCacheKey(ICompositesFactory cf, IIndexFragmentBinding rbinding) {
return new Key(Thread.currentThread().getId(), cf.hashCode(), rbinding.getBindingID()); return new Key(Thread.currentThread().getId(), cf.hashCode(), rbinding.getBindingID());
} }
public static Object createSpecializationKey(ICompositesFactory cf,IIndexFragmentBinding rbinding) { public static Object createSpecializationKey(ICompositesFactory cf,IIndexFragmentBinding rbinding) {

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp; package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@ -24,13 +24,13 @@ import org.eclipse.core.runtime.CoreException;
public interface IPDOMCPPClassType extends ICPPClassType, IPDOMBinding, IIndexType { public interface IPDOMCPPClassType extends ICPPClassType, IPDOMBinding, IIndexType {
/** /**
* Visit the children of the class type without using the cache. This method is * Visits the children of the class type without using the cache. This method is
* used to populate the cache. * used to populate the cache.
*/ */
void acceptUncached(IPDOMVisitor visitor) throws CoreException; void acceptUncached(IPDOMVisitor visitor) throws CoreException;
/** /**
* Return the scope name, for use in {@link IScope#getScopeName()} * Returns the scope name, for use in {@link IScope#getScopeName()}
*/ */
IIndexName getScopeName(); IIndexName getScopeName();
} }

View file

@ -6,11 +6,11 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Doug Schaefer (QNX) - Initial API and implementation * Doug Schaefer (QNX) - Initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
* Andrew Ferguson (Symbian) * Andrew Ferguson (Symbian)
* Bryan Wilkinson (QNX) * Bryan Wilkinson (QNX)
* Jens Elmenthaler - http://bugs.eclipse.org/173458 (camel case completion) * Jens Elmenthaler - http://bugs.eclipse.org/173458 (camel case completion)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp; package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@ -147,12 +147,12 @@ class PDOMCPPNamespace extends PDOMCPPBinding
} }
public ICPPUsingDirective[] getUsingDirectives() { public ICPPUsingDirective[] getUsingDirectives() {
return new ICPPUsingDirective[0]; return ICPPUsingDirective.EMPTY_ARRAY;
} }
public IBinding[] find(String name) { public IBinding[] find(String name) {
try { try {
BindingCollector visitor = new BindingCollector(getLinkage(), name.toCharArray(), BindingCollector visitor = new BindingCollector(getLinkage(), name.toCharArray(),
IndexFilter.CPP_DECLARED_OR_IMPLICIT_NO_INSTANCE, false, false, true); IndexFilter.CPP_DECLARED_OR_IMPLICIT_NO_INSTANCE, false, false, true);
getIndex().accept(visitor); getIndex().accept(visitor);
return visitor.getBindings(); return visitor.getBindings();

View file

@ -72,7 +72,7 @@ public class LineSearchElement extends PDOMSearchElement {
if (!(obj instanceof Match)) if (!(obj instanceof Match))
return false; return false;
Match m = (Match) obj; Match m = (Match) obj;
return (fOffset == m.fOffset) && (fLength == m.fLength); return fOffset == m.fOffset && fLength == m.fLength;
} }
@Override @Override
@ -142,7 +142,7 @@ public class LineSearchElement extends PDOMSearchElement {
if (!(obj instanceof LineSearchElement)) if (!(obj instanceof LineSearchElement))
return false; return false;
LineSearchElement other = (LineSearchElement) obj; LineSearchElement other = (LineSearchElement) obj;
return (fOffset == other.fOffset) && (super.equals(obj)) && (fMatches.equals(other.fMatches)); return fOffset == other.fOffset && super.equals(obj) && fMatches.equals(other.fMatches);
} }
@Override @Override
@ -220,7 +220,6 @@ public class LineSearchElement extends PDOMSearchElement {
private static LineSearchElement[] collectLineElements(AbstractCharArray buf, Match[] matches, private static LineSearchElement[] collectLineElements(AbstractCharArray buf, Match[] matches,
IIndexFileLocation fileLocation) { IIndexFileLocation fileLocation) {
List<LineSearchElement> result = new ArrayList<LineSearchElement>(); List<LineSearchElement> result = new ArrayList<LineSearchElement>();
List<Match> matchCollector= new ArrayList<Match>(); List<Match> matchCollector= new ArrayList<Match>();
@ -237,7 +236,7 @@ public class LineSearchElement extends PDOMSearchElement {
final int minOffset= matchOffset + match.getLength(); final int minOffset= matchOffset + match.getLength();
match= null; match= null;
matchOffset= Integer.MAX_VALUE; matchOffset= Integer.MAX_VALUE;
for(i=i+1; i<matches.length; i++) { for(i= i + 1; i < matches.length; i++) {
// Advance to next match that is not overlapped // Advance to next match that is not overlapped
final Match nextMatch= matches[i]; final Match nextMatch= matches[i];
final int nextOffset= nextMatch.getOffset(); final int nextOffset= nextMatch.getOffset();