mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 10:16:03 +02:00
Cosmetics.
This commit is contained in:
parent
8251ed4964
commit
7434fcbf4c
17 changed files with 170 additions and 205 deletions
|
@ -4646,8 +4646,7 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
|
|
||||||
// struct B {};
|
// struct B {};
|
||||||
// struct D : B {};
|
// struct D : B {};
|
||||||
// void foo(D* dp)
|
// void foo(D* dp) {
|
||||||
// {
|
|
||||||
// B* bp = dynamic_cast<B*>(dp);
|
// B* bp = dynamic_cast<B*>(dp);
|
||||||
// }
|
// }
|
||||||
public void testBug84466() throws Exception {
|
public void testBug84466() throws Exception {
|
||||||
|
@ -4663,8 +4662,7 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBug88338_CPP() throws Exception {
|
public void testBug88338_CPP() throws Exception {
|
||||||
IASTTranslationUnit tu = parse(
|
IASTTranslationUnit tu = parse("struct A; struct A* a;", CPP);
|
||||||
"struct A; struct A* a;", CPP);
|
|
||||||
NameCollector col = new NameCollector();
|
NameCollector col = new NameCollector();
|
||||||
tu.accept(col);
|
tu.accept(col);
|
||||||
|
|
||||||
|
@ -6265,8 +6263,8 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
// void xx() {
|
// void xx() {
|
||||||
// char* x= 0;
|
// char* x= 0;
|
||||||
// test1(x);
|
// test1(x);
|
||||||
// test2(x); // problem binding here
|
// test2(x);
|
||||||
// test3(x); // problem binding here
|
// test3(x);
|
||||||
// }
|
// }
|
||||||
public void testAdjustmentOfParameterTypes_239975() throws Exception {
|
public void testAdjustmentOfParameterTypes_239975() throws Exception {
|
||||||
parseAndCheckBindings(getAboveComment(), CPP);
|
parseAndCheckBindings(getAboveComment(), CPP);
|
||||||
|
@ -7239,16 +7237,15 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
// S(int);
|
// S(int);
|
||||||
// };
|
// };
|
||||||
// void test() {
|
// void test() {
|
||||||
// S **temp = new S*[1]; // problem on S
|
// S **temp = new S*[1];
|
||||||
// temp = new S*; // problem on S
|
// temp = new S*;
|
||||||
// temp = new (S*); // problem on S
|
// temp = new (S*);
|
||||||
// temp = new ::S*[1]; // problem on S
|
// temp = new ::S*[1];
|
||||||
// temp = new ::S*; // problem on S
|
// temp = new ::S*;
|
||||||
// temp = new (::S*); // problem on S
|
// temp = new (::S*);
|
||||||
// }
|
// }
|
||||||
public void testNewPointerOfClass_267168() throws Exception {
|
public void testNewPointerOfClass_267168() throws Exception {
|
||||||
final String code = getAboveComment();
|
parseAndCheckBindings();
|
||||||
parseAndCheckBindings(code, CPP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// void f(char *(names[2])= 0);
|
// void f(char *(names[2])= 0);
|
||||||
|
|
|
@ -20,22 +20,28 @@ public interface IASTEnumerationSpecifier extends IASTDeclSpecifier, IASTNameOwn
|
||||||
/**
|
/**
|
||||||
* This interface represents an enumerator member of an enum specifier.
|
* This interface represents an enumerator member of an enum specifier.
|
||||||
*
|
*
|
||||||
* @author jcamelon
|
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface IASTEnumerator extends IASTNode, IASTNameOwner {
|
public interface IASTEnumerator extends IASTNode, IASTNameOwner {
|
||||||
/**
|
/**
|
||||||
* Empty array (constant).
|
* Empty array (constant).
|
||||||
*/
|
*/
|
||||||
public static final IASTEnumerator[] EMPTY_ENUMERATOR_ARRAY = new IASTEnumerator[0];
|
public static final IASTEnumerator[] EMPTY_ENUMERATOR_ARRAY = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>ENUMERATOR_NAME</code> describes the relationship between
|
* {@code ENUMERATOR_NAME} describes the relationship between
|
||||||
* <code>IASTEnumerator</code> and <code>IASTName</code>.
|
* {@code IASTEnumerator} and {@code IASTName}.
|
||||||
*/
|
*/
|
||||||
public static final ASTNodeProperty ENUMERATOR_NAME = new ASTNodeProperty(
|
public static final ASTNodeProperty ENUMERATOR_NAME = new ASTNodeProperty(
|
||||||
"IASTEnumerator.ENUMERATOR_NAME - IASTName for IASTEnumerator"); //$NON-NLS-1$
|
"IASTEnumerator.ENUMERATOR_NAME - IASTName for IASTEnumerator"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code ENUMERATOR_VALUE} describes the relationship between
|
||||||
|
* {@code IASTEnumerator} and {@code IASTExpression}.
|
||||||
|
*/
|
||||||
|
public static final ASTNodeProperty ENUMERATOR_VALUE = new ASTNodeProperty(
|
||||||
|
"IASTEnumerator.ENUMERATOR_VALUE - IASTExpression (value) for IASTEnumerator"); //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the enumerator's name.
|
* Set the enumerator's name.
|
||||||
*
|
*
|
||||||
|
@ -46,17 +52,10 @@ public interface IASTEnumerationSpecifier extends IASTDeclSpecifier, IASTNameOwn
|
||||||
/**
|
/**
|
||||||
* Get the enumerator's name.
|
* Get the enumerator's name.
|
||||||
*
|
*
|
||||||
* @return <code>IASTName</code>
|
* @return {@code IASTName}
|
||||||
*/
|
*/
|
||||||
public IASTName getName();
|
public IASTName getName();
|
||||||
|
|
||||||
/**
|
|
||||||
* <code>ENUMERATOR_VALUE</code> describes the relationship between
|
|
||||||
* <code>IASTEnumerator</code> and <code>IASTExpression</code>.
|
|
||||||
*/
|
|
||||||
public static final ASTNodeProperty ENUMERATOR_VALUE = new ASTNodeProperty(
|
|
||||||
"IASTEnumerator.ENUMERATOR_VALUE - IASTExpression (value) for IASTEnumerator"); //$NON-NLS-1$
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets enumerator value.
|
* Sets enumerator value.
|
||||||
*
|
*
|
||||||
|
@ -67,7 +66,7 @@ public interface IASTEnumerationSpecifier extends IASTDeclSpecifier, IASTNameOwn
|
||||||
/**
|
/**
|
||||||
* Returns enumerator value.
|
* Returns enumerator value.
|
||||||
*
|
*
|
||||||
* @return <code>IASTExpression</code> value
|
* @return {@code IASTExpression} value
|
||||||
*/
|
*/
|
||||||
public IASTExpression getValue();
|
public IASTExpression getValue();
|
||||||
|
|
||||||
|
@ -82,13 +81,19 @@ public interface IASTEnumerationSpecifier extends IASTDeclSpecifier, IASTNameOwn
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public IASTEnumerator copy(CopyStyle style);
|
public IASTEnumerator copy(CopyStyle style);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>ENUMERATOR</code> describes the relationship between
|
* {@code ENUMERATION_NAME} describes the relationship between
|
||||||
* <code>IASTEnumerationSpecifier</code> and the nested
|
* {@code IASTEnumerationSpecifier} and its {@link IASTName}.
|
||||||
* <code>IASTEnumerator</code>s.
|
*/
|
||||||
|
public static final ASTNodeProperty ENUMERATION_NAME = new ASTNodeProperty(
|
||||||
|
"IASTEnumerationSpecifier.ENUMERATION_NAME - IASTName for IASTEnumerationSpecifier"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code ENUMERATOR} describes the relationship between
|
||||||
|
* {@code IASTEnumerationSpecifier} and the nested
|
||||||
|
* {@link IASTEnumerator}s.
|
||||||
*/
|
*/
|
||||||
public static final ASTNodeProperty ENUMERATOR = new ASTNodeProperty(
|
public static final ASTNodeProperty ENUMERATOR = new ASTNodeProperty(
|
||||||
"IASTEnumerationSpecifier.ENUMERATOR - nested IASTEnumerator for IASTEnumerationSpecifier"); //$NON-NLS-1$
|
"IASTEnumerationSpecifier.ENUMERATOR - nested IASTEnumerator for IASTEnumerationSpecifier"); //$NON-NLS-1$
|
||||||
|
@ -96,25 +101,17 @@ public interface IASTEnumerationSpecifier extends IASTDeclSpecifier, IASTNameOwn
|
||||||
/**
|
/**
|
||||||
* Adds an enumerator.
|
* Adds an enumerator.
|
||||||
*
|
*
|
||||||
* @param enumerator
|
* @param enumerator {@code IASTEnumerator}
|
||||||
* <code>IASTEnumerator</code>
|
|
||||||
*/
|
*/
|
||||||
public void addEnumerator(IASTEnumerator enumerator);
|
public void addEnumerator(IASTEnumerator enumerator);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns enumerators.
|
* Returns enumerators.
|
||||||
*
|
*
|
||||||
* @return <code>IASTEnumerator []</code> array
|
* @return {@code IASTEnumerator[]} array
|
||||||
*/
|
*/
|
||||||
public IASTEnumerator[] getEnumerators();
|
public IASTEnumerator[] getEnumerators();
|
||||||
|
|
||||||
/**
|
|
||||||
* <code>ENUMERATION_NAME</code> describes the relationship between
|
|
||||||
* <code>IASTEnumerationSpecifier</code> and its <code>IASTName</code>.
|
|
||||||
*/
|
|
||||||
public static final ASTNodeProperty ENUMERATION_NAME = new ASTNodeProperty(
|
|
||||||
"IASTEnumerationSpecifier.ENUMERATION_NAME - IASTName for IASTEnumerationSpecifier"); //$NON-NLS-1$
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the enum's name.
|
* Sets the enum's name.
|
||||||
*
|
*
|
||||||
|
@ -123,7 +120,7 @@ public interface IASTEnumerationSpecifier extends IASTDeclSpecifier, IASTNameOwn
|
||||||
public void setName(IASTName name);
|
public void setName(IASTName name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the enum's name.
|
* Returns the enum's name.
|
||||||
*/
|
*/
|
||||||
public IASTName getName();
|
public IASTName getName();
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ public interface IEnumeration extends IBinding, IType {
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
*/
|
*/
|
||||||
long getMinValue();
|
long getMinValue();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -14,14 +14,13 @@ import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code> enum struct : unsigned int {...}</code>
|
* <code>enum struct : unsigned int {...}</code>
|
||||||
*
|
*
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
* @noextend This interface is not intended to be extended by clients.
|
* @noextend This interface is not intended to be extended by clients.
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface ICPPASTEnumerationSpecifier extends IASTEnumerationSpecifier, ICPPASTDeclSpecifier {
|
public interface ICPPASTEnumerationSpecifier extends IASTEnumerationSpecifier, ICPPASTDeclSpecifier {
|
||||||
|
|
||||||
public static final ASTNodeProperty BASE_TYPE = new ASTNodeProperty(
|
public static final ASTNodeProperty BASE_TYPE = new ASTNodeProperty(
|
||||||
"ICPPASTEnumerationSpecifier.BASE_TYPE [ICPPASTDeclSpecifier]"); //$NON-NLS-1$
|
"ICPPASTEnumerationSpecifier.BASE_TYPE [ICPPASTDeclSpecifier]"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
@ -35,18 +34,17 @@ public interface ICPPASTEnumerationSpecifier extends IASTEnumerationSpecifier, I
|
||||||
public ICPPASTEnumerationSpecifier copy(CopyStyle style);
|
public ICPPASTEnumerationSpecifier copy(CopyStyle style);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Not allowed on frozen ast.
|
* Not allowed on frozen AST.
|
||||||
*/
|
*/
|
||||||
public void setIsScoped(boolean isScoped);
|
public void setIsScoped(boolean isScoped);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An enum is scoped if it uses the enumeration head
|
* An enum is scoped if it uses the enumeration head {@code enum class} or {@code enum struct}.
|
||||||
* <code>enum class</code> or <code>enum struct</code>
|
|
||||||
*/
|
*/
|
||||||
public boolean isScoped();
|
public boolean isScoped();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Not allowed on frozen ast.
|
* Not allowed on frozen AST.
|
||||||
*/
|
*/
|
||||||
public void setIsOpaque(boolean isOpaque);
|
public void setIsOpaque(boolean isOpaque);
|
||||||
|
|
||||||
|
@ -61,13 +59,13 @@ public interface ICPPASTEnumerationSpecifier extends IASTEnumerationSpecifier, I
|
||||||
public void setBaseType(ICPPASTDeclSpecifier baseType);
|
public void setBaseType(ICPPASTDeclSpecifier baseType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the base type for this enum or <code>null</code> if it was not specified.
|
* Returns the base type for this enum or {@code null} if it was not specified.
|
||||||
*/
|
*/
|
||||||
public ICPPASTDeclSpecifier getBaseType();
|
public ICPPASTDeclSpecifier getBaseType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the scope containing the enumerators of this enumeration, or <code>null</code> if the specifier
|
* Returns the scope containing the enumerators of this enumeration,
|
||||||
* is opaque.
|
* or {@code null} if the specifier is opaque.
|
||||||
*/
|
*/
|
||||||
public ICPPScope getScope();
|
public ICPPScope getScope();
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,7 @@ public abstract class ASTEnumerator extends ASTNode implements IASTEnumerator, I
|
||||||
IASTNode parent= getParent();
|
IASTNode parent= getParent();
|
||||||
if (parent instanceof IASTInternalEnumerationSpecifier) {
|
if (parent instanceof IASTInternalEnumerationSpecifier) {
|
||||||
IASTInternalEnumerationSpecifier ies= (IASTInternalEnumerationSpecifier) parent;
|
IASTInternalEnumerationSpecifier ies= (IASTInternalEnumerationSpecifier) parent;
|
||||||
if (ies.startValueComputation()) { // prevents infinite recursions
|
if (ies.startValueComputation()) { // Prevent infinite recursion.
|
||||||
createEnumValues((IASTEnumerationSpecifier) parent);
|
createEnumValues((IASTEnumerationSpecifier) parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -340,7 +340,7 @@ public abstract class ArithmeticConversion {
|
||||||
if (basicTarget.isShort()) {
|
if (basicTarget.isShort()) {
|
||||||
return Short.MIN_VALUE <= n && n <= Short.MAX_VALUE;
|
return Short.MIN_VALUE <= n && n <= Short.MAX_VALUE;
|
||||||
}
|
}
|
||||||
// Can't represent long longs with java longs.
|
// Can't represent long longs with Java longs.
|
||||||
if (basicTarget.isLong() || basicTarget.isLongLong()) {
|
if (basicTarget.isLong() || basicTarget.isLongLong()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -352,7 +352,7 @@ public abstract class ArithmeticConversion {
|
||||||
if (basicTarget.isShort()) {
|
if (basicTarget.isShort()) {
|
||||||
return n < (Short.MAX_VALUE + 1L) * 2;
|
return n < (Short.MAX_VALUE + 1L) * 2;
|
||||||
}
|
}
|
||||||
// Can't represent long longs with java longs.
|
// Can't represent long longs with Java longs.
|
||||||
if (basicTarget.isLong() || basicTarget.isLongLong()) {
|
if (basicTarget.isLong() || basicTarget.isLongLong()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -419,9 +419,10 @@ public abstract class ArithmeticConversion {
|
||||||
long sizeofSource = sourceSizeAndAlignment == null ? getApproximateSize(source) : sourceSizeAndAlignment.size;
|
long sizeofSource = sourceSizeAndAlignment == null ? getApproximateSize(source) : sourceSizeAndAlignment.size;
|
||||||
long sizeofTarget = targetSizeAndAlignment == null ? getApproximateSize(target) : targetSizeAndAlignment.size;
|
long sizeofTarget = targetSizeAndAlignment == null ? getApproximateSize(target) : targetSizeAndAlignment.size;
|
||||||
|
|
||||||
if (sizeofSource == sizeofTarget)
|
if (sizeofSource == sizeofTarget) {
|
||||||
return target.isUnsigned() == source.isUnsigned();
|
return target.isUnsigned() == source.isUnsigned();
|
||||||
else
|
} else {
|
||||||
return sizeofSource < sizeofTarget;
|
return sizeofSource < sizeofTarget;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier;
|
||||||
*/
|
*/
|
||||||
public interface IASTInternalEnumerationSpecifier extends IASTEnumerationSpecifier {
|
public interface IASTInternalEnumerationSpecifier extends IASTEnumerationSpecifier {
|
||||||
/**
|
/**
|
||||||
* Notifies that the value computation for the enumeration is started. Returns whether this is
|
* Notifies that the value computation for the enumeration has started. Returns whether this is
|
||||||
* the first attempt to do so.
|
* the first attempt to do so.
|
||||||
*/
|
*/
|
||||||
boolean startValueComputation();
|
boolean startValueComputation();
|
||||||
|
|
|
@ -23,10 +23,8 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTInternalEnumerationSpecifier
|
||||||
*/
|
*/
|
||||||
public class CASTEnumerationSpecifier extends CASTBaseDeclSpecifier
|
public class CASTEnumerationSpecifier extends CASTBaseDeclSpecifier
|
||||||
implements IASTInternalEnumerationSpecifier, ICASTEnumerationSpecifier {
|
implements IASTInternalEnumerationSpecifier, ICASTEnumerationSpecifier {
|
||||||
|
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
private boolean valuesComputed= false;
|
private boolean valuesComputed;
|
||||||
|
|
||||||
|
|
||||||
public CASTEnumerationSpecifier() {
|
public CASTEnumerationSpecifier() {
|
||||||
}
|
}
|
||||||
|
@ -54,7 +52,6 @@ public class CASTEnumerationSpecifier extends CASTBaseDeclSpecifier
|
||||||
return super.copy(copy, style);
|
return super.copy(copy, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean startValueComputation() {
|
public boolean startValueComputation() {
|
||||||
if (valuesComputed)
|
if (valuesComputed)
|
||||||
|
@ -70,20 +67,19 @@ public class CASTEnumerationSpecifier extends CASTBaseDeclSpecifier
|
||||||
if (enumerator != null) {
|
if (enumerator != null) {
|
||||||
enumerator.setParent(this);
|
enumerator.setParent(this);
|
||||||
enumerator.setPropertyInParent(ENUMERATOR);
|
enumerator.setPropertyInParent(ENUMERATOR);
|
||||||
enumerators = ArrayUtil.appendAt( IASTEnumerator.class, enumerators, ++enumeratorsPos, enumerator );
|
enumerators = ArrayUtil.appendAt(IASTEnumerator.class, enumerators, ++enumeratorsPos, enumerator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IASTEnumerator[] getEnumerators() {
|
public IASTEnumerator[] getEnumerators() {
|
||||||
if( enumerators == null ) return IASTEnumerator.EMPTY_ENUMERATOR_ARRAY;
|
if (enumerators == null) return IASTEnumerator.EMPTY_ENUMERATOR_ARRAY;
|
||||||
enumerators = ArrayUtil.trimAt( IASTEnumerator.class, enumerators, enumeratorsPos );
|
enumerators = ArrayUtil.trimAt(IASTEnumerator.class, enumerators, enumeratorsPos);
|
||||||
return enumerators;
|
return enumerators;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IASTEnumerator [] enumerators = null;
|
private IASTEnumerator [] enumerators = null;
|
||||||
private int enumeratorsPos=-1;
|
private int enumeratorsPos = -1;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -102,34 +98,35 @@ public class CASTEnumerationSpecifier extends CASTBaseDeclSpecifier
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept(ASTVisitor action) {
|
||||||
if( action.shouldVisitDeclSpecifiers ){
|
if (action.shouldVisitDeclSpecifiers) {
|
||||||
switch( action.visit( this ) ){
|
switch(action.visit(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( name != null ) if( !name.accept( action ) ) return false;
|
if (name != null && !name.accept(action))
|
||||||
|
return false;
|
||||||
IASTEnumerator[] etors = getEnumerators();
|
IASTEnumerator[] etors = getEnumerators();
|
||||||
for ( int i = 0; i < etors.length; i++ ) {
|
for (int i = 0; i < etors.length; i++) {
|
||||||
if( !etors[i].accept( action ) ) return false;
|
if (!etors[i].accept(action))
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if( action.shouldVisitDeclSpecifiers ){
|
if (action.shouldVisitDeclSpecifiers) {
|
||||||
switch( action.leave( this ) ){
|
switch(action.leave(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRoleForName(IASTName n ) {
|
public int getRoleForName(IASTName n) {
|
||||||
if( this.name == n )
|
if (this.name == n)
|
||||||
return r_definition;
|
return r_definition;
|
||||||
return r_unclear;
|
return r_unclear;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,8 +52,8 @@ public class CPPASTEnumerationSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CPPASTEnumerationSpecifier copy(CopyStyle style) {
|
public CPPASTEnumerationSpecifier copy(CopyStyle style) {
|
||||||
CPPASTEnumerationSpecifier copy =
|
CPPASTEnumerationSpecifier copy = new CPPASTEnumerationSpecifier(fIsScoped,
|
||||||
new CPPASTEnumerationSpecifier(fIsScoped, fName == null ? null : fName.copy(style),
|
fName == null ? null : fName.copy(style),
|
||||||
fBaseType == null ? null : fBaseType.copy(style));
|
fBaseType == null ? null : fBaseType.copy(style));
|
||||||
copy.fIsOpaque = fIsOpaque;
|
copy.fIsOpaque = fIsOpaque;
|
||||||
for (IASTEnumerator enumerator : getEnumerators()) {
|
for (IASTEnumerator enumerator : getEnumerators()) {
|
||||||
|
|
|
@ -89,6 +89,7 @@ public class CPPBaseClause implements ICPPBase, ICPPInternalBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
public IName getBaseClassSpecifierName() {
|
public IName getBaseClassSpecifierName() {
|
||||||
return base.getName();
|
return base.getName();
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ public class CPPDeferredFunction extends CPPUnknownBinding implements ICPPDeferr
|
||||||
* Creates a CPPDeferredFunction given a set of overloaded functions
|
* Creates a CPPDeferredFunction given a set of overloaded functions
|
||||||
* (some of which may be templates) that the function might resolve to.
|
* (some of which may be templates) that the function might resolve to.
|
||||||
* At least one candidate must be provided.
|
* At least one candidate must be provided.
|
||||||
|
*
|
||||||
* @param candidates a set of overloaded functions, some of which may be templates
|
* @param candidates a set of overloaded functions, some of which may be templates
|
||||||
* @return the constructed CPPDeferredFunction
|
* @return the constructed CPPDeferredFunction
|
||||||
*/
|
*/
|
||||||
|
@ -47,7 +48,8 @@ public class CPPDeferredFunction extends CPPUnknownBinding implements ICPPDeferr
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a CPPDeferredFunction given a name. This is for cases where there
|
* Creates a CPPDeferredFunction given a name. This is for cases where there
|
||||||
* are no candidates that could be passed to createForCandidates().
|
* are no candidates that could be passed to {@link #createForCandidates}.
|
||||||
|
*
|
||||||
* @param name the name of the function
|
* @param name the name of the function
|
||||||
* @return the constructed CPPDeferredFunction
|
* @return the constructed CPPDeferredFunction
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -47,7 +47,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
|
||||||
import org.eclipse.core.runtime.PlatformObject;
|
import org.eclipse.core.runtime.PlatformObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enumerations in C++
|
* Enumeration in C++
|
||||||
*/
|
*/
|
||||||
public class CPPEnumeration extends PlatformObject implements ICPPEnumeration, ICPPInternalBinding {
|
public class CPPEnumeration extends PlatformObject implements ICPPEnumeration, ICPPInternalBinding {
|
||||||
private static final IASTName NOT_INITIALIZED = CPPASTName.NOT_INITIALIZED;
|
private static final IASTName NOT_INITIALIZED = CPPASTName.NOT_INITIALIZED;
|
||||||
|
@ -90,8 +90,8 @@ public class CPPEnumeration extends PlatformObject implements ICPPEnumeration, I
|
||||||
private Long fMaxValue;
|
private Long fMaxValue;
|
||||||
private Long fMinValue;
|
private Long fMinValue;
|
||||||
|
|
||||||
private ICPPEnumeration fIndexBinding= null;
|
private ICPPEnumeration fIndexBinding;
|
||||||
private boolean fSearchedIndex= false;
|
private boolean fSearchedIndex;
|
||||||
|
|
||||||
public CPPEnumeration(ICPPASTEnumerationSpecifier spec, IType fixedType) {
|
public CPPEnumeration(ICPPASTEnumerationSpecifier spec, IType fixedType) {
|
||||||
final IASTName name = spec.getName();
|
final IASTName name = spec.getName();
|
||||||
|
|
|
@ -43,56 +43,35 @@ public class CPPEnumerator extends PlatformObject implements IEnumerator, ICPPIn
|
||||||
enumerator.setBinding(this);
|
enumerator.setBinding(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPBinding#getDeclarations()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IASTNode[] getDeclarations() {
|
public IASTNode[] getDeclarations() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPBinding#getDefinition()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IASTNode getDefinition() {
|
public IASTNode getDefinition() {
|
||||||
return enumName;
|
return enumName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getName()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return new String(getNameCharArray());
|
return new String(getNameCharArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getNameCharArray()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public char[] getNameCharArray() {
|
public char[] getNameCharArray() {
|
||||||
return enumName.getSimpleID();
|
return enumName.getSimpleID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getScope()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IScope getScope() {
|
public IScope getScope() {
|
||||||
return CPPVisitor.getContainingScope(enumName);
|
return CPPVisitor.getContainingScope(enumName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getPhysicalNode()
|
|
||||||
*/
|
|
||||||
public IASTNode getPhysicalNode() {
|
public IASTNode getPhysicalNode() {
|
||||||
return enumName;
|
return enumName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IEnumerator#getType()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IType getType() {
|
public IType getType() {
|
||||||
IASTEnumerator etor = (IASTEnumerator) enumName.getParent();
|
IASTEnumerator etor = (IASTEnumerator) enumName.getParent();
|
||||||
|
@ -100,25 +79,16 @@ public class CPPEnumerator extends PlatformObject implements IEnumerator, ICPPIn
|
||||||
return (IType) enumSpec.getName().resolveBinding();
|
return (IType) enumSpec.getName().resolveBinding();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getFullyQualifiedName()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getQualifiedName() {
|
public String[] getQualifiedName() {
|
||||||
return CPPVisitor.getQualifiedName(this);
|
return CPPVisitor.getQualifiedName(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getFullyQualifiedNameCharArray()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public char[][] getQualifiedNameCharArray() {
|
public char[][] getQualifiedNameCharArray() {
|
||||||
return CPPVisitor.getQualifiedNameCharArray(this);
|
return CPPVisitor.getQualifiedNameCharArray(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding#isGloballyQualified()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isGloballyQualified() throws DOMException {
|
public boolean isGloballyQualified() throws DOMException {
|
||||||
IScope scope = getScope();
|
IScope scope = getScope();
|
||||||
|
|
|
@ -88,7 +88,7 @@ public interface ICPPEvaluation extends ISerializableEvaluation {
|
||||||
/**
|
/**
|
||||||
* Keeps track of state during a constexpr evaluation.
|
* Keeps track of state during a constexpr evaluation.
|
||||||
*/
|
*/
|
||||||
class ConstexprEvaluationContext {
|
final class ConstexprEvaluationContext {
|
||||||
/**
|
/**
|
||||||
* The maximum number of steps allowed in a single constexpr evaluation.
|
* The maximum number of steps allowed in a single constexpr evaluation.
|
||||||
* This is used to prevent a buggy constexpr function from causing the
|
* This is used to prevent a buggy constexpr function from causing the
|
||||||
|
@ -100,7 +100,7 @@ public interface ICPPEvaluation extends ISerializableEvaluation {
|
||||||
private IASTNode fPoint;
|
private IASTNode fPoint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a ConstexprEvaluationContext for a new constexpr evaluation.
|
* Constructs a ConstexprEvaluationContext for a new constexpr evaluation.
|
||||||
* @param point the point of instantiation, determines the scope for name lookups
|
* @param point the point of instantiation, determines the scope for name lookups
|
||||||
*/
|
*/
|
||||||
public ConstexprEvaluationContext(IASTNode point) {
|
public ConstexprEvaluationContext(IASTNode point) {
|
||||||
|
@ -109,7 +109,8 @@ public interface ICPPEvaluation extends ISerializableEvaluation {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Record a new step being performed in this constexpr evaluation.
|
* Records a new step being performed in this constexpr evaluation.
|
||||||
|
*
|
||||||
* @return this constexpr evaluation
|
* @return this constexpr evaluation
|
||||||
*/
|
*/
|
||||||
public ConstexprEvaluationContext recordStep() {
|
public ConstexprEvaluationContext recordStep() {
|
||||||
|
@ -118,14 +119,14 @@ public interface ICPPEvaluation extends ISerializableEvaluation {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of steps performed so far in the constexpr evaluation.
|
* Returns the number of steps performed so far in the constexpr evaluation.
|
||||||
*/
|
*/
|
||||||
public int getStepsPerformed() {
|
public int getStepsPerformed() {
|
||||||
return fStepsPerformed;
|
return fStepsPerformed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the point of instantiation.
|
* Returns the point of instantiation.
|
||||||
*/
|
*/
|
||||||
public IASTNode getPoint() {
|
public IASTNode getPoint() {
|
||||||
return fPoint;
|
return fPoint;
|
||||||
|
|
|
@ -982,7 +982,7 @@ public class CPPTemplates {
|
||||||
spec = enumSpec.specializeEnumerator(enumerator);
|
spec = enumSpec.specializeEnumerator(enumerator);
|
||||||
} else if (decl instanceof ICPPUsingDeclaration) {
|
} else if (decl instanceof ICPPUsingDeclaration) {
|
||||||
IBinding[] delegates= ((ICPPUsingDeclaration) decl).getDelegates();
|
IBinding[] delegates= ((ICPPUsingDeclaration) decl).getDelegates();
|
||||||
List<IBinding> result= new ArrayList<IBinding>();
|
List<IBinding> result= new ArrayList<>();
|
||||||
ICPPClassSpecialization within = getSpecializationContext(owner);
|
ICPPClassSpecialization within = getSpecializationContext(owner);
|
||||||
for (IBinding delegate : delegates) {
|
for (IBinding delegate : delegates) {
|
||||||
try {
|
try {
|
||||||
|
@ -2853,7 +2853,7 @@ public class CPPTemplates {
|
||||||
if (keys.length == 0)
|
if (keys.length == 0)
|
||||||
return ObjectMap.EMPTY_MAP;
|
return ObjectMap.EMPTY_MAP;
|
||||||
|
|
||||||
List<ICPPTemplateDefinition> defs= new ArrayList<ICPPTemplateDefinition>();
|
List<ICPPTemplateDefinition> defs= new ArrayList<>();
|
||||||
IBinding owner= b;
|
IBinding owner= b;
|
||||||
while (owner != null) {
|
while (owner != null) {
|
||||||
if (owner instanceof ICPPTemplateDefinition) {
|
if (owner instanceof ICPPTemplateDefinition) {
|
||||||
|
|
|
@ -165,20 +165,20 @@ public class TypeTraits {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns <code>true</code> if and only if the given class has a trivial copy constructor.
|
* Returns {@code true} if and only if the given class has a trivial copy constructor.
|
||||||
* A copy constructor is trivial if:
|
* A copy constructor is trivial if:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>it is implicitly defined by the compiler, and</li>
|
* <li>it is implicitly defined by the compiler, and</li>
|
||||||
* <li><code>isPolymorphic(classType) is false</code>, and</li>
|
* <li>{@code isPolymorphic(classType)} is {@code false}, and</li>
|
||||||
* <li>the class has no virtual base classes, and</li>
|
* <li>the class has no virtual base classes, and</li>
|
||||||
* <li>every direct base class has trivial copy constructor, and</li>
|
* <li>every direct base class has trivial copy constructor, and</li>
|
||||||
* <li>for every nonstatic data member that has class type or array of class type, that type
|
* <li>for every nonstatic data member that has class type or array of class type, that type
|
||||||
* has trivial copy constructor.</li>
|
* has trivial copy constructor.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* Similar to <code>std::tr1::has_trivial_copy</code>.
|
* Similar to {@code std::tr1::has_trivial_copy}.
|
||||||
*
|
*
|
||||||
* @param classType the class to check
|
* @param classType the class to check
|
||||||
* @return <code>true</code> if the class has a trivial copy constructor
|
* @return {@code true} if the class has a trivial copy constructor
|
||||||
*/
|
*/
|
||||||
public static boolean hasTrivialCopyCtor(ICPPClassType classType, IASTNode point) {
|
public static boolean hasTrivialCopyCtor(ICPPClassType classType, IASTNode point) {
|
||||||
if (getImplicitCopyCtor(classType, point) == null)
|
if (getImplicitCopyCtor(classType, point) == null)
|
||||||
|
@ -207,7 +207,7 @@ public class TypeTraits {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns <code>true</code> if and only if the given class has a trivial default constructor.
|
* Returns {@code true} if and only if the given class has a trivial default constructor.
|
||||||
* A default constructor is trivial if:
|
* A default constructor is trivial if:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>it is implicitly defined by the compiler, and</li>
|
* <li>it is implicitly defined by the compiler, and</li>
|
||||||
|
@ -215,11 +215,11 @@ public class TypeTraits {
|
||||||
* <li>for every nonstatic data member that has class type or array of class type, that type
|
* <li>for every nonstatic data member that has class type or array of class type, that type
|
||||||
* has trivial default constructor.</li>
|
* has trivial default constructor.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* Similar to <code>std::tr1::has_trivial_default_constructor</code>.
|
* Similar to {@code std::tr1::has_trivial_default_constructor}.
|
||||||
*
|
*
|
||||||
* @param classType the class to check
|
* @param classType the class to check
|
||||||
* @param point
|
* @param point
|
||||||
* @return <code>true</code> if the class has a trivial default constructor
|
* @return {@code true} if the class has a trivial default constructor
|
||||||
*/
|
*/
|
||||||
public static boolean hasTrivialDefaultConstructor(ICPPClassType classType, IASTNode point) {
|
public static boolean hasTrivialDefaultConstructor(ICPPClassType classType, IASTNode point) {
|
||||||
for (ICPPConstructor ctor : ClassTypeHelper.getConstructors(classType, point)) {
|
for (ICPPConstructor ctor : ClassTypeHelper.getConstructors(classType, point)) {
|
||||||
|
@ -244,7 +244,7 @@ public class TypeTraits {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns <code>true</code> if and only if the given class has a trivial destructor.
|
* Returns {@code true} if and only if the given class has a trivial destructor.
|
||||||
* A destructor is trivial if:
|
* A destructor is trivial if:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>it is implicitly defined by the compiler, and</li>
|
* <li>it is implicitly defined by the compiler, and</li>
|
||||||
|
@ -252,10 +252,10 @@ public class TypeTraits {
|
||||||
* <li>for every nonstatic data member that has class type or array of class type, that type
|
* <li>for every nonstatic data member that has class type or array of class type, that type
|
||||||
* has trivial destructor.</li>
|
* has trivial destructor.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* Similar to <code>std::tr1::has_trivial_destructor</code>.
|
* Similar to {@code std::tr1::has_trivial_destructor}.
|
||||||
*
|
*
|
||||||
* @param classType the class to check
|
* @param classType the class to check
|
||||||
* @return <code>true</code> if the class has a trivial destructor
|
* @return {@code true} if the class has a trivial destructor
|
||||||
*/
|
*/
|
||||||
public static boolean hasTrivialDestructor(ICPPClassType classType, IASTNode point) {
|
public static boolean hasTrivialDestructor(ICPPClassType classType, IASTNode point) {
|
||||||
for (ICPPMethod method : ClassTypeHelper.getDeclaredMethods(classType, point)) {
|
for (ICPPMethod method : ClassTypeHelper.getDeclaredMethods(classType, point)) {
|
||||||
|
@ -280,11 +280,11 @@ public class TypeTraits {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns <code>true</code> if and only if the given class declares or inherits a virtual
|
* Returns {@code true} if and only if the given class declares or inherits a virtual
|
||||||
* function. Similar to <code>std::tr1::is_polymorphic</code>.
|
* function. Similar to {@code std::tr1::is_polymorphic}.
|
||||||
*
|
*
|
||||||
* @param classType the class to check
|
* @param classType the class to check
|
||||||
* @return <code>true</code> if the class declares or inherits a virtual function.
|
* @return {@code true} if the class declares or inherits a virtual function.
|
||||||
*/
|
*/
|
||||||
public static boolean isPolymorphic(ICPPClassType classType, IASTNode point) {
|
public static boolean isPolymorphic(ICPPClassType classType, IASTNode point) {
|
||||||
if (hasDeclaredVirtualMethod(classType, point))
|
if (hasDeclaredVirtualMethod(classType, point))
|
||||||
|
@ -310,11 +310,11 @@ public class TypeTraits {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the compiler-generated copy constructor for the given class, or <code>null</code>
|
* Returns the compiler-generated copy constructor for the given class, or {@code null}
|
||||||
* if the class doesn't have a compiler-generated copy constructor.
|
* if the class doesn't have a compiler-generated copy constructor.
|
||||||
*
|
*
|
||||||
* @param classType the class to get the copy ctor for.
|
* @param classType the class to get the copy ctor for.
|
||||||
* @return the compiler-generated copy constructor, or <code>null</code> if the class doesn't
|
* @return the compiler-generated copy constructor, or {@code null} if the class doesn't
|
||||||
* have a compiler-generated copy constructor.
|
* have a compiler-generated copy constructor.
|
||||||
*/
|
*/
|
||||||
private static ICPPConstructor getImplicitCopyCtor(ICPPClassType classType, IASTNode point) {
|
private static ICPPConstructor getImplicitCopyCtor(ICPPClassType classType, IASTNode point) {
|
||||||
|
@ -387,6 +387,6 @@ public class TypeTraits {
|
||||||
return types[i];
|
return types[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return types[types.length - 1]; // assume it fits into the largest type provided
|
return types[types.length - 1]; // Assume it fits into the largest type provided.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue