1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2011-09-20 17:36:01 -07:00
parent 4f80345f71
commit 83124590a9
12 changed files with 76 additions and 70 deletions

View file

@ -1596,6 +1596,22 @@ public abstract class IndexCPPBindingResolutionTest extends IndexBindingResoluti
assertEquals("ns", ref.getOwner().getName());
}
// class A {};
// void f(A a) {}
// struct B {};
// void g(B b) {}
// struct A;
// class B;
//
// void test(A a, B b) {
// f(a);
// g(b);
// }
public void testStructClassMismatch_358282() throws Exception {
getBindingFromASTName("f(a)", 1, ICPPFunction.class);
getBindingFromASTName("g(b)", 1, ICPPFunction.class);
}
/* CPP assertion helpers */
/* ##################################################################### */

View file

@ -21,7 +21,7 @@ import org.eclipse.cdt.core.dom.ast.IField;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICPPClassType extends ICompositeType, ICPPBinding {
public static final ICPPClassType[] EMPTY_CLASS_ARRAY = new ICPPClassType[0];
public static final ICPPClassType[] EMPTY_CLASS_ARRAY = {};
public static final int k_class = ICPPASTCompositeTypeSpecifier.k_class;
/**

View file

@ -208,8 +208,9 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
* @see org.eclipse.cdt.core.dom.ast.ICompositeType#getKey()
*/
public int getKey() {
return (definition != null) ? ((IASTCompositeTypeSpecifier) definition.getParent()).getKey()
: ((IASTElaboratedTypeSpecifier) declarations[0].getParent()).getKind();
return definition != null ?
((IASTCompositeTypeSpecifier) definition.getParent()).getKey() :
((IASTElaboratedTypeSpecifier) declarations[0].getParent()).getKind();
}
/*

View file

@ -222,7 +222,6 @@ public class CPPClassSpecialization extends CPPSpecialization
return scope.getNestedClasses();
}
public IField[] getFields() {
return ClassTypeHelper.getFields(this);
}
@ -239,7 +238,6 @@ public class CPPClassSpecialization extends CPPSpecialization
return ClassTypeHelper.getAllDeclaredMethods(this);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.ICompositeType#getKey()
*/
@ -247,7 +245,7 @@ public class CPPClassSpecialization extends CPPSpecialization
if (getDefinition() != null)
return getCompositeTypeSpecifier().getKey();
return (getSpecializedBinding()).getKey();
return getSpecializedBinding().getKey();
}
/* (non-Javadoc)
@ -316,7 +314,6 @@ public class CPPClassSpecialization extends CPPSpecialization
return false;
}
public static boolean isSameClassSpecialization(ICPPClassSpecialization t1, ICPPClassSpecialization t2) {
// exclude class template specialization or class instance
if (t2 instanceof ICPPTemplateInstance || t2 instanceof ICPPTemplateDefinition ||

View file

@ -280,7 +280,7 @@ public class CPPClassType extends PlatformObject implements ICPPInternalClassTyp
}
public IASTNode getPhysicalNode() {
return (definition != null) ? (IASTNode) definition : declarations[0];
return definition != null ? (IASTNode) definition : declarations[0];
}
public int getKey() {
@ -306,7 +306,7 @@ public class CPPClassType extends PlatformObject implements ICPPInternalClassTyp
return;
}
//keep the lowest offset declaration in [0]
// Keep the lowest offset declaration in [0]
if (declarations.length > 0 && ((ASTNode)node).getOffset() < ((ASTNode) declarations[0]).getOffset()) {
declarations = (IASTName[]) ArrayUtil.prepend(IASTName.class, declarations, name);
} else {

View file

@ -30,12 +30,12 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
* Represents a instantiation that cannot be performed because of dependent arguments or an unknown template.
*/
public class CPPDeferredClassInstance extends CPPUnknownClass implements ICPPDeferredClassInstance {
private final ICPPTemplateArgument[] fArguments;
private final ICPPClassTemplate fClassTemplate;
private final ICPPScope fLookupScope;
public CPPDeferredClassInstance(ICPPClassTemplate template, ICPPTemplateArgument[] arguments, ICPPScope lookupScope) throws DOMException {
public CPPDeferredClassInstance(ICPPClassTemplate template, ICPPTemplateArgument[] arguments,
ICPPScope lookupScope) throws DOMException {
// With template template parameters the owner must not be calculated, it'd lead to an infinite loop.
// Rather than that we override getOwner().
super(null, template.getNameCharArray());
@ -48,7 +48,6 @@ public class CPPDeferredClassInstance extends CPPUnknownClass implements ICPPDef
this(template, arguments, null);
}
@Override
public IBinding getOwner() {
return fClassTemplate.getOwner();

View file

@ -49,7 +49,9 @@ class CompositeCStructure extends CompositeCBinding implements ICompositeType, I
}
@Override
public Object clone() {fail(); return null;}
public Object clone() {
fail(); return null;
}
public boolean isAnonymous() {
return ((ICompositeType) rbinding).isAnonymous();

View file

@ -63,8 +63,8 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements
private volatile ICPPClassScope fScope;
private ObjectMap specializationMap= null; // Obtained from the synchronized PDOM cache
public PDOMCPPClassSpecialization(PDOMLinkage linkage, PDOMNode parent, ICPPClassType classType, PDOMBinding specialized)
throws CoreException {
public PDOMCPPClassSpecialization(PDOMLinkage linkage, PDOMNode parent, ICPPClassType classType,
PDOMBinding specialized) throws CoreException {
super(linkage, parent, (ICPPSpecialization) classType, specialized);
}
@ -177,8 +177,7 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements
if (base != null) {
if (predecessor != null) {
predecessor.setNextBase(base.getNextBase());
}
else {
} else {
setFirstBase(base.getNextBase());
}
base.delete();
@ -294,7 +293,7 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements
}
public int getKey() {
return (getSpecializedBinding()).getKey();
return getSpecializedBinding().getKey();
}
public boolean isSameType(IType type) {

View file

@ -45,19 +45,13 @@ import org.eclipse.core.runtime.CoreException;
/**
* @author Doug Schaefer
*
*/
class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDOMMemberOwner {
private static final int FIRSTBASE = PDOMCPPBinding.RECORD_SIZE + 0;
private static final int MEMBERLIST = PDOMCPPBinding.RECORD_SIZE + 4;
private static final int FIRSTFRIEND = PDOMCPPBinding.RECORD_SIZE + 8;
private static final int KEY = PDOMCPPBinding.RECORD_SIZE + 12; // byte
private static final int ANONYMOUS= PDOMCPPBinding.RECORD_SIZE + 13; // byte
@SuppressWarnings("hiding")
protected static final int RECORD_SIZE = PDOMCPPBinding.RECORD_SIZE + 14;
@ -163,8 +157,7 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO
if (base != null) {
if (predecessor != null) {
predecessor.setNextBase(base.getNextBase());
}
else {
} else {
setFirstBase(base.getNextBase());
}
base.delete();
@ -202,8 +195,7 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO
if (friend != null) {
if (predecessor != null) {
predecessor.setNextFriend(friend.getNextFriend());
}
else {
} else {
setFirstFriend(friend.getNextFriend());
}
friend.delete();