mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 299911. Adapted for CDT 8.1.x branch.
This commit is contained in:
parent
744d4c5264
commit
df47c2b6d6
14 changed files with 130 additions and 187 deletions
100
core/org.eclipse.cdt.core/.settings/.api_filters
Normal file
100
core/org.eclipse.cdt.core/.settings/.api_filters
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<component id="org.eclipse.cdt.core" version="2">
|
||||||
|
<resource path="META-INF/MANIFEST.MF">
|
||||||
|
<filter id="924844039">
|
||||||
|
<message_arguments>
|
||||||
|
<message_argument value="5.4.1"/>
|
||||||
|
<message_argument value="5.4.0"/>
|
||||||
|
</message_arguments>
|
||||||
|
</filter>
|
||||||
|
</resource>
|
||||||
|
<resource path="parser/org/eclipse/cdt/core/dom/ast/IASTTypeIdExpression.java" type="org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression">
|
||||||
|
<filter id="1209008130">
|
||||||
|
<message_arguments>
|
||||||
|
<message_argument value="op_is_literal_type"/>
|
||||||
|
</message_arguments>
|
||||||
|
</filter>
|
||||||
|
<filter id="1211105284">
|
||||||
|
<message_arguments>
|
||||||
|
<message_argument value="op_is_literal_type"/>
|
||||||
|
</message_arguments>
|
||||||
|
</filter>
|
||||||
|
<filter id="1211105284">
|
||||||
|
<message_arguments>
|
||||||
|
<message_argument value="op_is_standard_layout"/>
|
||||||
|
</message_arguments>
|
||||||
|
</filter>
|
||||||
|
<filter id="1211105284">
|
||||||
|
<message_arguments>
|
||||||
|
<message_argument value="op_is_trivial"/>
|
||||||
|
</message_arguments>
|
||||||
|
</filter>
|
||||||
|
</resource>
|
||||||
|
<resource path="parser/org/eclipse/cdt/core/dom/ast/IScope.java" type="org.eclipse.cdt.core.dom.ast.IScope$ScopeLookupData">
|
||||||
|
<filter id="1211105284">
|
||||||
|
<message_arguments>
|
||||||
|
<message_argument value="ScopeLookupData"/>
|
||||||
|
</message_arguments>
|
||||||
|
</filter>
|
||||||
|
</resource>
|
||||||
|
<resource path="parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTExpression.java" type="org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression">
|
||||||
|
<filter id="1108344834">
|
||||||
|
<message_arguments>
|
||||||
|
<message_argument value="org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression"/>
|
||||||
|
</message_arguments>
|
||||||
|
</filter>
|
||||||
|
<filter id="1110441988">
|
||||||
|
<message_arguments>
|
||||||
|
<message_argument value="org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression"/>
|
||||||
|
</message_arguments>
|
||||||
|
</filter>
|
||||||
|
</resource>
|
||||||
|
<resource path="parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTInitializerClause.java" type="org.eclipse.cdt.core.dom.ast.cpp.ICPPASTInitializerClause">
|
||||||
|
<filter id="1110441988">
|
||||||
|
<message_arguments>
|
||||||
|
<message_argument value="org.eclipse.cdt.core.dom.ast.cpp.ICPPASTInitializerClause"/>
|
||||||
|
</message_arguments>
|
||||||
|
</filter>
|
||||||
|
</resource>
|
||||||
|
<resource path="parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPMethodSpecialization.java" type="org.eclipse.cdt.core.dom.ast.cpp.ICPPMethodSpecialization">
|
||||||
|
<filter id="1110441988">
|
||||||
|
<message_arguments>
|
||||||
|
<message_argument value="org.eclipse.cdt.core.dom.ast.cpp.ICPPMethodSpecialization"/>
|
||||||
|
</message_arguments>
|
||||||
|
</filter>
|
||||||
|
</resource>
|
||||||
|
<resource path="parser/org/eclipse/cdt/core/parser/GCCKeywords.java" type="org.eclipse.cdt.core.parser.GCCKeywords">
|
||||||
|
<filter id="1143996420">
|
||||||
|
<message_arguments>
|
||||||
|
<message_argument value="cp__is_literal_type"/>
|
||||||
|
</message_arguments>
|
||||||
|
</filter>
|
||||||
|
<filter id="1143996420">
|
||||||
|
<message_arguments>
|
||||||
|
<message_argument value="cp__is_standard_layout"/>
|
||||||
|
</message_arguments>
|
||||||
|
</filter>
|
||||||
|
<filter id="1143996420">
|
||||||
|
<message_arguments>
|
||||||
|
<message_argument value="cp__is_trivial"/>
|
||||||
|
</message_arguments>
|
||||||
|
</filter>
|
||||||
|
</resource>
|
||||||
|
<resource path="parser/org/eclipse/cdt/core/parser/IGCCToken.java" type="org.eclipse.cdt.core.parser.IGCCToken">
|
||||||
|
<filter id="1211105284">
|
||||||
|
<message_arguments>
|
||||||
|
<message_argument value="tTT_is_literal_type"/>
|
||||||
|
</message_arguments>
|
||||||
|
</filter>
|
||||||
|
<filter id="1211105284">
|
||||||
|
<message_arguments>
|
||||||
|
<message_argument value="tTT_is_standard_layout"/>
|
||||||
|
</message_arguments>
|
||||||
|
</filter>
|
||||||
|
<filter id="1211105284">
|
||||||
|
<message_arguments>
|
||||||
|
<message_argument value="tTT_is_trivial"/>
|
||||||
|
</message_arguments>
|
||||||
|
</filter>
|
||||||
|
</resource>
|
||||||
|
</component>
|
|
@ -130,19 +130,19 @@ public interface IASTTypeIdExpression extends IASTExpression {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Built-in type trait of g++.
|
* Built-in type trait of g++.
|
||||||
* @since 5.5
|
* Experimental API. May change without notice.
|
||||||
*/
|
*/
|
||||||
public static final int op_is_literal_type= 19;
|
public static final int op_is_literal_type= 19;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Built-in type trait of g++.
|
* Built-in type trait of g++.
|
||||||
* @since 5.5
|
* Experimental API. May change without notice.
|
||||||
*/
|
*/
|
||||||
public static final int op_is_standard_layout= 20;
|
public static final int op_is_standard_layout= 20;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Built-in type trait of g++.
|
* Built-in type trait of g++.
|
||||||
* @since 5.5
|
* Experimental API. May change without notice.
|
||||||
*/
|
*/
|
||||||
public static final int op_is_trivial= 21;
|
public static final int op_is_trivial= 21;
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ public interface IScope {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 5.5
|
* @noinstantiate This class is not intended to be instantiated by clients.
|
||||||
* @noextend This class is not intended to be subclassed by clients.
|
* @noextend This class is not intended to be subclassed by clients.
|
||||||
*/
|
*/
|
||||||
public static class ScopeLookupData {
|
public static class ScopeLookupData {
|
||||||
|
@ -185,7 +185,7 @@ public interface IScope {
|
||||||
* have not yet been resolved.
|
* have not yet been resolved.
|
||||||
*
|
*
|
||||||
* @return : the bindings in this scope that match the name or prefix, or null
|
* @return : the bindings in this scope that match the name or prefix, or null
|
||||||
* @since 5.5
|
* @noreference This method is not intended to be referenced by clients.
|
||||||
*/
|
*/
|
||||||
public IBinding[] getBindings(ScopeLookupData lookup);
|
public IBinding[] getBindings(ScopeLookupData lookup);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,13 +31,13 @@ public interface ICPPASTArraySubscriptExpression extends IASTArraySubscriptExpre
|
||||||
public ICPPASTArraySubscriptExpression copy(CopyStyle style);
|
public ICPPASTArraySubscriptExpression copy(CopyStyle style);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 5.5
|
* @noreference This method is not intended to be referenced by clients.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ICPPASTExpression getArrayExpression();
|
public ICPPASTExpression getArrayExpression();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 5.5
|
* @noreference This method is not intended to be referenced by clients.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ICPPASTInitializerClause getArgument();
|
public ICPPASTInitializerClause getArgument();
|
||||||
|
|
|
@ -6,9 +6,8 @@
|
||||||
* 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;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
|
@ -17,8 +16,7 @@ import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
* Interface for c++ expressions.
|
* Interface for c++ expressions.
|
||||||
* @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.
|
||||||
* @since 5.5
|
* Experimental API. May change without notice.
|
||||||
*/
|
*/
|
||||||
public interface ICPPASTExpression extends IASTExpression, ICPPASTInitializerClause {
|
public interface ICPPASTExpression extends IASTExpression, ICPPASTInitializerClause {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ public interface ICPPASTFieldReference extends IASTFieldReference, ICPPASTExpres
|
||||||
public IType getFieldOwnerType();
|
public IType getFieldOwnerType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 5.5
|
* @noreference This method is not intended to be referenced by clients.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ICPPASTExpression getFieldOwner();
|
public ICPPASTExpression getFieldOwner();
|
||||||
|
|
|
@ -17,7 +17,6 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation;
|
||||||
* C++ specific initializer clause.
|
* C++ specific initializer clause.
|
||||||
* @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.
|
||||||
* @since 5.5
|
|
||||||
*/
|
*/
|
||||||
public interface ICPPASTInitializerClause extends IASTInitializerClause {
|
public interface ICPPASTInitializerClause extends IASTInitializerClause {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -35,70 +35,70 @@ public interface ICPPClassSpecialization extends ICPPSpecialization, ICPPClassTy
|
||||||
/**
|
/**
|
||||||
* Creates a specialized binding for a member of the original class. The result is
|
* Creates a specialized binding for a member of the original class. The result is
|
||||||
* a member of this class specialization.
|
* a member of this class specialization.
|
||||||
* @since 5.5
|
* @noreference This method is not intended to be referenced by clients.
|
||||||
*/
|
*/
|
||||||
IBinding specializeMember(IBinding binding, IASTNode point);
|
IBinding specializeMember(IBinding binding, IASTNode point);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Similar to {@link ICPPClassType#getBases()} but a accepts a starting point for template
|
* Similar to {@link ICPPClassType#getBases()} but a accepts a starting point for template
|
||||||
* instantiation.
|
* instantiation.
|
||||||
* @since 5.5
|
* @noreference This method is not intended to be referenced by clients.
|
||||||
*/
|
*/
|
||||||
ICPPBase[] getBases(IASTNode point);
|
ICPPBase[] getBases(IASTNode point);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Similar to {@link ICPPClassType#getConstructors()} but a accepts a starting point
|
* Similar to {@link ICPPClassType#getConstructors()} but a accepts a starting point
|
||||||
* for template instantiation.
|
* for template instantiation.
|
||||||
* @since 5.5
|
* @noreference This method is not intended to be referenced by clients.
|
||||||
*/
|
*/
|
||||||
ICPPConstructor[] getConstructors(IASTNode point);
|
ICPPConstructor[] getConstructors(IASTNode point);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Similar to {@link ICPPClassType#getDeclaredFields()} but a accepts a starting point
|
* Similar to {@link ICPPClassType#getDeclaredFields()} but a accepts a starting point
|
||||||
* for template instantiation.
|
* for template instantiation.
|
||||||
* @since 5.5
|
* @noreference This method is not intended to be referenced by clients.
|
||||||
*/
|
*/
|
||||||
ICPPField[] getDeclaredFields(IASTNode point);
|
ICPPField[] getDeclaredFields(IASTNode point);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Similar to {@link ICPPClassType#getMethods()} but a accepts a starting point
|
* Similar to {@link ICPPClassType#getMethods()} but a accepts a starting point
|
||||||
* for template instantiation.
|
* for template instantiation.
|
||||||
* @since 5.5
|
* @noreference This method is not intended to be referenced by clients.
|
||||||
*/
|
*/
|
||||||
ICPPMethod[] getMethods(IASTNode point);
|
ICPPMethod[] getMethods(IASTNode point);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Similar to {@link ICPPClassType#getAllDeclaredMethods()} but a accepts a starting point
|
* Similar to {@link ICPPClassType#getAllDeclaredMethods()} but a accepts a starting point
|
||||||
* for template instantiation.
|
* for template instantiation.
|
||||||
* @since 5.5
|
* @noreference This method is not intended to be referenced by clients.
|
||||||
*/
|
*/
|
||||||
ICPPMethod[] getAllDeclaredMethods(IASTNode point);
|
ICPPMethod[] getAllDeclaredMethods(IASTNode point);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Similar to {@link ICPPClassType#getDeclaredMethods()} but a accepts a starting point
|
* Similar to {@link ICPPClassType#getDeclaredMethods()} but a accepts a starting point
|
||||||
* for template instantiation.
|
* for template instantiation.
|
||||||
* @since 5.5
|
* @noreference This method is not intended to be referenced by clients.
|
||||||
*/
|
*/
|
||||||
ICPPMethod[] getDeclaredMethods(IASTNode point);
|
ICPPMethod[] getDeclaredMethods(IASTNode point);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Similar to {@link ICPPClassType#getFriends()} but a accepts a starting point
|
* Similar to {@link ICPPClassType#getFriends()} but a accepts a starting point
|
||||||
* for template instantiation.
|
* for template instantiation.
|
||||||
* @since 5.5
|
* @noreference This method is not intended to be referenced by clients.
|
||||||
*/
|
*/
|
||||||
IBinding[] getFriends(IASTNode point);
|
IBinding[] getFriends(IASTNode point);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Similar to {@link ICPPClassType#getFriends()} but a accepts a starting point
|
* Similar to {@link ICPPClassType#getFriends()} but a accepts a starting point
|
||||||
* for template instantiation.
|
* for template instantiation.
|
||||||
* @since 5.5
|
* @noreference This method is not intended to be referenced by clients.
|
||||||
*/
|
*/
|
||||||
IField[] getFields(IASTNode point);
|
IField[] getFields(IASTNode point);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Similar to {@link ICPPClassType#getNestedClasses()} but a accepts a starting point
|
* Similar to {@link ICPPClassType#getNestedClasses()} but a accepts a starting point
|
||||||
* for template instantiation.
|
* for template instantiation.
|
||||||
* @since 5.5
|
* @noreference This method is not intended to be referenced by clients.
|
||||||
*/
|
*/
|
||||||
ICPPClassType[] getNestedClasses(IASTNode point);
|
ICPPClassType[] getNestedClasses(IASTNode point);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specialization of a method.
|
* Specialization of a method.
|
||||||
* @since 5.5
|
|
||||||
*
|
*
|
||||||
* @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.
|
||||||
|
@ -24,7 +23,6 @@ public interface ICPPMethodSpecialization extends ICPPSpecialization, ICPPMethod
|
||||||
/**
|
/**
|
||||||
* Similar to {@link ICPPFunction#getExceptionSpecification()} but a accepts a starting point
|
* Similar to {@link ICPPFunction#getExceptionSpecification()} but a accepts a starting point
|
||||||
* for template instantiation.
|
* for template instantiation.
|
||||||
* @since 5.5
|
|
||||||
*/
|
*/
|
||||||
IType[] getExceptionSpecification(IASTNode point);
|
IType[] getExceptionSpecification(IASTNode point);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class GCCKeywords {
|
||||||
cp__is_union= "__is_union".toCharArray();
|
cp__is_union= "__is_union".toCharArray();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 5.5
|
* Experimental API. May change without notice.
|
||||||
*/
|
*/
|
||||||
public static final char[]
|
public static final char[]
|
||||||
cp__is_literal_type= "__is_literal_type".toCharArray(),
|
cp__is_literal_type= "__is_literal_type".toCharArray(),
|
||||||
|
|
|
@ -41,7 +41,8 @@ public interface IGCCToken extends IToken {
|
||||||
/** @since 5.3 */ int tTT_is_pod= FIRST_RESERVED_IGCCToken + 19;
|
/** @since 5.3 */ int tTT_is_pod= FIRST_RESERVED_IGCCToken + 19;
|
||||||
/** @since 5.3 */ int tTT_is_polymorphic= FIRST_RESERVED_IGCCToken + 20;
|
/** @since 5.3 */ int tTT_is_polymorphic= FIRST_RESERVED_IGCCToken + 20;
|
||||||
/** @since 5.3 */ int tTT_is_union= FIRST_RESERVED_IGCCToken + 21;
|
/** @since 5.3 */ int tTT_is_union= FIRST_RESERVED_IGCCToken + 21;
|
||||||
/** @since 5.5 */ int tTT_is_literal_type= FIRST_RESERVED_IGCCToken + 22;
|
/** The following constants are experimental and are not intended to be referenced by clients. */
|
||||||
/** @since 5.5 */ int tTT_is_standard_layout= FIRST_RESERVED_IGCCToken + 23;
|
int tTT_is_literal_type= FIRST_RESERVED_IGCCToken + 22;
|
||||||
/** @since 5.5 */ int tTT_is_trivial= FIRST_RESERVED_IGCCToken + 24;
|
int tTT_is_standard_layout= FIRST_RESERVED_IGCCToken + 23;
|
||||||
|
int tTT_is_trivial= FIRST_RESERVED_IGCCToken + 24;
|
||||||
}
|
}
|
||||||
|
|
|
@ -343,7 +343,7 @@ public class CharArrayUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a {@link StringBuilder} to a character array.
|
* Converts a {@link StringBuilder} to a character array.
|
||||||
* @since 5.5
|
* @noreference This method is not intended to be referenced by clients.
|
||||||
*/
|
*/
|
||||||
public static char[] extractChars(StringBuilder buf) {
|
public static char[] extractChars(StringBuilder buf) {
|
||||||
final int len = buf.length();
|
final int len = buf.length();
|
||||||
|
|
|
@ -1,151 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2012 Google, Inc and others.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Sergey Prigogin (Google) - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.eclipse.cdt.core.parser.util;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Automatically growing integer array.
|
|
||||||
*
|
|
||||||
* @since 5.5
|
|
||||||
*/
|
|
||||||
public class IntArray {
|
|
||||||
private static final int INITIAL_CAPACITY = 10;
|
|
||||||
private static final int[] EMPTY_ARRAY = {};
|
|
||||||
|
|
||||||
private int[] buffer = EMPTY_ARRAY;
|
|
||||||
private int size;
|
|
||||||
|
|
||||||
public IntArray() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public IntArray(int initialCapacity) {
|
|
||||||
this.buffer = new int[initialCapacity];
|
|
||||||
}
|
|
||||||
|
|
||||||
public int size() {
|
|
||||||
return size;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isEmpty() {
|
|
||||||
return size == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void add(int value) {
|
|
||||||
grow(size + 1);
|
|
||||||
buffer[size++] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void add(int index, int value) {
|
|
||||||
checkBounds(index);
|
|
||||||
grow(size + 1);
|
|
||||||
System.arraycopy(buffer, index, buffer, index + 1, size - index);
|
|
||||||
buffer[index] = value;
|
|
||||||
size++;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addAll(IntArray other) {
|
|
||||||
grow(size + other.size());
|
|
||||||
System.arraycopy(other.buffer, 0, buffer, size, other.size);
|
|
||||||
size += other.size;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addAll(int[] array) {
|
|
||||||
grow(size + array.length);
|
|
||||||
System.arraycopy(array, 0, buffer, size, array.length);
|
|
||||||
size += array.length;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int remove(int index) {
|
|
||||||
checkBounds(index);
|
|
||||||
int old = buffer[index];
|
|
||||||
int n = size - index - 1;
|
|
||||||
if (n > 0) {
|
|
||||||
System.arraycopy(buffer, index + 1, buffer, index, n);
|
|
||||||
}
|
|
||||||
return old;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void remove(int from, int to) {
|
|
||||||
checkBounds(from);
|
|
||||||
checkBounds(to);
|
|
||||||
System.arraycopy(buffer, to, buffer, from, size - to);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clear() {
|
|
||||||
size = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int get(int index) {
|
|
||||||
checkRange(index);
|
|
||||||
return buffer[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
public int set(int index, int value) {
|
|
||||||
checkBounds(index);
|
|
||||||
int old = buffer[index];
|
|
||||||
buffer[index] = value;
|
|
||||||
return old;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int[] toArray() {
|
|
||||||
return size == 0 ? EMPTY_ARRAY : Arrays.copyOf(buffer, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void trimToSize() {
|
|
||||||
if (size == 0) {
|
|
||||||
buffer = EMPTY_ARRAY;
|
|
||||||
} else if (size < buffer.length) {
|
|
||||||
buffer = Arrays.copyOf(buffer, size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ensureCapacity(int minCapacity) {
|
|
||||||
if (minCapacity > 0) {
|
|
||||||
grow(minCapacity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void grow(int minCapacity) {
|
|
||||||
if (minCapacity < 0) // Overflow
|
|
||||||
throw new OutOfMemoryError();
|
|
||||||
|
|
||||||
int capacity = buffer.length;
|
|
||||||
if (minCapacity > capacity) {
|
|
||||||
int newCapacity = capacity == 0 ? INITIAL_CAPACITY : capacity + (capacity >> 1);
|
|
||||||
// newCapacity may be negative due to overflow.
|
|
||||||
if (newCapacity < minCapacity)
|
|
||||||
newCapacity = minCapacity;
|
|
||||||
// newCapacity is guaranteed to be non negative.
|
|
||||||
try {
|
|
||||||
buffer = Arrays.copyOf(buffer, newCapacity);
|
|
||||||
} catch (OutOfMemoryError e) {
|
|
||||||
// Try again it case we were too aggressive in reserving capacity.
|
|
||||||
buffer = Arrays.copyOf(buffer, minCapacity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkBounds(int index) {
|
|
||||||
if (index < 0) {
|
|
||||||
throw new IndexOutOfBoundsException("Negative index: " + index); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
checkRange(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkRange(int index) {
|
|
||||||
if (index >= size) {
|
|
||||||
throw new IndexOutOfBoundsException("Index: " + index + ", size: " + size); //$NON-NLS-1$//$NON-NLS-2$
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -217,13 +217,11 @@ public class PDOM extends PlatformObject implements IPDOM {
|
||||||
* 123.0 - Combined file size and encoding hash code.
|
* 123.0 - Combined file size and encoding hash code.
|
||||||
* 124.0 - GCC attributes and NO_RETURN flag for functions.
|
* 124.0 - GCC attributes and NO_RETURN flag for functions.
|
||||||
* #125.0# - Indexes for unresolved includes and files indexed with I/O errors. <<CDT 8.1>>
|
* #125.0# - Indexes for unresolved includes and files indexed with I/O errors. <<CDT 8.1>>
|
||||||
*
|
* 126.0 - Dependent expressions, bug 299911.
|
||||||
* CDT 8.2 development
|
|
||||||
* 130.0 - Dependent expressions, bug 299911
|
|
||||||
*/
|
*/
|
||||||
private static final int MIN_SUPPORTED_VERSION= version(130, 0);
|
private static final int MIN_SUPPORTED_VERSION= version(126, 0);
|
||||||
private static final int MAX_SUPPORTED_VERSION= version(130, Short.MAX_VALUE);
|
private static final int MAX_SUPPORTED_VERSION= version(126, Short.MAX_VALUE);
|
||||||
private static final int DEFAULT_VERSION = version(130, 0);
|
private static final int DEFAULT_VERSION = version(126, 0);
|
||||||
|
|
||||||
private static int version(int major, int minor) {
|
private static int version(int major, int minor) {
|
||||||
return (major << 16) + minor;
|
return (major << 16) + minor;
|
||||||
|
|
Loading…
Add table
Reference in a new issue