mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Patch for Devin Steffler.
Fixing ArrayUtil.removeNulls().
This commit is contained in:
parent
a5ed254394
commit
8a37c61a8c
32 changed files with 253 additions and 71 deletions
|
@ -190,6 +190,9 @@ public class ArrayUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Note that this should only be used when the placement of
|
||||||
|
* nulls within the array is unknown (due to performance efficiency).
|
||||||
|
*
|
||||||
* Removes all of the nulls from the array and returns a new
|
* Removes all of the nulls from the array and returns a new
|
||||||
* array that contains all of the non-null elements.
|
* array that contains all of the non-null elements.
|
||||||
*
|
*
|
||||||
|
@ -220,6 +223,29 @@ public class ArrayUtil {
|
||||||
return newArray;
|
return newArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To improve performance, this method should be used instead of ArrayUtil#removeNulls(Class, Object[]) when
|
||||||
|
* all of the non-null elements in the array are grouped together at the beginning of the array
|
||||||
|
* and all of the nulls are at the end of the array.
|
||||||
|
* The position of the last non-null element in the array must also be known.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Object[] removeNullsAfter(Class c, Object[] array, int index) {
|
||||||
|
if( array == null || index < 0)
|
||||||
|
return (Object[]) Array.newInstance( c, 0 );
|
||||||
|
|
||||||
|
if( array.length == index + 1 )
|
||||||
|
return array;
|
||||||
|
|
||||||
|
Object[] newArray = (Object[]) Array.newInstance(c, index + 1);
|
||||||
|
for( int i = 0; i <= index; i++ ){
|
||||||
|
newArray[i] = array[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return newArray;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert the obj at the beginning of the array, shifting the whole thing one index
|
* Insert the obj at the beginning of the array, shifting the whole thing one index
|
||||||
* @param c
|
* @param c
|
||||||
|
|
|
@ -29,19 +29,24 @@ public abstract class CASTAmbiguity extends CASTNode {
|
||||||
protected static class CASTNameCollector extends CASTVisitor
|
protected static class CASTNameCollector extends CASTVisitor
|
||||||
{
|
{
|
||||||
private IASTName[] names = new IASTName[ 2 ];
|
private IASTName[] names = new IASTName[ 2 ];
|
||||||
|
private int namesPos=-1;
|
||||||
|
|
||||||
{
|
{
|
||||||
shouldVisitNames = true;
|
shouldVisitNames = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int visit(IASTName name) {
|
public int visit(IASTName name) {
|
||||||
names = (IASTName[]) ArrayUtil.append( IASTName.class, names, name );
|
if (name != null) {
|
||||||
|
namesPos++;
|
||||||
|
names = (IASTName[]) ArrayUtil.append( IASTName.class, names, name );
|
||||||
|
}
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTName [] getNames()
|
public IASTName [] getNames()
|
||||||
{
|
{
|
||||||
return (IASTName[]) ArrayUtil.removeNulls( IASTName.class, names );
|
names = (IASTName[]) ArrayUtil.removeNullsAfter( IASTName.class, names, namesPos );
|
||||||
|
return names;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,13 +19,18 @@ public class CASTAmbiguousExpression extends CASTAmbiguity implements
|
||||||
IASTAmbiguousExpression {
|
IASTAmbiguousExpression {
|
||||||
|
|
||||||
private IASTExpression [] expressions = new IASTExpression[2];
|
private IASTExpression [] expressions = new IASTExpression[2];
|
||||||
|
private int expressionsPos=-1;
|
||||||
|
|
||||||
public void addExpression(IASTExpression e) {
|
public void addExpression(IASTExpression e) {
|
||||||
expressions = (IASTExpression[]) ArrayUtil.append( IASTExpression.class, expressions, e );
|
if (e != null) {
|
||||||
|
expressionsPos++;
|
||||||
|
expressions = (IASTExpression[]) ArrayUtil.append( IASTExpression.class, expressions, e );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTExpression[] getExpressions() {
|
public IASTExpression[] getExpressions() {
|
||||||
return (IASTExpression[]) ArrayUtil.removeNulls( IASTExpression.class, expressions );
|
expressions = (IASTExpression[]) ArrayUtil.removeNullsAfter( IASTExpression.class, expressions, expressionsPos );
|
||||||
|
return expressions;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IASTNode[] getNodes() {
|
protected IASTNode[] getNodes() {
|
||||||
|
|
|
@ -19,13 +19,18 @@ public class CASTAmbiguousStatement extends CASTAmbiguity implements
|
||||||
IASTAmbiguousStatement {
|
IASTAmbiguousStatement {
|
||||||
|
|
||||||
private IASTStatement [] stmts = new IASTStatement[2];
|
private IASTStatement [] stmts = new IASTStatement[2];
|
||||||
|
private int stmtsPos=-1;
|
||||||
|
|
||||||
public void addStatement(IASTStatement s) {
|
public void addStatement(IASTStatement s) {
|
||||||
stmts = (IASTStatement[]) ArrayUtil.append( IASTStatement.class, stmts, s );
|
if (s != null) {
|
||||||
|
stmtsPos++;
|
||||||
|
stmts = (IASTStatement[]) ArrayUtil.append( IASTStatement.class, stmts, s );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTStatement[] getStatements() {
|
public IASTStatement[] getStatements() {
|
||||||
return (IASTStatement[]) ArrayUtil.removeNulls( IASTStatement.class, stmts );
|
stmts = (IASTStatement[]) ArrayUtil.removeNullsAfter( IASTStatement.class, stmts, stmtsPos );
|
||||||
|
return stmts;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IASTNode[] getNodes() {
|
protected IASTNode[] getNodes() {
|
||||||
|
|
|
@ -22,16 +22,20 @@ public class CASTArrayDeclarator extends CASTDeclarator implements
|
||||||
IASTArrayDeclarator {
|
IASTArrayDeclarator {
|
||||||
|
|
||||||
private IASTArrayModifier [] arrayMods = null;
|
private IASTArrayModifier [] arrayMods = null;
|
||||||
|
private int arrayModsPos=-1;
|
||||||
|
|
||||||
public IASTArrayModifier[] getArrayModifiers() {
|
public IASTArrayModifier[] getArrayModifiers() {
|
||||||
if( arrayMods == null ) return IASTArrayModifier.EMPTY_ARRAY;
|
if( arrayMods == null ) return IASTArrayModifier.EMPTY_ARRAY;
|
||||||
return (IASTArrayModifier[]) ArrayUtil.removeNulls( IASTArrayModifier.class, arrayMods );
|
arrayMods = (IASTArrayModifier[]) ArrayUtil.removeNullsAfter( IASTArrayModifier.class, arrayMods, arrayModsPos );
|
||||||
|
return arrayMods;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addArrayModifier(IASTArrayModifier arrayModifier) {
|
public void addArrayModifier(IASTArrayModifier arrayModifier) {
|
||||||
arrayMods = (IASTArrayModifier[]) ArrayUtil.append( IASTArrayModifier.class, arrayMods, arrayModifier );
|
if (arrayModifier != null) {
|
||||||
|
arrayModsPos++;
|
||||||
|
arrayMods = (IASTArrayModifier[]) ArrayUtil.append( IASTArrayModifier.class, arrayMods, arrayModifier );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean postAccept( ASTVisitor action ){
|
protected boolean postAccept( ASTVisitor action ){
|
||||||
|
|
|
@ -56,6 +56,7 @@ public class CASTCompositeTypeSpecifier extends CASTBaseDeclSpecifier implements
|
||||||
|
|
||||||
|
|
||||||
private IASTDeclaration [] declarations = null;
|
private IASTDeclaration [] declarations = null;
|
||||||
|
private int declarationsPos=-1;
|
||||||
private IScope scope = null;
|
private IScope scope = null;
|
||||||
|
|
||||||
|
|
||||||
|
@ -64,14 +65,18 @@ public class CASTCompositeTypeSpecifier extends CASTBaseDeclSpecifier implements
|
||||||
*/
|
*/
|
||||||
public IASTDeclaration [] getMembers() {
|
public IASTDeclaration [] getMembers() {
|
||||||
if( declarations == null ) return IASTDeclaration.EMPTY_DECLARATION_ARRAY;
|
if( declarations == null ) return IASTDeclaration.EMPTY_DECLARATION_ARRAY;
|
||||||
return (IASTDeclaration[]) ArrayUtil.removeNulls( IASTDeclaration.class, declarations );
|
declarations = (IASTDeclaration[]) ArrayUtil.removeNullsAfter( IASTDeclaration.class, declarations, declarationsPos );
|
||||||
|
return declarations;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#addMemberDeclaration(org.eclipse.cdt.core.dom.ast.IASTDeclaration)
|
* @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#addMemberDeclaration(org.eclipse.cdt.core.dom.ast.IASTDeclaration)
|
||||||
*/
|
*/
|
||||||
public void addMemberDeclaration(IASTDeclaration declaration) {
|
public void addMemberDeclaration(IASTDeclaration declaration) {
|
||||||
declarations = (IASTDeclaration[]) ArrayUtil.append( IASTDeclaration.class, declarations, declaration );
|
if (declaration != null) {
|
||||||
|
declarationsPos++;
|
||||||
|
declarations = (IASTDeclaration[]) ArrayUtil.append( IASTDeclaration.class, declarations, declaration );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ public class CASTDeclarator extends CASTNode implements IASTDeclarator {
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
private IASTDeclarator nestedDeclarator;
|
private IASTDeclarator nestedDeclarator;
|
||||||
private IASTPointerOperator [] pointerOps = null;
|
private IASTPointerOperator [] pointerOps = null;
|
||||||
|
private int pointerOpsPos=-1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,7 +42,8 @@ public class CASTDeclarator extends CASTNode implements IASTDeclarator {
|
||||||
*/
|
*/
|
||||||
public IASTPointerOperator[] getPointerOperators() {
|
public IASTPointerOperator[] getPointerOperators() {
|
||||||
if( pointerOps == null ) return IASTPointerOperator.EMPTY_ARRAY;
|
if( pointerOps == null ) return IASTPointerOperator.EMPTY_ARRAY;
|
||||||
return (IASTPointerOperator[]) ArrayUtil.removeNulls( IASTPointerOperator.class, pointerOps );
|
pointerOps = (IASTPointerOperator[]) ArrayUtil.removeNullsAfter( IASTPointerOperator.class, pointerOps, pointerOpsPos );
|
||||||
|
return pointerOps;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -76,7 +78,10 @@ public class CASTDeclarator extends CASTNode implements IASTDeclarator {
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#addPointerOperator(org.eclipse.cdt.core.dom.ast.IASTPointerOperator)
|
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#addPointerOperator(org.eclipse.cdt.core.dom.ast.IASTPointerOperator)
|
||||||
*/
|
*/
|
||||||
public void addPointerOperator(IASTPointerOperator operator) {
|
public void addPointerOperator(IASTPointerOperator operator) {
|
||||||
pointerOps = (IASTPointerOperator[]) ArrayUtil.append( IASTPointerOperator.class, pointerOps, operator );
|
if (operator != null) {
|
||||||
|
pointerOpsPos++;
|
||||||
|
pointerOps = (IASTPointerOperator[]) ArrayUtil.append( IASTPointerOperator.class, pointerOps, operator );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -28,7 +28,10 @@ public class CASTDesignatedInitializer extends CASTNode implements
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICASTDesignatedInitializer#addDesignator(org.eclipse.cdt.core.dom.ast.c.ICASTDesignator)
|
* @see org.eclipse.cdt.core.dom.ast.c.ICASTDesignatedInitializer#addDesignator(org.eclipse.cdt.core.dom.ast.c.ICASTDesignator)
|
||||||
*/
|
*/
|
||||||
public void addDesignator(ICASTDesignator designator) {
|
public void addDesignator(ICASTDesignator designator) {
|
||||||
designators = (ICASTDesignator[]) ArrayUtil.append( ICASTDesignator.class, designators, designator );
|
if (designator != null) {
|
||||||
|
designatorsPos++;
|
||||||
|
designators = (ICASTDesignator[]) ArrayUtil.append( ICASTDesignator.class, designators, designator );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -36,10 +39,12 @@ public class CASTDesignatedInitializer extends CASTNode implements
|
||||||
*/
|
*/
|
||||||
public ICASTDesignator[] getDesignators() {
|
public ICASTDesignator[] getDesignators() {
|
||||||
if( designators == null ) return ICASTDesignatedInitializer.EMPTY_DESIGNATOR_ARRAY;
|
if( designators == null ) return ICASTDesignatedInitializer.EMPTY_DESIGNATOR_ARRAY;
|
||||||
return (ICASTDesignator[]) ArrayUtil.removeNulls( ICASTDesignator.class, designators );
|
designators = (ICASTDesignator[]) ArrayUtil.removeNullsAfter( ICASTDesignator.class, designators, designatorsPos );
|
||||||
|
return designators;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ICASTDesignator [] designators = null;
|
private ICASTDesignator [] designators = null;
|
||||||
|
int designatorsPos=-1;
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICASTDesignatedInitializer#getRHSInitializer()
|
* @see org.eclipse.cdt.core.dom.ast.c.ICASTDesignatedInitializer#getRHSInitializer()
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -26,7 +26,10 @@ public class CASTEnumerationSpecifier extends CASTBaseDeclSpecifier implements
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#addEnumerator(org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator)
|
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#addEnumerator(org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator)
|
||||||
*/
|
*/
|
||||||
public void addEnumerator(IASTEnumerator enumerator) {
|
public void addEnumerator(IASTEnumerator enumerator) {
|
||||||
enumerators = (IASTEnumerator[]) ArrayUtil.append( IASTEnumerator.class, enumerators, enumerator );
|
if (enumerator != null) {
|
||||||
|
enumeratorsPos++;
|
||||||
|
enumerators = (IASTEnumerator[]) ArrayUtil.append( IASTEnumerator.class, enumerators, enumerator );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -34,10 +37,12 @@ public class CASTEnumerationSpecifier extends CASTBaseDeclSpecifier implements
|
||||||
*/
|
*/
|
||||||
public IASTEnumerator[] getEnumerators() {
|
public IASTEnumerator[] getEnumerators() {
|
||||||
if( enumerators == null ) return IASTEnumerator.EMPTY_ENUMERATOR_ARRAY;
|
if( enumerators == null ) return IASTEnumerator.EMPTY_ENUMERATOR_ARRAY;
|
||||||
return (IASTEnumerator[]) ArrayUtil.removeNulls( IASTEnumerator.class, enumerators );
|
enumerators = (IASTEnumerator[]) ArrayUtil.removeNullsAfter( IASTEnumerator.class, enumerators, enumeratorsPos );
|
||||||
|
return enumerators;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IASTEnumerator [] enumerators = null;
|
private IASTEnumerator [] enumerators = null;
|
||||||
|
private int enumeratorsPos=-1;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#setName(org.eclipse.cdt.core.dom.ast.IASTName)
|
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#setName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
|
|
|
@ -21,6 +21,7 @@ public class CASTFunctionDeclarator extends CASTDeclarator implements
|
||||||
IASTStandardFunctionDeclarator {
|
IASTStandardFunctionDeclarator {
|
||||||
|
|
||||||
private IASTParameterDeclaration [] parameters = null;
|
private IASTParameterDeclaration [] parameters = null;
|
||||||
|
private int parametersPos=-1;
|
||||||
private boolean varArgs;
|
private boolean varArgs;
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,14 +31,18 @@ public class CASTFunctionDeclarator extends CASTDeclarator implements
|
||||||
*/
|
*/
|
||||||
public IASTParameterDeclaration[] getParameters() {
|
public IASTParameterDeclaration[] getParameters() {
|
||||||
if( parameters == null ) return IASTParameterDeclaration.EMPTY_PARAMETERDECLARATION_ARRAY;
|
if( parameters == null ) return IASTParameterDeclaration.EMPTY_PARAMETERDECLARATION_ARRAY;
|
||||||
return (IASTParameterDeclaration[]) ArrayUtil.removeNulls( IASTParameterDeclaration.class, parameters );
|
parameters = (IASTParameterDeclaration[]) ArrayUtil.removeNullsAfter( IASTParameterDeclaration.class, parameters, parametersPos );
|
||||||
|
return parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator#addParameterDeclaration(org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration)
|
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator#addParameterDeclaration(org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration)
|
||||||
*/
|
*/
|
||||||
public void addParameterDeclaration(IASTParameterDeclaration parameter) {
|
public void addParameterDeclaration(IASTParameterDeclaration parameter) {
|
||||||
parameters = (IASTParameterDeclaration[]) ArrayUtil.append( IASTParameterDeclaration.class, parameters, parameter );
|
if (parameter != null) {
|
||||||
|
parametersPos++;
|
||||||
|
parameters = (IASTParameterDeclaration[]) ArrayUtil.append( IASTParameterDeclaration.class, parameters, parameter );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -26,15 +26,20 @@ public class CASTInitializerList extends CASTNode implements
|
||||||
*/
|
*/
|
||||||
public IASTInitializer[] getInitializers() {
|
public IASTInitializer[] getInitializers() {
|
||||||
if( initializers == null ) return IASTInitializer.EMPTY_INITIALIZER_ARRAY;
|
if( initializers == null ) return IASTInitializer.EMPTY_INITIALIZER_ARRAY;
|
||||||
return (IASTInitializer[]) ArrayUtil.removeNulls( IASTInitializer.class, initializers );
|
initializers = (IASTInitializer[]) ArrayUtil.removeNullsAfter( IASTInitializer.class, initializers, initializersPos );
|
||||||
|
return initializers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addInitializer( IASTInitializer d )
|
public void addInitializer( IASTInitializer d )
|
||||||
{
|
{
|
||||||
initializers = (IASTInitializer[]) ArrayUtil.append( IASTInitializer.class, initializers, d );
|
if (d != null) {
|
||||||
|
initializersPos++;
|
||||||
|
initializers = (IASTInitializer[]) ArrayUtil.append( IASTInitializer.class, initializers, d );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private IASTInitializer [] initializers = null;
|
private IASTInitializer [] initializers = null;
|
||||||
|
private int initializersPos=-1;
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
if( action.shouldVisitInitializers ){
|
if( action.shouldVisitInitializers ){
|
||||||
|
|
|
@ -34,16 +34,21 @@ public class CASTSimpleDeclaration extends CASTNode implements
|
||||||
*/
|
*/
|
||||||
public IASTDeclarator[] getDeclarators() {
|
public IASTDeclarator[] getDeclarators() {
|
||||||
if( declarators == null ) return IASTDeclarator.EMPTY_DECLARATOR_ARRAY;
|
if( declarators == null ) return IASTDeclarator.EMPTY_DECLARATOR_ARRAY;
|
||||||
return (IASTDeclarator[]) ArrayUtil.removeNulls( IASTDeclarator.class, declarators );
|
declarators = (IASTDeclarator[]) ArrayUtil.removeNullsAfter( IASTDeclarator.class, declarators, declaratorsPos );
|
||||||
|
return declarators;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addDeclarator( IASTDeclarator d )
|
public void addDeclarator( IASTDeclarator d )
|
||||||
{
|
{
|
||||||
declarators = (IASTDeclarator[]) ArrayUtil.append( IASTDeclarator.class, declarators, d );
|
if (d != null) {
|
||||||
|
declaratorsPos++;
|
||||||
|
declarators = (IASTDeclarator[]) ArrayUtil.append( IASTDeclarator.class, declarators, d );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private IASTDeclarator [] declarators = null;
|
private IASTDeclarator [] declarators = null;
|
||||||
|
private int declaratorsPos=-1;
|
||||||
private IASTDeclSpecifier declSpecifier;
|
private IASTDeclSpecifier declSpecifier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -50,6 +50,7 @@ public class CASTTranslationUnit extends CASTNode implements
|
||||||
IASTTranslationUnit, IRequiresLocationInformation {
|
IASTTranslationUnit, IRequiresLocationInformation {
|
||||||
|
|
||||||
private IASTDeclaration[] decls = null;
|
private IASTDeclaration[] decls = null;
|
||||||
|
private int declsPos=-1;
|
||||||
|
|
||||||
// Binding
|
// Binding
|
||||||
private CScope compilationUnit = null;
|
private CScope compilationUnit = null;
|
||||||
|
@ -71,7 +72,10 @@ public class CASTTranslationUnit extends CASTNode implements
|
||||||
private static final IASTName[] EMPTY_NAME_ARRAY = new IASTName[0];
|
private static final IASTName[] EMPTY_NAME_ARRAY = new IASTName[0];
|
||||||
|
|
||||||
public void addDeclaration(IASTDeclaration d) {
|
public void addDeclaration(IASTDeclaration d) {
|
||||||
decls = (IASTDeclaration[]) ArrayUtil.append( IASTDeclaration.class, decls, d );
|
if (d != null) {
|
||||||
|
declsPos++;
|
||||||
|
decls = (IASTDeclaration[]) ArrayUtil.append( IASTDeclaration.class, decls, d );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -81,7 +85,8 @@ public class CASTTranslationUnit extends CASTNode implements
|
||||||
*/
|
*/
|
||||||
public IASTDeclaration[] getDeclarations() {
|
public IASTDeclaration[] getDeclarations() {
|
||||||
if (decls == null) return IASTDeclaration.EMPTY_DECLARATION_ARRAY;
|
if (decls == null) return IASTDeclaration.EMPTY_DECLARATION_ARRAY;
|
||||||
return (IASTDeclaration[]) ArrayUtil.removeNulls( IASTDeclaration.class, decls );
|
decls = (IASTDeclaration[]) ArrayUtil.removeNullsAfter( IASTDeclaration.class, decls, declsPos );
|
||||||
|
return decls;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -29,17 +29,22 @@ public abstract class CPPASTAmbiguity extends CPPASTNode {
|
||||||
|
|
||||||
protected static class CPPASTNameCollector extends CPPASTVisitor {
|
protected static class CPPASTNameCollector extends CPPASTVisitor {
|
||||||
private IASTName[] names = new IASTName[2];
|
private IASTName[] names = new IASTName[2];
|
||||||
|
private int namesPos=-1;
|
||||||
{
|
{
|
||||||
shouldVisitNames = true;
|
shouldVisitNames = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int visit(IASTName name) {
|
public int visit(IASTName name) {
|
||||||
names = (IASTName[]) ArrayUtil.append(IASTName.class, names, name);
|
if (name != null) {
|
||||||
|
namesPos++;
|
||||||
|
names = (IASTName[]) ArrayUtil.append(IASTName.class, names, name);
|
||||||
|
}
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTName[] getNames() {
|
public IASTName[] getNames() {
|
||||||
return (IASTName[]) ArrayUtil.removeNulls(IASTName.class, names);
|
names = (IASTName[]) ArrayUtil.removeNullsAfter(IASTName.class, names, namesPos);
|
||||||
|
return names;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,14 +23,18 @@ public class CPPASTAmbiguousDeclaration extends CPPASTAmbiguity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private IASTDeclaration [] decls = new IASTDeclaration[2];
|
private IASTDeclaration [] decls = new IASTDeclaration[2];
|
||||||
|
private int declsPos=-1;
|
||||||
|
|
||||||
public void addDeclaration(IASTDeclaration d) {
|
public void addDeclaration(IASTDeclaration d) {
|
||||||
decls = (IASTDeclaration[]) ArrayUtil.append(IASTDeclaration.class, decls, d );
|
if (d != null) {
|
||||||
|
declsPos++;
|
||||||
|
decls = (IASTDeclaration[]) ArrayUtil.append(IASTDeclaration.class, decls, d );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTDeclaration[] getDeclarations() {
|
public IASTDeclaration[] getDeclarations() {
|
||||||
return (IASTDeclaration[]) ArrayUtil.removeNulls( IASTDeclaration.class, decls );
|
decls = (IASTDeclaration[]) ArrayUtil.removeNullsAfter( IASTDeclaration.class, decls, declsPos );
|
||||||
|
return decls;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,13 +19,18 @@ public class CPPASTAmbiguousExpression extends CPPASTAmbiguity implements
|
||||||
IASTAmbiguousExpression {
|
IASTAmbiguousExpression {
|
||||||
|
|
||||||
private IASTExpression [] exp = new IASTExpression[2];
|
private IASTExpression [] exp = new IASTExpression[2];
|
||||||
|
private int expPos=-1;
|
||||||
|
|
||||||
public void addExpression(IASTExpression e) {
|
public void addExpression(IASTExpression e) {
|
||||||
exp = (IASTExpression[]) ArrayUtil.append( IASTExpression.class, exp, e );
|
if (e != null) {
|
||||||
|
expPos++;
|
||||||
|
exp = (IASTExpression[]) ArrayUtil.append( IASTExpression.class, exp, e );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTExpression[] getExpressions() {
|
public IASTExpression[] getExpressions() {
|
||||||
return (IASTExpression[]) ArrayUtil.removeNulls( IASTExpression.class, exp );
|
exp = (IASTExpression[]) ArrayUtil.removeNullsAfter( IASTExpression.class, exp, expPos );
|
||||||
|
return exp;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IASTNode[] getNodes() {
|
protected IASTNode[] getNodes() {
|
||||||
|
|
|
@ -19,13 +19,18 @@ public class CPPASTAmbiguousStatement extends CPPASTAmbiguity implements
|
||||||
IASTAmbiguousStatement {
|
IASTAmbiguousStatement {
|
||||||
|
|
||||||
private IASTStatement [] stmts = new IASTStatement[2];
|
private IASTStatement [] stmts = new IASTStatement[2];
|
||||||
|
private int stmtsPos=-1;
|
||||||
|
|
||||||
public void addStatement(IASTStatement s) {
|
public void addStatement(IASTStatement s) {
|
||||||
stmts = (IASTStatement[]) ArrayUtil.append( IASTStatement.class, stmts, s );
|
if (s != null) {
|
||||||
|
stmtsPos++;
|
||||||
|
stmts = (IASTStatement[]) ArrayUtil.append( IASTStatement.class, stmts, s );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTStatement[] getStatements() {
|
public IASTStatement[] getStatements() {
|
||||||
return (IASTStatement[]) ArrayUtil.removeNulls( IASTStatement.class, stmts );
|
stmts = (IASTStatement[]) ArrayUtil.removeNullsAfter( IASTStatement.class, stmts, stmtsPos );
|
||||||
|
return stmts;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IASTNode[] getNodes() {
|
protected IASTNode[] getNodes() {
|
||||||
|
|
|
@ -23,15 +23,19 @@ public class CPPASTArrayDeclarator extends CPPASTDeclarator implements
|
||||||
IASTArrayDeclarator {
|
IASTArrayDeclarator {
|
||||||
|
|
||||||
private IASTArrayModifier [] arrayMods = null;
|
private IASTArrayModifier [] arrayMods = null;
|
||||||
|
private int arrayModsPos=-1;
|
||||||
|
|
||||||
public IASTArrayModifier[] getArrayModifiers() {
|
public IASTArrayModifier[] getArrayModifiers() {
|
||||||
if( arrayMods == null ) return IASTArrayModifier.EMPTY_ARRAY;
|
if( arrayMods == null ) return IASTArrayModifier.EMPTY_ARRAY;
|
||||||
return (IASTArrayModifier[]) ArrayUtil.removeNulls( IASTArrayModifier.class, arrayMods );
|
arrayMods = (IASTArrayModifier[]) ArrayUtil.removeNullsAfter( IASTArrayModifier.class, arrayMods, arrayModsPos );
|
||||||
|
return arrayMods;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addArrayModifier(IASTArrayModifier arrayModifier) {
|
public void addArrayModifier(IASTArrayModifier arrayModifier) {
|
||||||
arrayMods = (IASTArrayModifier[]) ArrayUtil.append( IASTArrayModifier.class, arrayMods, arrayModifier );
|
if (arrayModifier != null) {
|
||||||
|
arrayModsPos++;
|
||||||
|
arrayMods = (IASTArrayModifier[]) ArrayUtil.append( IASTArrayModifier.class, arrayMods, arrayModifier );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean postAccept( ASTVisitor action ){
|
protected boolean postAccept( ASTVisitor action ){
|
||||||
|
|
|
@ -41,14 +41,18 @@ public class CPPASTCompositeTypeSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
*/
|
*/
|
||||||
public ICPPASTBaseSpecifier[] getBaseSpecifiers() {
|
public ICPPASTBaseSpecifier[] getBaseSpecifiers() {
|
||||||
if( baseSpecs == null ) return ICPPASTBaseSpecifier.EMPTY_BASESPECIFIER_ARRAY;
|
if( baseSpecs == null ) return ICPPASTBaseSpecifier.EMPTY_BASESPECIFIER_ARRAY;
|
||||||
return (ICPPASTBaseSpecifier[]) ArrayUtil.removeNulls( ICPPASTBaseSpecifier.class, baseSpecs );
|
baseSpecs = (ICPPASTBaseSpecifier[]) ArrayUtil.removeNullsAfter( ICPPASTBaseSpecifier.class, baseSpecs, baseSpecsPos );
|
||||||
|
return baseSpecs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier#addBaseSpecifier(org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier)
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier#addBaseSpecifier(org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier)
|
||||||
*/
|
*/
|
||||||
public void addBaseSpecifier(ICPPASTBaseSpecifier baseSpec) {
|
public void addBaseSpecifier(ICPPASTBaseSpecifier baseSpec) {
|
||||||
baseSpecs = (ICPPASTBaseSpecifier[]) ArrayUtil.append( ICPPASTBaseSpecifier.class, baseSpecs, baseSpec );
|
if (baseSpec != null) {
|
||||||
|
baseSpecsPos++;
|
||||||
|
baseSpecs = (ICPPASTBaseSpecifier[]) ArrayUtil.append( ICPPASTBaseSpecifier.class, baseSpecs, baseSpec );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -98,6 +102,7 @@ public class CPPASTCompositeTypeSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
|
|
||||||
private IASTDeclaration [] declarations = new IASTDeclaration[4];
|
private IASTDeclaration [] declarations = new IASTDeclaration[4];
|
||||||
private ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier [] baseSpecs = null;
|
private ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier [] baseSpecs = null;
|
||||||
|
private int baseSpecsPos=-1;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#getScope()
|
* @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#getScope()
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class CPPASTDeclarator extends CPPASTNode implements IASTDeclarator {
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
private IASTDeclarator nestedDeclarator;
|
private IASTDeclarator nestedDeclarator;
|
||||||
private IASTPointerOperator [] pointerOps = null;
|
private IASTPointerOperator [] pointerOps = null;
|
||||||
|
private int pointerOpsPos=-1;
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -41,7 +41,8 @@ public class CPPASTDeclarator extends CPPASTNode implements IASTDeclarator {
|
||||||
*/
|
*/
|
||||||
public IASTPointerOperator[] getPointerOperators() {
|
public IASTPointerOperator[] getPointerOperators() {
|
||||||
if( pointerOps == null ) return IASTPointerOperator.EMPTY_ARRAY;
|
if( pointerOps == null ) return IASTPointerOperator.EMPTY_ARRAY;
|
||||||
return (IASTPointerOperator[]) ArrayUtil.removeNulls( IASTPointerOperator.class, pointerOps );
|
pointerOps = (IASTPointerOperator[]) ArrayUtil.removeNullsAfter( IASTPointerOperator.class, pointerOps, pointerOpsPos );
|
||||||
|
return pointerOps;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -76,7 +77,10 @@ public class CPPASTDeclarator extends CPPASTNode implements IASTDeclarator {
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#addPointerOperator(org.eclipse.cdt.core.dom.ast.IASTPointerOperator)
|
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#addPointerOperator(org.eclipse.cdt.core.dom.ast.IASTPointerOperator)
|
||||||
*/
|
*/
|
||||||
public void addPointerOperator(IASTPointerOperator operator) {
|
public void addPointerOperator(IASTPointerOperator operator) {
|
||||||
pointerOps = (IASTPointerOperator[]) ArrayUtil.append( IASTPointerOperator.class, pointerOps, operator );
|
if (operator != null) {
|
||||||
|
pointerOpsPos++;
|
||||||
|
pointerOps = (IASTPointerOperator[]) ArrayUtil.append( IASTPointerOperator.class, pointerOps, operator );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -30,7 +30,10 @@ public class CPPASTEnumerationSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#addEnumerator(org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator)
|
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#addEnumerator(org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator)
|
||||||
*/
|
*/
|
||||||
public void addEnumerator(IASTEnumerator enumerator) {
|
public void addEnumerator(IASTEnumerator enumerator) {
|
||||||
enumerators = (IASTEnumerator[]) ArrayUtil.append( IASTEnumerator.class, enumerators, enumerator );
|
if (enumerator != null) {
|
||||||
|
enumeratorsPos++;
|
||||||
|
enumerators = (IASTEnumerator[]) ArrayUtil.append( IASTEnumerator.class, enumerators, enumerator );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -41,11 +44,13 @@ public class CPPASTEnumerationSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
public IASTEnumerator[] getEnumerators() {
|
public IASTEnumerator[] getEnumerators() {
|
||||||
if (enumerators == null)
|
if (enumerators == null)
|
||||||
return IASTEnumerator.EMPTY_ENUMERATOR_ARRAY;
|
return IASTEnumerator.EMPTY_ENUMERATOR_ARRAY;
|
||||||
return (IASTEnumerator[]) ArrayUtil.removeNulls( IASTEnumerator.class, enumerators );
|
enumerators = (IASTEnumerator[]) ArrayUtil.removeNullsAfter( IASTEnumerator.class, enumerators, enumeratorsPos );
|
||||||
|
return enumerators;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private IASTEnumerator[] enumerators = null;
|
private IASTEnumerator[] enumerators = null;
|
||||||
|
private int enumeratorsPos=-1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
|
|
|
@ -29,6 +29,7 @@ public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements
|
||||||
ICPPASTFunctionDeclarator {
|
ICPPASTFunctionDeclarator {
|
||||||
|
|
||||||
private IASTParameterDeclaration [] parameters = null;
|
private IASTParameterDeclaration [] parameters = null;
|
||||||
|
private int parametersPos=-1;
|
||||||
private ICPPFunctionScope scope = null;
|
private ICPPFunctionScope scope = null;
|
||||||
private boolean varArgs;
|
private boolean varArgs;
|
||||||
private boolean pureVirtual;
|
private boolean pureVirtual;
|
||||||
|
@ -42,14 +43,18 @@ public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements
|
||||||
*/
|
*/
|
||||||
public IASTParameterDeclaration [] getParameters() {
|
public IASTParameterDeclaration [] getParameters() {
|
||||||
if( parameters == null ) return IASTParameterDeclaration.EMPTY_PARAMETERDECLARATION_ARRAY;
|
if( parameters == null ) return IASTParameterDeclaration.EMPTY_PARAMETERDECLARATION_ARRAY;
|
||||||
return (IASTParameterDeclaration[]) ArrayUtil.removeNulls( IASTParameterDeclaration.class, parameters );
|
parameters = (IASTParameterDeclaration[]) ArrayUtil.removeNullsAfter( IASTParameterDeclaration.class, parameters, parametersPos );
|
||||||
|
return parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator#addParameterDeclaration(org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration)
|
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator#addParameterDeclaration(org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration)
|
||||||
*/
|
*/
|
||||||
public void addParameterDeclaration(IASTParameterDeclaration parameter) {
|
public void addParameterDeclaration(IASTParameterDeclaration parameter) {
|
||||||
parameters = (IASTParameterDeclaration []) ArrayUtil.append( IASTParameterDeclaration.class, parameters, parameter );
|
if (parameter != null) {
|
||||||
|
parametersPos++;
|
||||||
|
parameters = (IASTParameterDeclaration []) ArrayUtil.append( IASTParameterDeclaration.class, parameters, parameter );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -99,12 +104,14 @@ public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private IASTTypeId [] typeIds = null;
|
private IASTTypeId [] typeIds = null;
|
||||||
|
private int typeIdsPos=-1;
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#getExceptionSpecification()
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#getExceptionSpecification()
|
||||||
*/
|
*/
|
||||||
public IASTTypeId[] getExceptionSpecification() {
|
public IASTTypeId[] getExceptionSpecification() {
|
||||||
if( typeIds == null ) return IASTTypeId.EMPTY_TYPEID_ARRAY;
|
if( typeIds == null ) return IASTTypeId.EMPTY_TYPEID_ARRAY;
|
||||||
return (IASTTypeId[]) ArrayUtil.removeNulls( IASTTypeId.class, typeIds );
|
typeIds = (IASTTypeId[]) ArrayUtil.removeNullsAfter( IASTTypeId.class, typeIds, typeIdsPos );
|
||||||
|
return typeIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -112,7 +119,10 @@ public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#addExceptionSpecificationTypeId(org.eclipse.cdt.core.dom.ast.IASTTypeId)
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#addExceptionSpecificationTypeId(org.eclipse.cdt.core.dom.ast.IASTTypeId)
|
||||||
*/
|
*/
|
||||||
public void addExceptionSpecificationTypeId(IASTTypeId typeId) {
|
public void addExceptionSpecificationTypeId(IASTTypeId typeId) {
|
||||||
typeIds = (IASTTypeId[]) ArrayUtil.append( IASTTypeId.class, typeIds, typeId );
|
if (typeId != null) {
|
||||||
|
typeIdsPos++;
|
||||||
|
typeIds = (IASTTypeId[]) ArrayUtil.append( IASTTypeId.class, typeIds, typeId );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -133,13 +143,15 @@ public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements
|
||||||
|
|
||||||
|
|
||||||
private ICPPASTConstructorChainInitializer [] constructorChain = null;
|
private ICPPASTConstructorChainInitializer [] constructorChain = null;
|
||||||
|
private int constructorChainPos=-1;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#getConstructorChain()
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#getConstructorChain()
|
||||||
*/
|
*/
|
||||||
public ICPPASTConstructorChainInitializer[] getConstructorChain() {
|
public ICPPASTConstructorChainInitializer[] getConstructorChain() {
|
||||||
if( constructorChain == null ) return ICPPASTConstructorChainInitializer.EMPTY_CONSTRUCTORCHAININITIALIZER_ARRAY;
|
if( constructorChain == null ) return ICPPASTConstructorChainInitializer.EMPTY_CONSTRUCTORCHAININITIALIZER_ARRAY;
|
||||||
return (ICPPASTConstructorChainInitializer[]) ArrayUtil.removeNulls( ICPPASTConstructorChainInitializer.class, constructorChain );
|
constructorChain = (ICPPASTConstructorChainInitializer[]) ArrayUtil.removeNullsAfter( ICPPASTConstructorChainInitializer.class, constructorChain, constructorChainPos );
|
||||||
|
return constructorChain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -147,7 +159,10 @@ public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#addConstructorToChain(org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer)
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#addConstructorToChain(org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer)
|
||||||
*/
|
*/
|
||||||
public void addConstructorToChain(ICPPASTConstructorChainInitializer initializer) {
|
public void addConstructorToChain(ICPPASTConstructorChainInitializer initializer) {
|
||||||
constructorChain = (ICPPASTConstructorChainInitializer[]) ArrayUtil.append( ICPPASTConstructorChainInitializer.class, constructorChain, initializer );
|
if (initializer != null) {
|
||||||
|
constructorChainPos++;
|
||||||
|
constructorChain = (ICPPASTConstructorChainInitializer[]) ArrayUtil.append( ICPPASTConstructorChainInitializer.class, constructorChain, initializer );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPFunctionScope getFunctionScope(){
|
public ICPPFunctionScope getFunctionScope(){
|
||||||
|
|
|
@ -25,7 +25,10 @@ public class CPPASTFunctionTryBlockDeclarator extends CPPASTFunctionDeclarator
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionTryBlockDeclarator#addCatchHandler(org.eclipse.cdt.core.dom.ast.IASTStatement)
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionTryBlockDeclarator#addCatchHandler(org.eclipse.cdt.core.dom.ast.IASTStatement)
|
||||||
*/
|
*/
|
||||||
public void addCatchHandler(ICPPASTCatchHandler statement) {
|
public void addCatchHandler(ICPPASTCatchHandler statement) {
|
||||||
catchHandlers = (ICPPASTCatchHandler[]) ArrayUtil.append( ICPPASTCatchHandler.class, catchHandlers, statement );
|
if (statement != null) {
|
||||||
|
catchHandlersPos++;
|
||||||
|
catchHandlers = (ICPPASTCatchHandler[]) ArrayUtil.append( ICPPASTCatchHandler.class, catchHandlers, statement );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -33,11 +36,13 @@ public class CPPASTFunctionTryBlockDeclarator extends CPPASTFunctionDeclarator
|
||||||
*/
|
*/
|
||||||
public ICPPASTCatchHandler [] getCatchHandlers() {
|
public ICPPASTCatchHandler [] getCatchHandlers() {
|
||||||
if( catchHandlers == null ) return ICPPASTCatchHandler.EMPTY_CATCHHANDLER_ARRAY;
|
if( catchHandlers == null ) return ICPPASTCatchHandler.EMPTY_CATCHHANDLER_ARRAY;
|
||||||
return (ICPPASTCatchHandler[]) ArrayUtil.removeNulls( ICPPASTCatchHandler.class, catchHandlers );
|
catchHandlers = (ICPPASTCatchHandler[]) ArrayUtil.removeNullsAfter( ICPPASTCatchHandler.class, catchHandlers, catchHandlersPos );
|
||||||
|
return catchHandlers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private ICPPASTCatchHandler [] catchHandlers = null;
|
private ICPPASTCatchHandler [] catchHandlers = null;
|
||||||
|
private int catchHandlersPos=-1;
|
||||||
protected boolean postAccept( ASTVisitor action ){
|
protected boolean postAccept( ASTVisitor action ){
|
||||||
if( !super.postAccept( action ) ) return false;
|
if( !super.postAccept( action ) ) return false;
|
||||||
|
|
||||||
|
|
|
@ -27,16 +27,21 @@ public class CPPASTInitializerList extends CPPASTNode implements
|
||||||
*/
|
*/
|
||||||
public IASTInitializer [] getInitializers() {
|
public IASTInitializer [] getInitializers() {
|
||||||
if( initializers == null ) return IASTInitializer.EMPTY_INITIALIZER_ARRAY;
|
if( initializers == null ) return IASTInitializer.EMPTY_INITIALIZER_ARRAY;
|
||||||
return (IASTInitializer[]) ArrayUtil.removeNulls( IASTInitializer.class, initializers );
|
initializers = (IASTInitializer[]) ArrayUtil.removeNullsAfter( IASTInitializer.class, initializers, initializersPos );
|
||||||
|
return initializers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addInitializer( IASTInitializer d )
|
public void addInitializer( IASTInitializer d )
|
||||||
{
|
{
|
||||||
initializers = (IASTInitializer[]) ArrayUtil.append( IASTInitializer.class, initializers, d );
|
if (d != null) {
|
||||||
|
initializersPos++;
|
||||||
|
initializers = (IASTInitializer[]) ArrayUtil.append( IASTInitializer.class, initializers, d );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private IASTInitializer [] initializers = null;
|
private IASTInitializer [] initializers = null;
|
||||||
|
private int initializersPos=-1;
|
||||||
|
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
if( action.shouldVisitInitializers ){
|
if( action.shouldVisitInitializers ){
|
||||||
|
|
|
@ -66,18 +66,21 @@ public class CPPASTQualifiedName extends CPPASTNode implements
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName#addName(org.eclipse.cdt.core.dom.ast.IASTName)
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName#addName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
*/
|
*/
|
||||||
public void addName(IASTName name) {
|
public void addName(IASTName name) {
|
||||||
names = (IASTName[]) ArrayUtil.append( IASTName.class, names, name );
|
if (name != null) {
|
||||||
|
namesPos++;
|
||||||
|
names = (IASTName[]) ArrayUtil.append( IASTName.class, names, name );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param decls2
|
* @param decls2
|
||||||
*/
|
*/
|
||||||
private void removeNullNames() {
|
private void removeNullNames() {
|
||||||
names = (IASTName[]) ArrayUtil.removeNulls( IASTName.class, names );
|
names = (IASTName[]) ArrayUtil.removeNullsAfter( IASTName.class, names, namesPos );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IASTName[] names = null;
|
private IASTName[] names = null;
|
||||||
|
private int namesPos=-1;
|
||||||
private boolean value;
|
private boolean value;
|
||||||
private String signature;
|
private String signature;
|
||||||
|
|
||||||
|
|
|
@ -36,15 +36,20 @@ public class CPPASTSimpleDeclaration extends CPPASTNode implements
|
||||||
*/
|
*/
|
||||||
public IASTDeclarator[] getDeclarators() {
|
public IASTDeclarator[] getDeclarators() {
|
||||||
if( declarators == null ) return IASTDeclarator.EMPTY_DECLARATOR_ARRAY;
|
if( declarators == null ) return IASTDeclarator.EMPTY_DECLARATOR_ARRAY;
|
||||||
return (IASTDeclarator[]) ArrayUtil.removeNulls( IASTDeclarator.class, declarators );
|
declarators = (IASTDeclarator[]) ArrayUtil.removeNullsAfter( IASTDeclarator.class, declarators, declaratorsPos );
|
||||||
|
return declarators;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addDeclarator( IASTDeclarator d )
|
public void addDeclarator( IASTDeclarator d )
|
||||||
{
|
{
|
||||||
declarators = (IASTDeclarator[]) ArrayUtil.append( IASTDeclarator.class, declarators, d );
|
if (d != null) {
|
||||||
|
declaratorsPos++;
|
||||||
|
declarators = (IASTDeclarator[]) ArrayUtil.append( IASTDeclarator.class, declarators, d );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private IASTDeclarator [] declarators = null;
|
private IASTDeclarator [] declarators = null;
|
||||||
|
private int declaratorsPos=-1;
|
||||||
private IASTDeclSpecifier declSpecifier;
|
private IASTDeclSpecifier declSpecifier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -62,17 +62,22 @@ public class CPPASTTemplateDeclaration extends CPPASTNode implements
|
||||||
*/
|
*/
|
||||||
public ICPPASTTemplateParameter [] getTemplateParameters() {
|
public ICPPASTTemplateParameter [] getTemplateParameters() {
|
||||||
if( parameters == null ) return ICPPASTTemplateParameter.EMPTY_TEMPLATEPARAMETER_ARRAY;
|
if( parameters == null ) return ICPPASTTemplateParameter.EMPTY_TEMPLATEPARAMETER_ARRAY;
|
||||||
return (ICPPASTTemplateParameter[]) ArrayUtil.removeNulls( ICPPASTTemplateParameter.class, parameters );
|
parameters = (ICPPASTTemplateParameter[]) ArrayUtil.removeNullsAfter( ICPPASTTemplateParameter.class, parameters, parametersPos );
|
||||||
|
return parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration#addTemplateParamter(org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter)
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration#addTemplateParamter(org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter)
|
||||||
*/
|
*/
|
||||||
public void addTemplateParamter(ICPPASTTemplateParameter parm) {
|
public void addTemplateParamter(ICPPASTTemplateParameter parm) {
|
||||||
parameters = (ICPPASTTemplateParameter[]) ArrayUtil.append( ICPPASTTemplateParameter.class, parameters, parm );
|
if (parm != null) {
|
||||||
|
parametersPos++;
|
||||||
|
parameters = (ICPPASTTemplateParameter[]) ArrayUtil.append( ICPPASTTemplateParameter.class, parameters, parm );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ICPPASTTemplateParameter [] parameters = null;
|
private ICPPASTTemplateParameter [] parameters = null;
|
||||||
|
private int parametersPos=-1;
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept( ASTVisitor action ){
|
||||||
if( action.shouldVisitDeclarations ){
|
if( action.shouldVisitDeclarations ){
|
||||||
switch( action.visit( this ) ){
|
switch( action.visit( this ) ){
|
||||||
|
|
|
@ -28,14 +28,19 @@ public class CPPASTTemplatedTypeTemplateParameter extends CPPASTNode implements
|
||||||
|
|
||||||
public ICPPASTTemplateParameter[] getTemplateParameters() {
|
public ICPPASTTemplateParameter[] getTemplateParameters() {
|
||||||
if( parameters == null ) return ICPPASTTemplateParameter.EMPTY_TEMPLATEPARAMETER_ARRAY;
|
if( parameters == null ) return ICPPASTTemplateParameter.EMPTY_TEMPLATEPARAMETER_ARRAY;
|
||||||
return (ICPPASTTemplateParameter[]) ArrayUtil.removeNulls( ICPPASTTemplateParameter.class, parameters );
|
parameters = (ICPPASTTemplateParameter[]) ArrayUtil.removeNullsAfter( ICPPASTTemplateParameter.class, parameters, parametersPos );
|
||||||
|
return parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addTemplateParamter(ICPPASTTemplateParameter parm) {
|
public void addTemplateParamter(ICPPASTTemplateParameter parm) {
|
||||||
parameters = (ICPPASTTemplateParameter[]) ArrayUtil.append( ICPPASTTemplateParameter.class, parameters, parm );
|
if(parm != null) {
|
||||||
|
parametersPos++;
|
||||||
|
parameters = (ICPPASTTemplateParameter[]) ArrayUtil.append( ICPPASTTemplateParameter.class, parameters, parm );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ICPPASTTemplateParameter [] parameters = null;
|
private ICPPASTTemplateParameter [] parameters = null;
|
||||||
|
private int parametersPos=-1;
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
private IASTExpression defaultValue;
|
private IASTExpression defaultValue;
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,10 @@ public class CPPASTTryBlockStatement extends CPPASTNode implements
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionTryBlockDeclarator#addCatchHandler(org.eclipse.cdt.core.dom.ast.IASTStatement)
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionTryBlockDeclarator#addCatchHandler(org.eclipse.cdt.core.dom.ast.IASTStatement)
|
||||||
*/
|
*/
|
||||||
public void addCatchHandler(ICPPASTCatchHandler statement) {
|
public void addCatchHandler(ICPPASTCatchHandler statement) {
|
||||||
catchHandlers = (ICPPASTCatchHandler[]) ArrayUtil.append( ICPPASTCatchHandler.class, catchHandlers, statement );
|
if (statement != null) {
|
||||||
|
catchHandlersPos++;
|
||||||
|
catchHandlers = (ICPPASTCatchHandler[]) ArrayUtil.append( ICPPASTCatchHandler.class, catchHandlers, statement );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -36,11 +39,13 @@ public class CPPASTTryBlockStatement extends CPPASTNode implements
|
||||||
*/
|
*/
|
||||||
public ICPPASTCatchHandler[] getCatchHandlers() {
|
public ICPPASTCatchHandler[] getCatchHandlers() {
|
||||||
if( catchHandlers == null ) return ICPPASTCatchHandler.EMPTY_CATCHHANDLER_ARRAY;
|
if( catchHandlers == null ) return ICPPASTCatchHandler.EMPTY_CATCHHANDLER_ARRAY;
|
||||||
return (ICPPASTCatchHandler[]) ArrayUtil.removeNulls( ICPPASTCatchHandler.class, catchHandlers );
|
catchHandlers = (ICPPASTCatchHandler[]) ArrayUtil.removeNullsAfter( ICPPASTCatchHandler.class, catchHandlers, catchHandlersPos );
|
||||||
|
return catchHandlers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private ICPPASTCatchHandler [] catchHandlers = null;
|
private ICPPASTCatchHandler [] catchHandlers = null;
|
||||||
|
private int catchHandlersPos=-1;
|
||||||
private IASTStatement tryBody;
|
private IASTStatement tryBody;
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTryBlockStatement#setTryBody(org.eclipse.cdt.core.dom.ast.IASTStatement)
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTryBlockStatement#setTryBody(org.eclipse.cdt.core.dom.ast.IASTStatement)
|
||||||
|
|
|
@ -27,14 +27,18 @@ public class DependencyTree implements IASTTranslationUnit.IDependencyTree, IDep
|
||||||
}
|
}
|
||||||
|
|
||||||
private IASTInclusionNode [] incs = new IASTInclusionNode[2];
|
private IASTInclusionNode [] incs = new IASTInclusionNode[2];
|
||||||
|
private int incsPos=-1;
|
||||||
|
|
||||||
public IASTInclusionNode[] getInclusions() {
|
public IASTInclusionNode[] getInclusions() {
|
||||||
incs = (IASTInclusionNode[]) ArrayUtil.removeNulls( IASTInclusionNode.class, incs );
|
incs = (IASTInclusionNode[]) ArrayUtil.removeNullsAfter( IASTInclusionNode.class, incs, incsPos );
|
||||||
return incs;
|
return incs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addInclusionNode(IASTInclusionNode node) {
|
public void addInclusionNode(IASTInclusionNode node) {
|
||||||
incs = (IASTInclusionNode[]) ArrayUtil.append( IASTInclusionNode.class, incs, node );
|
if (node != null) {
|
||||||
|
incsPos++;
|
||||||
|
incs = (IASTInclusionNode[]) ArrayUtil.append( IASTInclusionNode.class, incs, node );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,14 +27,18 @@ public class InclusionNode implements IASTInclusionNode, IDependencyNodeHost {
|
||||||
}
|
}
|
||||||
|
|
||||||
private IASTInclusionNode [] incs = new IASTInclusionNode[2];
|
private IASTInclusionNode [] incs = new IASTInclusionNode[2];
|
||||||
|
private int incsPos=-1;
|
||||||
|
|
||||||
public IASTInclusionNode[] getNestedInclusions() {
|
public IASTInclusionNode[] getNestedInclusions() {
|
||||||
incs = (IASTInclusionNode[]) ArrayUtil.removeNulls( IASTInclusionNode.class, incs );
|
incs = (IASTInclusionNode[]) ArrayUtil.removeNullsAfter( IASTInclusionNode.class, incs, incsPos );
|
||||||
return incs;
|
return incs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addInclusionNode(IASTInclusionNode node) {
|
public void addInclusionNode(IASTInclusionNode node) {
|
||||||
incs = (IASTInclusionNode[]) ArrayUtil.append( IASTInclusionNode.class, incs, node );
|
if (node != null) {
|
||||||
|
incsPos++;
|
||||||
|
incs = (IASTInclusionNode[]) ArrayUtil.append( IASTInclusionNode.class, incs, node );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|
|
@ -1154,14 +1154,18 @@ public class LocationMap implements ILocationResolver, IScannerPreprocessorLog {
|
||||||
}
|
}
|
||||||
|
|
||||||
IMacroDefinition [] builtins = new IMacroDefinition[2];
|
IMacroDefinition [] builtins = new IMacroDefinition[2];
|
||||||
|
private int builtinsPos=-1;
|
||||||
|
|
||||||
public void addBuiltinMacro(IMacroDefinition def) {
|
public void addBuiltinMacro(IMacroDefinition def) {
|
||||||
builtins = (IMacroDefinition[]) ArrayUtil.append( IMacroDefinition.class, builtins, def );
|
if (def != null) {
|
||||||
|
builtinsPos++;
|
||||||
|
builtins = (IMacroDefinition[]) ArrayUtil.append( IMacroDefinition.class, builtins, def );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IMacroDefinition [] getBuiltinMacroDefinitions()
|
public IMacroDefinition [] getBuiltinMacroDefinitions()
|
||||||
{
|
{
|
||||||
builtins = (IMacroDefinition[]) ArrayUtil.removeNulls( IMacroDefinition.class, builtins );
|
builtins = (IMacroDefinition[]) ArrayUtil.removeNullsAfter( IMacroDefinition.class, builtins, builtinsPos );
|
||||||
return builtins;
|
return builtins;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue