mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +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 D : B {};
|
||||
// void foo(D* dp)
|
||||
// {
|
||||
// void foo(D* dp) {
|
||||
// B* bp = dynamic_cast<B*>(dp);
|
||||
// }
|
||||
public void testBug84466() throws Exception {
|
||||
|
@ -4663,8 +4662,7 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
}
|
||||
|
||||
public void testBug88338_CPP() throws Exception {
|
||||
IASTTranslationUnit tu = parse(
|
||||
"struct A; struct A* a;", CPP);
|
||||
IASTTranslationUnit tu = parse("struct A; struct A* a;", CPP);
|
||||
NameCollector col = new NameCollector();
|
||||
tu.accept(col);
|
||||
|
||||
|
@ -6265,8 +6263,8 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
// void xx() {
|
||||
// char* x= 0;
|
||||
// test1(x);
|
||||
// test2(x); // problem binding here
|
||||
// test3(x); // problem binding here
|
||||
// test2(x);
|
||||
// test3(x);
|
||||
// }
|
||||
public void testAdjustmentOfParameterTypes_239975() throws Exception {
|
||||
parseAndCheckBindings(getAboveComment(), CPP);
|
||||
|
@ -7239,16 +7237,15 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
// S(int);
|
||||
// };
|
||||
// void test() {
|
||||
// S **temp = new S*[1]; // problem on S
|
||||
// temp = new S*; // problem on S
|
||||
// temp = new (S*); // problem on S
|
||||
// temp = new ::S*[1]; // problem on S
|
||||
// temp = new ::S*; // problem on S
|
||||
// temp = new (::S*); // problem on S
|
||||
// S **temp = new S*[1];
|
||||
// temp = new S*;
|
||||
// temp = new (S*);
|
||||
// temp = new ::S*[1];
|
||||
// temp = new ::S*;
|
||||
// temp = new (::S*);
|
||||
// }
|
||||
public void testNewPointerOfClass_267168() throws Exception {
|
||||
final String code = getAboveComment();
|
||||
parseAndCheckBindings(code, CPP);
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// 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.
|
||||
*
|
||||
* @author jcamelon
|
||||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
*/
|
||||
public interface IASTEnumerator extends IASTNode, IASTNameOwner {
|
||||
/**
|
||||
* 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>IASTEnumerator</code> and <code>IASTName</code>.
|
||||
* {@code ENUMERATOR_NAME} describes the relationship between
|
||||
* {@code IASTEnumerator} and {@code IASTName}.
|
||||
*/
|
||||
public static final ASTNodeProperty ENUMERATOR_NAME = new ASTNodeProperty(
|
||||
"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.
|
||||
*
|
||||
|
@ -46,17 +52,10 @@ public interface IASTEnumerationSpecifier extends IASTDeclSpecifier, IASTNameOwn
|
|||
/**
|
||||
* Get the enumerator's name.
|
||||
*
|
||||
* @return <code>IASTName</code>
|
||||
* @return {@code IASTName}
|
||||
*/
|
||||
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.
|
||||
*
|
||||
|
@ -67,7 +66,7 @@ public interface IASTEnumerationSpecifier extends IASTDeclSpecifier, IASTNameOwn
|
|||
/**
|
||||
* Returns enumerator value.
|
||||
*
|
||||
* @return <code>IASTExpression</code> value
|
||||
* @return {@code IASTExpression} value
|
||||
*/
|
||||
public IASTExpression getValue();
|
||||
|
||||
|
@ -82,13 +81,19 @@ public interface IASTEnumerationSpecifier extends IASTDeclSpecifier, IASTNameOwn
|
|||
*/
|
||||
@Override
|
||||
public IASTEnumerator copy(CopyStyle style);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* <code>ENUMERATOR</code> describes the relationship between
|
||||
* <code>IASTEnumerationSpecifier</code> and the nested
|
||||
* <code>IASTEnumerator</code>s.
|
||||
* {@code ENUMERATION_NAME} describes the relationship between
|
||||
* {@code IASTEnumerationSpecifier} and its {@link IASTName}.
|
||||
*/
|
||||
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(
|
||||
"IASTEnumerationSpecifier.ENUMERATOR - nested IASTEnumerator for IASTEnumerationSpecifier"); //$NON-NLS-1$
|
||||
|
@ -96,25 +101,17 @@ public interface IASTEnumerationSpecifier extends IASTDeclSpecifier, IASTNameOwn
|
|||
/**
|
||||
* Adds an enumerator.
|
||||
*
|
||||
* @param enumerator
|
||||
* <code>IASTEnumerator</code>
|
||||
* @param enumerator {@code IASTEnumerator}
|
||||
*/
|
||||
public void addEnumerator(IASTEnumerator enumerator);
|
||||
|
||||
/**
|
||||
* Returns enumerators.
|
||||
*
|
||||
* @return <code>IASTEnumerator []</code> array
|
||||
* @return {@code IASTEnumerator[]} array
|
||||
*/
|
||||
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.
|
||||
*
|
||||
|
@ -123,7 +120,7 @@ public interface IASTEnumerationSpecifier extends IASTDeclSpecifier, IASTNameOwn
|
|||
public void setName(IASTName name);
|
||||
|
||||
/**
|
||||
* Get the enum's name.
|
||||
* Returns the enum's name.
|
||||
*/
|
||||
public IASTName getName();
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ public interface IEnumeration extends IBinding, IType {
|
|||
* @since 5.2
|
||||
*/
|
||||
long getMinValue();
|
||||
|
||||
/**
|
||||
* @since 5.2
|
||||
*/
|
||||
|
|
|
@ -14,14 +14,13 @@ import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
|||
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier;
|
||||
|
||||
/**
|
||||
* <code> enum struct : unsigned int {...}</code>
|
||||
* <code>enum struct : unsigned int {...}</code>
|
||||
*
|
||||
* @since 5.2
|
||||
* @noextend This interface is not intended to be extended by clients.
|
||||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
*/
|
||||
public interface ICPPASTEnumerationSpecifier extends IASTEnumerationSpecifier, ICPPASTDeclSpecifier {
|
||||
|
||||
public static final ASTNodeProperty BASE_TYPE = new ASTNodeProperty(
|
||||
"ICPPASTEnumerationSpecifier.BASE_TYPE [ICPPASTDeclSpecifier]"); //$NON-NLS-1$
|
||||
|
||||
|
@ -35,18 +34,17 @@ public interface ICPPASTEnumerationSpecifier extends IASTEnumerationSpecifier, I
|
|||
public ICPPASTEnumerationSpecifier copy(CopyStyle style);
|
||||
|
||||
/**
|
||||
* Not allowed on frozen ast.
|
||||
* Not allowed on frozen AST.
|
||||
*/
|
||||
public void setIsScoped(boolean isScoped);
|
||||
|
||||
/**
|
||||
* An enum is scoped if it uses the enumeration head
|
||||
* <code>enum class</code> or <code>enum struct</code>
|
||||
* An enum is scoped if it uses the enumeration head {@code enum class} or {@code enum struct}.
|
||||
*/
|
||||
public boolean isScoped();
|
||||
|
||||
/**
|
||||
* Not allowed on frozen ast.
|
||||
* Not allowed on frozen AST.
|
||||
*/
|
||||
public void setIsOpaque(boolean isOpaque);
|
||||
|
||||
|
@ -61,13 +59,13 @@ public interface ICPPASTEnumerationSpecifier extends IASTEnumerationSpecifier, I
|
|||
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();
|
||||
|
||||
/**
|
||||
* Returns the scope containing the enumerators of this enumeration, or <code>null</code> if the specifier
|
||||
* is opaque.
|
||||
* Returns the scope containing the enumerators of this enumeration,
|
||||
* or {@code null} if the specifier is opaque.
|
||||
*/
|
||||
public ICPPScope getScope();
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ public abstract class ASTEnumerator extends ASTNode implements IASTEnumerator, I
|
|||
IASTNode parent= getParent();
|
||||
if (parent instanceof IASTInternalEnumerationSpecifier) {
|
||||
IASTInternalEnumerationSpecifier ies= (IASTInternalEnumerationSpecifier) parent;
|
||||
if (ies.startValueComputation()) { // prevents infinite recursions
|
||||
if (ies.startValueComputation()) { // Prevent infinite recursion.
|
||||
createEnumValues((IASTEnumerationSpecifier) parent);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -340,7 +340,7 @@ public abstract class ArithmeticConversion {
|
|||
if (basicTarget.isShort()) {
|
||||
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()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -352,7 +352,7 @@ public abstract class ArithmeticConversion {
|
|||
if (basicTarget.isShort()) {
|
||||
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()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -419,9 +419,10 @@ public abstract class ArithmeticConversion {
|
|||
long sizeofSource = sourceSizeAndAlignment == null ? getApproximateSize(source) : sourceSizeAndAlignment.size;
|
||||
long sizeofTarget = targetSizeAndAlignment == null ? getApproximateSize(target) : targetSizeAndAlignment.size;
|
||||
|
||||
if (sizeofSource == sizeofTarget)
|
||||
if (sizeofSource == sizeofTarget) {
|
||||
return target.isUnsigned() == source.isUnsigned();
|
||||
else
|
||||
} else {
|
||||
return sizeofSource < sizeofTarget;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import org.eclipse.cdt.core.dom.ast.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.
|
||||
*/
|
||||
boolean startValueComputation();
|
||||
|
|
|
@ -23,10 +23,8 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTInternalEnumerationSpecifier
|
|||
*/
|
||||
public class CASTEnumerationSpecifier extends CASTBaseDeclSpecifier
|
||||
implements IASTInternalEnumerationSpecifier, ICASTEnumerationSpecifier {
|
||||
|
||||
private IASTName name;
|
||||
private boolean valuesComputed= false;
|
||||
|
||||
private boolean valuesComputed;
|
||||
|
||||
public CASTEnumerationSpecifier() {
|
||||
}
|
||||
|
@ -54,7 +52,6 @@ public class CASTEnumerationSpecifier extends CASTBaseDeclSpecifier
|
|||
return super.copy(copy, style);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean startValueComputation() {
|
||||
if (valuesComputed)
|
||||
|
@ -70,20 +67,19 @@ public class CASTEnumerationSpecifier extends CASTBaseDeclSpecifier
|
|||
if (enumerator != null) {
|
||||
enumerator.setParent(this);
|
||||
enumerator.setPropertyInParent(ENUMERATOR);
|
||||
enumerators = ArrayUtil.appendAt( IASTEnumerator.class, enumerators, ++enumeratorsPos, enumerator );
|
||||
enumerators = ArrayUtil.appendAt(IASTEnumerator.class, enumerators, ++enumeratorsPos, enumerator);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IASTEnumerator[] getEnumerators() {
|
||||
if( enumerators == null ) return IASTEnumerator.EMPTY_ENUMERATOR_ARRAY;
|
||||
enumerators = ArrayUtil.trimAt( IASTEnumerator.class, enumerators, enumeratorsPos );
|
||||
if (enumerators == null) return IASTEnumerator.EMPTY_ENUMERATOR_ARRAY;
|
||||
enumerators = ArrayUtil.trimAt(IASTEnumerator.class, enumerators, enumeratorsPos);
|
||||
return enumerators;
|
||||
}
|
||||
|
||||
private IASTEnumerator [] enumerators = null;
|
||||
private int enumeratorsPos=-1;
|
||||
private int enumeratorsPos = -1;
|
||||
|
||||
|
||||
@Override
|
||||
|
@ -102,34 +98,35 @@ public class CASTEnumerationSpecifier extends CASTBaseDeclSpecifier
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean accept( ASTVisitor action ){
|
||||
if( action.shouldVisitDeclSpecifiers ){
|
||||
switch( action.visit( this ) ){
|
||||
case ASTVisitor.PROCESS_ABORT : return false;
|
||||
case ASTVisitor.PROCESS_SKIP : return true;
|
||||
default : break;
|
||||
public boolean accept(ASTVisitor action) {
|
||||
if (action.shouldVisitDeclSpecifiers) {
|
||||
switch(action.visit(this)) {
|
||||
case ASTVisitor.PROCESS_ABORT: return false;
|
||||
case ASTVisitor.PROCESS_SKIP: return true;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
if( name != null ) if( !name.accept( action ) ) return false;
|
||||
if (name != null && !name.accept(action))
|
||||
return false;
|
||||
IASTEnumerator[] etors = getEnumerators();
|
||||
for ( int i = 0; i < etors.length; i++ ) {
|
||||
if( !etors[i].accept( action ) ) return false;
|
||||
for (int i = 0; i < etors.length; i++) {
|
||||
if (!etors[i].accept(action))
|
||||
return false;
|
||||
}
|
||||
if( action.shouldVisitDeclSpecifiers ){
|
||||
switch( action.leave( this ) ){
|
||||
case ASTVisitor.PROCESS_ABORT : return false;
|
||||
case ASTVisitor.PROCESS_SKIP : return true;
|
||||
default : break;
|
||||
if (action.shouldVisitDeclSpecifiers) {
|
||||
switch(action.leave(this)) {
|
||||
case ASTVisitor.PROCESS_ABORT: return false;
|
||||
case ASTVisitor.PROCESS_SKIP: return true;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRoleForName(IASTName n ) {
|
||||
if( this.name == n )
|
||||
public int getRoleForName(IASTName n) {
|
||||
if (this.name == n)
|
||||
return r_definition;
|
||||
return r_unclear;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -52,8 +52,8 @@ public class CPPASTEnumerationSpecifier extends CPPASTBaseDeclSpecifier
|
|||
|
||||
@Override
|
||||
public CPPASTEnumerationSpecifier copy(CopyStyle style) {
|
||||
CPPASTEnumerationSpecifier copy =
|
||||
new CPPASTEnumerationSpecifier(fIsScoped, fName == null ? null : fName.copy(style),
|
||||
CPPASTEnumerationSpecifier copy = new CPPASTEnumerationSpecifier(fIsScoped,
|
||||
fName == null ? null : fName.copy(style),
|
||||
fBaseType == null ? null : fBaseType.copy(style));
|
||||
copy.fIsOpaque = fIsOpaque;
|
||||
for (IASTEnumerator enumerator : getEnumerators()) {
|
||||
|
|
|
@ -89,6 +89,7 @@ public class CPPBaseClause implements ICPPBase, ICPPInternalBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public IName getBaseClassSpecifierName() {
|
||||
return base.getName();
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ public class CPPDeferredFunction extends CPPUnknownBinding implements ICPPDeferr
|
|||
* Creates a CPPDeferredFunction given a set of overloaded functions
|
||||
* (some of which may be templates) that the function might resolve to.
|
||||
* At least one candidate must be provided.
|
||||
*
|
||||
* @param candidates a set of overloaded functions, some of which may be templates
|
||||
* @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
|
||||
* 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
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Enumerations in C++
|
||||
* Enumeration in C++
|
||||
*/
|
||||
public class CPPEnumeration extends PlatformObject implements ICPPEnumeration, ICPPInternalBinding {
|
||||
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 fMinValue;
|
||||
|
||||
private ICPPEnumeration fIndexBinding= null;
|
||||
private boolean fSearchedIndex= false;
|
||||
private ICPPEnumeration fIndexBinding;
|
||||
private boolean fSearchedIndex;
|
||||
|
||||
public CPPEnumeration(ICPPASTEnumerationSpecifier spec, IType fixedType) {
|
||||
final IASTName name = spec.getName();
|
||||
|
|
|
@ -43,56 +43,35 @@ public class CPPEnumerator extends PlatformObject implements IEnumerator, ICPPIn
|
|||
enumerator.setBinding(this);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPBinding#getDeclarations()
|
||||
*/
|
||||
@Override
|
||||
public IASTNode[] getDeclarations() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPBinding#getDefinition()
|
||||
*/
|
||||
@Override
|
||||
public IASTNode getDefinition() {
|
||||
return enumName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getName()
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return new String(getNameCharArray());
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getNameCharArray()
|
||||
*/
|
||||
@Override
|
||||
public char[] getNameCharArray() {
|
||||
return enumName.getSimpleID();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getScope()
|
||||
*/
|
||||
@Override
|
||||
public IScope getScope() {
|
||||
return CPPVisitor.getContainingScope(enumName);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getPhysicalNode()
|
||||
*/
|
||||
public IASTNode getPhysicalNode() {
|
||||
return enumName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IEnumerator#getType()
|
||||
*/
|
||||
@Override
|
||||
public IType getType() {
|
||||
IASTEnumerator etor = (IASTEnumerator) enumName.getParent();
|
||||
|
@ -100,25 +79,16 @@ public class CPPEnumerator extends PlatformObject implements IEnumerator, ICPPIn
|
|||
return (IType) enumSpec.getName().resolveBinding();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getFullyQualifiedName()
|
||||
*/
|
||||
@Override
|
||||
public String[] getQualifiedName() {
|
||||
return CPPVisitor.getQualifiedName(this);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getFullyQualifiedNameCharArray()
|
||||
*/
|
||||
@Override
|
||||
public char[][] getQualifiedNameCharArray() {
|
||||
return CPPVisitor.getQualifiedNameCharArray(this);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding#isGloballyQualified()
|
||||
*/
|
||||
@Override
|
||||
public boolean isGloballyQualified() throws DOMException {
|
||||
IScope scope = getScope();
|
||||
|
|
|
@ -88,7 +88,7 @@ public interface ICPPEvaluation extends ISerializableEvaluation {
|
|||
/**
|
||||
* Keeps track of state during a constexpr evaluation.
|
||||
*/
|
||||
class ConstexprEvaluationContext {
|
||||
final class ConstexprEvaluationContext {
|
||||
/**
|
||||
* The maximum number of steps allowed in a single constexpr evaluation.
|
||||
* This is used to prevent a buggy constexpr function from causing the
|
||||
|
@ -100,7 +100,7 @@ public interface ICPPEvaluation extends ISerializableEvaluation {
|
|||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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() {
|
||||
return fStepsPerformed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the point of instantiation.
|
||||
* Returns the point of instantiation.
|
||||
*/
|
||||
public IASTNode getPoint() {
|
||||
return fPoint;
|
||||
|
|
|
@ -982,7 +982,7 @@ public class CPPTemplates {
|
|||
spec = enumSpec.specializeEnumerator(enumerator);
|
||||
} else if (decl instanceof ICPPUsingDeclaration) {
|
||||
IBinding[] delegates= ((ICPPUsingDeclaration) decl).getDelegates();
|
||||
List<IBinding> result= new ArrayList<IBinding>();
|
||||
List<IBinding> result= new ArrayList<>();
|
||||
ICPPClassSpecialization within = getSpecializationContext(owner);
|
||||
for (IBinding delegate : delegates) {
|
||||
try {
|
||||
|
@ -2853,7 +2853,7 @@ public class CPPTemplates {
|
|||
if (keys.length == 0)
|
||||
return ObjectMap.EMPTY_MAP;
|
||||
|
||||
List<ICPPTemplateDefinition> defs= new ArrayList<ICPPTemplateDefinition>();
|
||||
List<ICPPTemplateDefinition> defs= new ArrayList<>();
|
||||
IBinding owner= b;
|
||||
while (owner != null) {
|
||||
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:
|
||||
* <ul>
|
||||
* <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>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
|
||||
* has trivial copy constructor.</li>
|
||||
* </ul>
|
||||
* Similar to <code>std::tr1::has_trivial_copy</code>.
|
||||
* Similar to {@code std::tr1::has_trivial_copy}.
|
||||
*
|
||||
* @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) {
|
||||
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:
|
||||
* <ul>
|
||||
* <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
|
||||
* has trivial default constructor.</li>
|
||||
* </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 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) {
|
||||
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:
|
||||
* <ul>
|
||||
* <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
|
||||
* has trivial destructor.</li>
|
||||
* </ul>
|
||||
* Similar to <code>std::tr1::has_trivial_destructor</code>.
|
||||
* Similar to {@code std::tr1::has_trivial_destructor}.
|
||||
*
|
||||
* @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) {
|
||||
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
|
||||
* function. Similar to <code>std::tr1::is_polymorphic</code>.
|
||||
* Returns {@code true} if and only if the given class declares or inherits a virtual
|
||||
* function. Similar to {@code std::tr1::is_polymorphic}.
|
||||
*
|
||||
* @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) {
|
||||
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.
|
||||
*
|
||||
* @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.
|
||||
*/
|
||||
private static ICPPConstructor getImplicitCopyCtor(ICPPClassType classType, IASTNode point) {
|
||||
|
@ -387,6 +387,6 @@ public class TypeTraits {
|
|||
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