1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 10:46:02 +02:00

Further reduce memory footprint by trimming down Declarator and DeclarationWrapper classes.

This commit is contained in:
John Camelon 2004-05-27 04:41:59 +00:00
parent 1f636f83b5
commit dc9619b241
4 changed files with 184 additions and 274 deletions

View file

@ -10,6 +10,7 @@
***********************************************************************/
package org.eclipse.cdt.internal.core.parser;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
@ -41,42 +42,61 @@ import org.eclipse.cdt.internal.core.parser.token.TokenFactory;
*/
public class DeclarationWrapper implements IDeclaratorOwner
{
private boolean imaginary, complex;
private boolean restrict;
private int flag = 0;
protected void setBit(boolean b, int mask){
if( b ){
flag = flag | mask;
} else {
flag = flag & ~mask;
}
}
protected boolean checkBit(int mask){
return (flag & mask) != 0;
}
private static final int DEFAULT_LIST_SIZE = 4;
protected static final int IS_IMAGINARY = 0x00000010;
protected static final int IS_COMPLEX = 0x00000020;
protected static final int IS_RESTRICT = 0x00000040;
protected static final int IS_SIGNED = 0x00000080;
protected static final int IS_SHORT = 0x00000100;
protected static final int IS_UNSIGNED = 0x00000200;
protected static final int IS_LONG = 0x00000400;
protected static final int IS_TYPENAMED = 0x00000800;
protected static final int IS_VOLATILE = 0x00001000;
protected static final int IS_VIRTUAL = 0x00002000;
protected static final int IS_TYPEDEF = 0x00004000;
protected static final int IS_STATIC = 0x00008000;
protected static final int IS_REGISTER = 0x00010000;
protected static final int IS_EXTERN = 0x00020000;
protected static final int IS_EXPLICIT = 0x00040000;
protected static final int IS_CONST = 0x00080000;
protected static final int IS_AUTO = 0x00100000;
protected static final int IS_GLOBAL = 0x00200000;
protected static final int IS_MUTABLE = 0x00400000;
protected static final int IS_FRIEND = 0x00800000;
protected static final int IS_INLINE = 0x01000000;
private int startingOffset = 0;
private int startingLine;
private int endOffset;
private ITokenDuple name;
private Type simpleType =
IASTSimpleTypeSpecifier.Type.UNSPECIFIED;
private boolean isSigned;
private boolean isLong;
private boolean isShort;
private boolean isUnsigned;
private Type simpleType = IASTSimpleTypeSpecifier.Type.UNSPECIFIED;
private final IASTTemplate templateDeclaration;
private final IASTScope scope;
private IASTTypeSpecifier typeSpecifier;
private List declarators = new ArrayList();
private boolean typeNamed = false;
private boolean volatil = false;
private boolean virtual = false;
private boolean typedef = false;
private boolean staticc = false;
private boolean register = false;
private boolean extern = false;
private boolean explicit = false;
private boolean constt = false;
private int startingOffset = 0;
private boolean auto = false,
mutable = false,
friend = false,
inline = false;
private int startingLine;
private boolean global = false;
private List declarators = Collections.EMPTY_LIST;
/**
* @param b
*/
public void setAuto(boolean b)
{
auto = b;
setBit( b, IS_AUTO );
}
/**
* @return
@ -86,38 +106,6 @@ public class DeclarationWrapper implements IDeclaratorOwner
return scope;
}
public DeclarationWrapper( DeclarationWrapper wrapper )
{
this( wrapper.getScope(), wrapper.getStartingOffset(), wrapper.getStartingLine(), wrapper.getOwnerTemplate() );
setAuto( wrapper.isAuto() );
setComplex( wrapper.isComplex() );
setConst( wrapper.isConst() );
setEndingOffsetAndLineNumber( wrapper.getEndOffset(), wrapper.getEndLine() );
setExplicit( wrapper.isExplicit() );
setExtern(wrapper.isExtern() );
setFriend(wrapper.isFriend());
setGloballyQualified( wrapper.isGloballyQualified() );
setImaginary( wrapper.isImaginary() );
setInline( wrapper.isInline());
setLong( wrapper.isLong() );
setMutable( wrapper.isMutable() );
setName( wrapper.getName() );
setRegister(wrapper.isRegister() );
setRestrict( wrapper.isRestrict() );
setShort(wrapper.isShort());
setSigned(wrapper.isSigned());
setSimpleType(wrapper.getSimpleType());
setStatic(wrapper.isStatic());
setTypedef(wrapper.isTypedef());
setTypenamed(wrapper.isTypeNamed());
setTypeName(wrapper.getName());
setTypeSpecifier(wrapper.getTypeSpecifier());
setUnsigned(wrapper.isUnsigned());
setVirtual(wrapper.isVirtual());
setVolatile(wrapper.isVolatile());
}
/**
* @param scope
*/
@ -136,140 +124,140 @@ public class DeclarationWrapper implements IDeclaratorOwner
*/
public void setTypenamed(boolean b)
{
typeNamed = b;
setBit( b, IS_TYPENAMED );
}
/**
* @param b
*/
public void setMutable(boolean b)
{
mutable = b;
setBit( b, IS_MUTABLE);
}
/**
* @param b
*/
public void setFriend(boolean b)
{
friend = b;
setBit( b, IS_FRIEND );
}
/**
* @param b
*/
public void setInline(boolean b)
{
inline = b;
setBit( b, IS_INLINE );
}
/**
* @param b
*/
public void setRegister(boolean b)
{
register = b;
setBit( b, IS_REGISTER );
}
/**
* @param b
*/
public void setStatic(boolean b)
{
staticc = b;
setBit( b, IS_STATIC );
}
/**
* @param b
*/
public void setTypedef(boolean b)
{
typedef = b;
setBit( b, IS_TYPEDEF );
}
/**
* @param b
*/
public void setVirtual(boolean b)
{
virtual = b;
setBit( b, IS_VIRTUAL );
}
/**
* @param b
*/
public void setVolatile(boolean b)
{
volatil = b;
setBit( b, IS_VOLATILE );
}
/**
* @param b
*/
public void setExtern(boolean b)
{
extern = b;
setBit( b, IS_EXTERN );
}
/**
* @param b
*/
public void setExplicit(boolean b)
{
explicit = b;
setBit( b, IS_EXPLICIT );
}
/**
* @param b
*/
public void setConst(boolean b)
{
constt = b;
setBit( b, IS_CONST );
}
/**
* @return
*/
public boolean isAuto()
{
return auto;
return checkBit( IS_AUTO );
}
/**
* @return
*/
public boolean isConst()
{
return constt;
return checkBit( IS_CONST );
}
/**
* @return
*/
public boolean isExplicit()
{
return explicit;
return checkBit( IS_EXPLICIT );
}
/**
* @return
*/
public boolean isExtern()
{
return extern;
return checkBit( IS_EXTERN );
}
/**
* @return
*/
public boolean isFriend()
{
return friend;
return checkBit( IS_FRIEND );
}
/**
* @return
*/
public boolean isInline()
{
return inline;
return checkBit( IS_INLINE );
}
/**
* @return
*/
public boolean isMutable()
{
return mutable;
return checkBit( IS_MUTABLE );
}
/**
* @return
*/
public boolean isRegister()
{
return register;
return checkBit( IS_REGISTER );
}
/**
* @return
@ -288,38 +276,40 @@ public class DeclarationWrapper implements IDeclaratorOwner
*/
public boolean isStatic()
{
return staticc;
return checkBit( IS_STATIC );
}
/**
* @return
*/
public boolean isTypedef()
{
return typedef;
return checkBit( IS_TYPEDEF );
}
/**
* @return
*/
public boolean isTypeNamed()
{
return typeNamed;
return checkBit( IS_TYPENAMED );
}
/**
* @return
*/
public boolean isVirtual()
{
return virtual;
return checkBit( IS_VIRTUAL );
}
/**
* @return
*/
public boolean isVolatile()
{
return volatil;
return checkBit( IS_VOLATILE );
}
public void addDeclarator(Declarator d)
{
if( declarators == Collections.EMPTY_LIST )
declarators = new ArrayList(DEFAULT_LIST_SIZE);
declarators.add(d);
}
public Iterator getDeclarators()
@ -426,8 +416,8 @@ public class DeclarationWrapper implements IDeclaratorOwner
IASTAbstractDeclaration abs = null;
abs =
astFactory.createAbstractDeclaration(
constt,
volatil,
isConst(),
isVolatile(),
getTypeSpecifier(),
declarator.getPointerOperators(),
declarator.getArrayModifiers(),
@ -436,16 +426,16 @@ public class DeclarationWrapper implements IDeclaratorOwner
ITokenDuple nameDuple = ( d.getPointerOperatorNameDuple() != null ) ? TokenFactory.createTokenDuple( d.getPointerOperatorNameDuple(), d.getNameDuple() ) : d.getNameDuple();
if( typedef )
if( isTypedef() )
return astFactory.createTypedef(scope, nameDuple.toString(), abs,
getStartingOffset(), getStartingLine(), d
.getNameStartOffset(), d.getNameEndOffset(), d
.getNameLine());
if( isWithinClass )
return astFactory.createField( scope, nameDuple, auto, d.getInitializerClause(), d.getBitFieldExpression(), abs, mutable, extern, register, staticc, getStartingOffset(), getStartingLine(), d.getNameStartOffset(), d.getNameEndOffset(), d.getNameLine(), d.getConstructorExpression(), ((IASTClassSpecifier)scope).getCurrentVisibilityMode() );
return astFactory.createField( scope, nameDuple, isAuto(), d.getInitializerClause(), d.getBitFieldExpression(), abs, isMutable(), isExtern(), isRegister(), isStatic(), getStartingOffset(), getStartingLine(), d.getNameStartOffset(), d.getNameEndOffset(), d.getNameLine(), d.getConstructorExpression(), ((IASTClassSpecifier)scope).getCurrentVisibilityMode() );
return astFactory.createVariable( scope, nameDuple, auto, d.getInitializerClause(), d.getBitFieldExpression(), abs, mutable, extern, register, staticc, getStartingOffset(), getStartingLine(), d.getNameStartOffset(), d.getNameEndOffset(), d.getNameLine(), d.getConstructorExpression() );
return astFactory.createVariable( scope, nameDuple, isAuto(), d.getInitializerClause(), d.getBitFieldExpression(), abs, isMutable(), isExtern(), isRegister(), isStatic(), getStartingOffset(), getStartingLine(), d.getNameStartOffset(), d.getNameEndOffset(), d.getNameLine(), d.getConstructorExpression() );
}
throw new BacktrackException();
@ -460,7 +450,7 @@ public class DeclarationWrapper implements IDeclaratorOwner
{
return astFactory.createTypedef(scope, nested ? declarator
.getOwnedDeclarator().getName() : declarator.getName(),
astFactory.createAbstractDeclaration(constt, volatil,
astFactory.createAbstractDeclaration(isConst(), isVolatile(),
getTypeSpecifier(), declarator.getPointerOperators(),
declarator.getArrayModifiers(), null, null),
startingOffset, getStartingLine(), declarator
@ -481,15 +471,15 @@ public class DeclarationWrapper implements IDeclaratorOwner
.getOwnedDeclarator().getNameDuple() : declarator
.getNameDuple(),
createParameterList(declarator.getParameters()), astFactory
.createAbstractDeclaration(constt, volatil,
.createAbstractDeclaration(isConst(), isVolatile(),
getTypeSpecifier(), declarator
.getPointerOperators(), declarator
.getArrayModifiers(), null, null),
declarator.getExceptionSpecification(), inline, friend,
staticc, startingOffset, getStartingLine(), declarator
declarator.getExceptionSpecification(), isInline(), isFriend(),
isStatic(), startingOffset, getStartingLine(), declarator
.getNameStartOffset(), declarator.getNameEndOffset(),
declarator.getNameLine(), templateDeclaration, declarator
.isConst(), declarator.isVolatile(), virtual, explicit,
.isConst(), declarator.isVolatile(), isVirtual(), isExplicit(),
declarator.isPureVirtual(), ((IASTClassSpecifier) classifierScope)
.getCurrentVisibilityMode(), declarator
.getConstructorMemberInitializers(), declarator
@ -506,15 +496,15 @@ public class DeclarationWrapper implements IDeclaratorOwner
.getOwnedDeclarator().getNameDuple() : declarator
.getNameDuple(),
createParameterList(declarator.getParameters()), astFactory
.createAbstractDeclaration(constt, volatil,
.createAbstractDeclaration(isConst(), isVolatile(),
getTypeSpecifier(), declarator
.getPointerOperators(), declarator
.getArrayModifiers(), null, null),
declarator.getExceptionSpecification(), inline, friend,
staticc, startingOffset, getStartingLine(), declarator
declarator.getExceptionSpecification(), isInline(), isFriend(),
isStatic(), startingOffset, getStartingLine(), declarator
.getNameStartOffset(), declarator.getNameEndOffset(),
declarator.getNameLine(), templateDeclaration, declarator
.isConst(), declarator.isVolatile(), virtual, explicit,
.isConst(), declarator.isVolatile(), isVirtual(), isExplicit(),
declarator.isPureVirtual(), declarator
.getConstructorMemberInitializers(), declarator
.hasFunctionBody(), declarator.hasFunctionTryBlock(),
@ -529,18 +519,18 @@ public class DeclarationWrapper implements IDeclaratorOwner
return astFactory.createField(
scope,
nested ? declarator.getOwnedDeclarator().getNameDuple() : declarator.getNameDuple(),
auto,
isAuto(),
declarator.getInitializerClause(),
declarator.getBitFieldExpression(),
astFactory.createAbstractDeclaration(
constt,
volatil,
isConst(),
isVolatile(),
getTypeSpecifier(),
declarator.getPointerOperators(), declarator.getArrayModifiers(), null, null),
mutable,
extern,
register,
staticc,
isMutable(),
isExtern(),
isRegister(),
isStatic(),
startingOffset,
getStartingLine(),
declarator.getNameStartOffset(), declarator.getNameEndOffset(), declarator.getNameLine(), declarator.getConstructorExpression(), ((IASTClassSpecifier)scope).getCurrentVisibilityMode());
@ -585,14 +575,14 @@ public class DeclarationWrapper implements IDeclaratorOwner
declarator.getInitializerClause(),
declarator.getBitFieldExpression(),
astFactory.createAbstractDeclaration(
constt,
volatil,
isConst(),
isVolatile(),
getTypeSpecifier(),
declarator.getPointerOperators(), declarator.getArrayModifiers(), null, null),
mutable,
extern,
register,
staticc,
isMutable(),
isExtern(),
isRegister(),
isStatic(),
getStartingOffset(),
getStartingLine(), declarator.getNameStartOffset(), declarator.getNameEndOffset(), declarator.getNameLine(), declarator.getConstructorExpression());
@ -610,56 +600,56 @@ public class DeclarationWrapper implements IDeclaratorOwner
*/
public boolean isUnsigned()
{
return isUnsigned;
return checkBit( IS_UNSIGNED );
}
/**
* @return
*/
public boolean isSigned()
{
return isSigned;
return checkBit( IS_SIGNED );
}
/**
* @return
*/
public boolean isShort()
{
return isShort;
return checkBit( IS_SHORT );
}
/**
* @return
*/
public boolean isLong()
{
return isLong;
return checkBit( IS_LONG );
}
/**
* @param b
*/
public void setLong(boolean b)
{
isLong = b;
setBit( b, IS_LONG );
}
/**
* @param b
*/
public void setShort(boolean b)
{
isShort = b;
setBit( b, IS_SHORT );
}
/**
* @param b
*/
public void setSigned(boolean b)
{
isSigned = b;
setBit( b, IS_SIGNED );
}
/**
* @param b
*/
public void setUnsigned(boolean b)
{
isUnsigned = b;
setBit( b, IS_UNSIGNED );
}
/**
* @return
@ -685,21 +675,15 @@ public class DeclarationWrapper implements IDeclaratorOwner
/**
* @return
*/
public ITokenDuple getName()
public final ITokenDuple getName()
{
return name;
}
/**
* @param duple
*/
public void setName(ITokenDuple duple)
{
name = duple;
}
/**
* @return
*/
public IASTTemplate getOwnerTemplate()
public final IASTTemplate getOwnerTemplate()
{
return templateDeclaration;
}
@ -728,7 +712,7 @@ public class DeclarationWrapper implements IDeclaratorOwner
*/
public void setRestrict(boolean b)
{
restrict = b;
setBit( b, IS_RESTRICT );
}
@ -737,14 +721,14 @@ public class DeclarationWrapper implements IDeclaratorOwner
*/
public boolean isRestrict()
{
return restrict;
return checkBit( IS_RESTRICT );
}
/**
* @param b
*/
public void setImaginary(boolean b)
{
imaginary = b;
setBit( b, IS_IMAGINARY );
}
/**
@ -752,7 +736,7 @@ public class DeclarationWrapper implements IDeclaratorOwner
*/
public boolean isComplex()
{
return complex;
return checkBit( IS_COMPLEX );
}
/**
@ -760,7 +744,7 @@ public class DeclarationWrapper implements IDeclaratorOwner
*/
public boolean isImaginary()
{
return imaginary;
return checkBit( IS_IMAGINARY );
}
/**
@ -768,17 +752,17 @@ public class DeclarationWrapper implements IDeclaratorOwner
*/
public void setComplex(boolean b)
{
complex = b;
setBit( b, IS_COMPLEX );
}
/**
* @param b
*/
public void setGloballyQualified(boolean b) {
global = b;
setBit( b, IS_GLOBAL );
}
public boolean isGloballyQualified(){
return global;
return checkBit( IS_GLOBAL );
}
private Hashtable extensionParameters = new Hashtable();

View file

@ -23,6 +23,7 @@ import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification;
import org.eclipse.cdt.core.parser.ast.IASTExpression;
import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.internal.core.parser.ast.EmptyIterator;
/**
* @author jcamelon
@ -31,30 +32,44 @@ import org.eclipse.cdt.core.parser.ast.IASTScope;
public class Declarator implements IParameterCollection, IDeclaratorOwner, IDeclarator
{
private static final int DEFAULT_ARRAYLIST_SIZE = 4;
private boolean hasFunctionTryBlock;
private ITokenDuple pointerOperatorNameDuple;
private ITokenDuple namedDuple;
private boolean isFunction;
private boolean hasFunctionBody;
private IASTExpression constructorExpression;
private boolean pureVirtual = false;
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
private final IDeclaratorOwner owner;
private ITokenDuple pointerOperatorNameDuple = null;
private ITokenDuple namedDuple = null;
private IASTExpression constructorExpression = null;
private Declarator ownedDeclarator = null;
private String name = ""; //$NON-NLS-1$
private IASTInitializerClause initializerClause = null;
private IASTExceptionSpecification exceptionSpecification = null;
private IASTExpression bitFieldExpression = null;
private boolean isConst = false;
private boolean isVolatile = false;
private boolean isKandR = false;
private int flag = 0;
protected void setBit(boolean b, int mask){
if( b ){
flag = flag | mask;
} else {
flag = flag & ~mask;
}
}
protected boolean checkBit(int mask){
return (flag & mask) != 0;
}
protected static final int IS_FUNCTION = 0x000020;
protected static final int HAS_TRY_BLOCK = 0x000040;
protected static final int HAS_FUNCTION_BODY = 0x000080;
protected static final int IS_PURE_VIRTUAL = 0x000100;
protected static final int IS_VAR_ARGS = 0x000200;
protected static final int IS_VOLATILE = 0x000400;
protected static final int IS_CONST = 0x000800;
private List ptrOps = Collections.EMPTY_LIST;
private List parameters = Collections.EMPTY_LIST;
private List arrayModifiers = Collections.EMPTY_LIST;
private List constructorMemberInitializers = Collections.EMPTY_LIST;
private int nameStartOffset, nameEndOffset;
private boolean varArgs;
private int nameLine;
public Declarator( IDeclaratorOwner owner )
{
@ -66,7 +81,8 @@ public class Declarator implements IParameterCollection, IDeclaratorOwner, IDecl
*/
public String getName()
{
return name;
if( namedDuple == null ) return EMPTY_STRING;
return namedDuple.toString();
}
/**
@ -74,12 +90,14 @@ public class Declarator implements IParameterCollection, IDeclaratorOwner, IDecl
*/
public int getNameEndOffset()
{
return nameEndOffset;
if( namedDuple == null ) return -1;
return namedDuple.getEndOffset();
}
public int getNameLine()
{
return nameLine;
if( namedDuple == null ) return -1;
return namedDuple.getLineNumber();
}
/**
@ -87,7 +105,8 @@ public class Declarator implements IParameterCollection, IDeclaratorOwner, IDecl
*/
public int getNameStartOffset()
{
return nameStartOffset;
if( namedDuple == null ) return -1;
return namedDuple.getStartOffset();
}
/**
@ -98,29 +117,6 @@ public class Declarator implements IParameterCollection, IDeclaratorOwner, IDecl
return owner;
}
/**
* @param string
*/
public void setName(String string)
{
name = string;
}
/**
* @param i
*/
public void setNameEndOffsetAndLineNumber(int offset, int lineNumber)
{
nameEndOffset = offset;
}
/**
* @param i
*/
public void setNameStartOffset(int i)
{
nameStartOffset = i;
}
/**
* @return
@ -186,9 +182,6 @@ public class Declarator implements IParameterCollection, IDeclaratorOwner, IDecl
public void setName( ITokenDuple duple )
{
setName( duple.toString() );
setNameStartOffset( duple.getFirstToken().getOffset());
setNameEndOffsetAndLineNumber( duple.getLastToken().getEndOffset(), duple.getLastToken().getLineNumber());
namedDuple = duple;
}
@ -205,7 +198,7 @@ public class Declarator implements IParameterCollection, IDeclaratorOwner, IDecl
*/
public boolean isConst()
{
return isConst;
return checkBit(IS_CONST);
}
/**
@ -213,7 +206,7 @@ public class Declarator implements IParameterCollection, IDeclaratorOwner, IDecl
*/
public boolean isVolatile()
{
return isVolatile;
return checkBit( IS_VOLATILE);
}
/**
@ -229,7 +222,7 @@ public class Declarator implements IParameterCollection, IDeclaratorOwner, IDecl
*/
public void setConst(boolean b)
{
isConst = b;
setBit(b, IS_CONST );
}
/**
@ -237,23 +230,7 @@ public class Declarator implements IParameterCollection, IDeclaratorOwner, IDecl
*/
public void setVolatile(boolean b)
{
isVolatile = b;
}
/**
* @return
*/
public boolean isKandR()
{
return isKandR;
}
/**
* @param b
*/
public void setKandR(boolean b)
{
isKandR = b;
setBit( b, IS_VOLATILE );
}
/**
@ -261,7 +238,7 @@ public class Declarator implements IParameterCollection, IDeclaratorOwner, IDecl
*/
public void setPureVirtual(boolean b)
{
pureVirtual = b;
setBit( b, IS_PURE_VIRTUAL );
}
/**
@ -269,7 +246,7 @@ public class Declarator implements IParameterCollection, IDeclaratorOwner, IDecl
*/
public boolean isPureVirtual()
{
return pureVirtual;
return checkBit( IS_PURE_VIRTUAL );
}
/**
@ -329,7 +306,6 @@ public class Declarator implements IParameterCollection, IDeclaratorOwner, IDecl
{
if( constructorMemberInitializers == Collections.EMPTY_LIST )
constructorMemberInitializers = new ArrayList( DEFAULT_ARRAYLIST_SIZE );
constructorMemberInitializers.add( initializer );
}
@ -341,20 +317,13 @@ public class Declarator implements IParameterCollection, IDeclaratorOwner, IDecl
return constructorMemberInitializers;
}
/**
* @param b
*/
public void hasFunctionBody(boolean b)
{
hasFunctionBody = b;
}
/**
* @return
*/
public boolean isFunction()
{
return isFunction;
return checkBit( IS_FUNCTION );
}
/**
@ -362,7 +331,7 @@ public class Declarator implements IParameterCollection, IDeclaratorOwner, IDecl
*/
public void setIsFunction(boolean b)
{
isFunction = b;
setBit( b, IS_FUNCTION );
}
/* (non-Javadoc)
@ -370,8 +339,10 @@ public class Declarator implements IParameterCollection, IDeclaratorOwner, IDecl
*/
public Iterator getDeclarators()
{
List l = new ArrayList();
if( ownedDeclarator != null )
if( ownedDeclarator == null )
return EmptyIterator.EMPTY_ITERATOR;
List l = new ArrayList(1);
l.add( ownedDeclarator );
return l.iterator();
}
@ -417,7 +388,7 @@ public class Declarator implements IParameterCollection, IDeclaratorOwner, IDecl
*/
public boolean hasFunctionBody()
{
return hasFunctionBody;
return checkBit( HAS_FUNCTION_BODY );
}
/**
@ -425,7 +396,7 @@ public class Declarator implements IParameterCollection, IDeclaratorOwner, IDecl
*/
public void setHasFunctionBody(boolean b)
{
hasFunctionBody = b;
setBit( b, HAS_FUNCTION_BODY );
}
/**
@ -433,7 +404,7 @@ public class Declarator implements IParameterCollection, IDeclaratorOwner, IDecl
*/
public void setFunctionTryBlock(boolean b)
{
hasFunctionTryBlock = true;
setBit( b, HAS_TRY_BLOCK );
}
/**
@ -441,29 +412,21 @@ public class Declarator implements IParameterCollection, IDeclaratorOwner, IDecl
*/
public boolean hasFunctionTryBlock()
{
return hasFunctionTryBlock;
}
/**
* @param b
*/
public void setHasFunctionTryBlock(boolean b)
{
hasFunctionTryBlock = b;
return checkBit( HAS_TRY_BLOCK );
}
/**
* @param b
*/
public void setIsVarArgs(boolean b) {
varArgs = b;
setBit( b, IS_VAR_ARGS );
}
/**
* @return Returns the varArgs.
*/
public boolean isVarArgs() {
return varArgs;
return checkBit( IS_VAR_ARGS );
}
/* (non-Javadoc)

View file

@ -1863,6 +1863,8 @@ public abstract class Parser extends ExpressionParser implements IParser
simpleDeclarationMark = null;
if( d.getNameDuple() != null )
d.getNameDuple().getLastToken().setNext( null );
if( d.getPointerOperatorNameDuple() != null )
d.getPointerOperatorNameDuple().getLastToken().setNext( null );
}

View file

@ -1,39 +0,0 @@
/**********************************************************************
* Copyright (c) 2002-2004 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.token;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.cdt.core.parser.IToken;
import org.eclipse.cdt.core.parser.ITokenDuple;
/**
* @author jcamelon
*
*/
public class SegmentedTokenDuple extends BasicTokenDuple {
/**
* @param first
* @param last
*/
public SegmentedTokenDuple(IToken first, IToken last) {
super(first, last);
numSegments = calculateSegmentCount();
}
private final int numSegments;
}