1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-15 04:55:22 +02:00

Bug 421247 - ASTNode.copy() chaining inconsistent

Change-Id: I89397209ae6a47b5a3a0827942b83a6755bc60e0
Reviewed-on: https://git.eclipse.org/r/18874
Tested-by: Hudson CI
Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com>
Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
This commit is contained in:
Sergey Prigogin 2013-11-25 17:14:35 -08:00
parent d77a625716
commit 2d58772f73
94 changed files with 154 additions and 527 deletions

View file

@ -374,7 +374,7 @@ public abstract class ASTNode implements IASTNode {
return copy;
}
protected void setCopyLocation(IASTNode originalNode) {
private void setCopyLocation(IASTNode originalNode) {
locations = new IASTNodeLocation[] { new ASTCopyLocation(originalNode) };
}

View file

@ -123,12 +123,8 @@ public class ASTProblem extends ASTNode implements IASTProblem {
@Override
public ASTProblem copy(CopyStyle style) {
ASTProblem problem = new ASTProblem(id, arg == null ? null : arg.clone(), isError);
problem.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
problem.setCopyLocation(this);
}
return problem;
ASTProblem copy = new ASTProblem(id, arg == null ? null : arg.clone(), isError);
return copy(copy, style);
}
@Override

View file

@ -423,7 +423,7 @@ public abstract class ASTTranslationUnit extends ASTNode implements IASTTranslat
*/
abstract protected IType createType(IASTTypeId typeid);
protected void copyAbstractTU(ASTTranslationUnit copy, CopyStyle style) {
protected <T extends ASTTranslationUnit> T copy(T copy, CopyStyle style) {
copy.setIndex(fIndex);
copy.fIsHeader = fIsHeader;
copy.fNodeFactory = fNodeFactory;
@ -436,7 +436,7 @@ public abstract class ASTTranslationUnit extends ASTNode implements IASTTranslat
copy.addDeclaration(declaration == null ? null : declaration.copy(style));
}
copy.setOffsetAndLength(this);
return super.copy(copy, style);
}
@Override

View file

@ -35,10 +35,7 @@ public abstract class ASTTypeIdInitializerExpression extends ASTNode implements
protected void initializeCopy(ASTTypeIdInitializerExpression copy, CopyStyle style) {
copy.setTypeId(typeId == null ? null : typeId.copy(style));
copy.setInitializer(initializer == null ? null : initializer.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
copy(copy, style);
}
@Override

View file

@ -38,11 +38,7 @@ public class CASTASMDeclaration extends ASTNode implements IASTASMDeclaration {
public CASTASMDeclaration copy(CopyStyle style) {
CASTASMDeclaration copy = new CASTASMDeclaration();
copy.assembly = assembly == null ? null : assembly.clone();
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -22,12 +22,9 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
/**
* Implementation of array designators
*/
public class CASTArrayDesignator extends ASTNode implements
ICASTArrayDesignator, IASTAmbiguityParent {
public class CASTArrayDesignator extends ASTNode implements ICASTArrayDesignator, IASTAmbiguityParent {
private IASTExpression exp;
public CASTArrayDesignator() {
}
@ -43,11 +40,7 @@ public class CASTArrayDesignator extends ASTNode implements
@Override
public CASTArrayDesignator copy(CopyStyle style) {
CASTArrayDesignator copy = new CASTArrayDesignator(exp == null ? null : exp.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override
@ -85,8 +78,7 @@ public class CASTArrayDesignator extends ASTNode implements
@Override
public void replace(IASTNode child, IASTNode other) {
if( child == exp )
{
if (child == exp) {
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
exp = (IASTExpression) other;

View file

@ -45,16 +45,12 @@ public class CASTArrayModifier extends ASTNode implements ICASTArrayModifier, IA
@Override
public CASTArrayModifier copy(CopyStyle style) {
CASTArrayModifier copy = new CASTArrayModifier(exp == null ? null : exp.copy(style));
copy.setOffsetAndLength(this);
copy.isVolatile = isVolatile;
copy.isRestrict = isRestrict;
copy.isStatic = isStatic;
copy.isConst = isConst;
copy.isVarSized = isVarSized;
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -45,11 +45,7 @@ public class CASTArrayRangeDesignator extends ASTNode implements
CASTArrayRangeDesignator copy = new CASTArrayRangeDesignator();
copy.setRangeFloor(floor == null ? null : floor.copy(style));
copy.setRangeCeiling(ceiling == null ? null : ceiling.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -50,11 +50,7 @@ public class CASTArraySubscriptExpression extends ASTNode implements
CASTArraySubscriptExpression copy = new CASTArraySubscriptExpression();
copy.setArrayExpression(array == null ? null : array.copy(style));
copy.setSubscriptExpression(subscript == null ? null : subscript.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -81,12 +81,12 @@ public abstract class CASTBaseDeclSpecifier extends ASTNode implements ICASTDecl
this.isInline = value;
}
protected void copyBaseDeclSpec(CASTBaseDeclSpecifier copy) {
protected <T extends CASTBaseDeclSpecifier> T copy(T copy, CopyStyle style) {
copy.storageClass = storageClass;
copy.isConst = isConst;
copy.isVolatile = isVolatile;
copy.isRestrict = isRestrict;
copy.isInline = isInline;
copy.setOffsetAndLength(this);
return super.copy(copy, style);
}
}

View file

@ -49,11 +49,7 @@ public class CASTCastExpression extends ASTNode implements IASTCastExpression, I
copy.setTypeId(typeId == null ? null : typeId.copy(style));
IASTExpression operand = getOperand();
copy.setOperand(operand == null ? null : operand.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -50,20 +50,17 @@ public class CASTCompositeTypeSpecifier extends CASTBaseDeclSpecifier implements
@Override
public CASTCompositeTypeSpecifier copy(CopyStyle style) {
CASTCompositeTypeSpecifier copy = new CASTCompositeTypeSpecifier();
copyCompositeTypeSpecifier(copy, style);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
protected void copyCompositeTypeSpecifier(CASTCompositeTypeSpecifier copy, CopyStyle style) {
copyBaseDeclSpec(copy);
protected <T extends CASTCompositeTypeSpecifier> T copy(T copy, CopyStyle style) {
copy.setKey(fKey);
copy.setName(fName == null ? null : fName.copy(style));
for (IASTDeclaration member : getMembers())
for (IASTDeclaration member : getMembers()) {
copy.addMemberDeclaration(member == null ? null : member.copy(style));
}
return super.copy(copy, style);
}
@Override
public int getKey() {

View file

@ -45,11 +45,7 @@ public class CASTCompoundStatementExpression extends ASTNode implements IGNUASTC
public CASTCompoundStatementExpression copy(CopyStyle style) {
CASTCompoundStatementExpression copy = new CASTCompoundStatementExpression();
copy.setCompoundStatement(statement == null ? null : statement.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -52,11 +52,7 @@ public class CASTConditionalExpression extends ASTNode implements
copy.setLogicalConditionExpression(condition == null ? null : condition.copy(style));
copy.setPositiveResultExpression(positive == null ? null : positive.copy(style));
copy.setNegativeResultExpression(negative == null ? null : negative.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -50,13 +50,9 @@ public class CASTElaboratedTypeSpecifier extends CASTBaseDeclSpecifier implement
@Override
public CASTElaboratedTypeSpecifier copy(CopyStyle style) {
CASTElaboratedTypeSpecifier copy = new CASTElaboratedTypeSpecifier(kind, name == null
? null : name.copy(style));
copyBaseDeclSpec(copy);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
CASTElaboratedTypeSpecifier copy = new CASTElaboratedTypeSpecifier(kind,
name == null ? null : name.copy(style));
return copy(copy, style);
}
@Override

View file

@ -43,19 +43,16 @@ public class CASTEnumerationSpecifier extends CASTBaseDeclSpecifier
@Override
public CASTEnumerationSpecifier copy(CopyStyle style) {
CASTEnumerationSpecifier copy = new CASTEnumerationSpecifier();
copyEnumerationSpecifier(copy, style);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
protected void copyEnumerationSpecifier(CASTEnumerationSpecifier copy, CopyStyle style) {
copyBaseDeclSpec(copy);
protected <T extends CASTEnumerationSpecifier> T copy(T copy, CopyStyle style) {
copy.setName(name == null ? null : name.copy(style));
for(IASTEnumerator enumerator : getEnumerators())
for (IASTEnumerator enumerator : getEnumerators()) {
copy.addEnumerator(enumerator == null ? null : enumerator.copy(style));
}
return super.copy(copy, style);
}
@Override

View file

@ -34,10 +34,6 @@ public class CASTEqualsInitializer extends ASTEqualsInitializer {
public CASTEqualsInitializer copy(CopyStyle style) {
IASTInitializerClause arg = getInitializerClause();
CASTEqualsInitializer copy = new CASTEqualsInitializer(arg == null ? null : arg.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
}

View file

@ -39,11 +39,7 @@ public class CASTExpressionList extends ASTNode implements IASTExpressionList,
CASTExpressionList copy = new CASTExpressionList();
for(IASTExpression expr : getExpressions())
copy.addExpression(expr == null ? null : expr.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -42,11 +42,7 @@ public class CASTFieldDesignator extends ASTNode implements ICASTFieldDesignator
@Override
public CASTFieldDesignator copy(CopyStyle style) {
CASTFieldDesignator copy = new CASTFieldDesignator(name == null ? null : name.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -60,11 +60,7 @@ public class CASTFieldReference extends ASTNode
copy.setFieldOwner(owner == null ? null : owner.copy(style));
copy.setFieldName(name == null ? null : name.copy(style));
copy.ptr = ptr;
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -61,12 +61,7 @@ public class CASTFunctionDefinition extends ASTNode implements IASTFunctionDefin
}
copy.setBody(bodyStatement == null ? null : bodyStatement.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -35,10 +35,6 @@ public class CASTInitializerExpression extends CASTEqualsInitializer implements
CASTInitializerExpression copy = new CASTInitializerExpression();
IASTInitializerClause init = getInitializerClause();
copy.setInitializerClause(init == null ? null : init.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
}

View file

@ -40,14 +40,11 @@ public class CASTInitializerList extends ASTNode implements IASTInitializerList,
@Override
public CASTInitializerList copy(CopyStyle style) {
CASTInitializerList copy = new CASTInitializerList();
for (IASTInitializerClause initializer : getClauses())
for (IASTInitializerClause initializer : getClauses()) {
copy.addClause(initializer == null ? null : initializer.copy(style));
copy.setOffsetAndLength(this);
copy.actualSize = getSize();
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
copy.actualSize = getSize();
return copy(copy, style);
}
@Override

View file

@ -45,11 +45,7 @@ public class CASTLiteralExpression extends ASTNode implements IASTLiteralExpress
@Override
public CASTLiteralExpression copy(CopyStyle style) {
CASTLiteralExpression copy = new CASTLiteralExpression(kind, value == null ? null : value.clone());
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -54,11 +54,7 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext
@Override
public CASTName copy(CopyStyle style) {
CASTName copy = new CASTName(name == null ? null : name.clone());
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -46,11 +46,7 @@ public class CASTParameterDeclaration extends ASTNode implements IASTParameterDe
CASTParameterDeclaration copy = new CASTParameterDeclaration();
copy.setDeclSpecifier(declSpec == null ? null : declSpec.copy(style));
copy.setDeclarator(declarator == null ? null : declarator.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -32,11 +32,7 @@ public class CASTPointer extends ASTNode implements ICASTPointer {
copy.isRestrict = isRestrict;
copy.isVolatile = isVolatile;
copy.isConst = isConst;
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -27,10 +27,14 @@ public class CASTProblem extends ASTProblem {
@Override
public CASTProblem copy() {
return copy(CopyStyle.withoutLocations);
}
@Override
public CASTProblem copy(CopyStyle style) {
char[] arg = getArgument();
CASTProblem problem = new CASTProblem(getID(), arg == null ? null : arg.clone(), isError());
problem.setOffsetAndLength(this);
return problem;
CASTProblem copy = new CASTProblem(getID(), arg == null ? null : arg.clone(), isError());
return copy(copy, style);
}
@Override

View file

@ -39,15 +39,10 @@ public class CASTSimpleDeclSpecifier extends CASTBaseDeclSpecifier
@Override
public CASTSimpleDeclSpecifier copy(CopyStyle style) {
CASTSimpleDeclSpecifier copy = new CASTSimpleDeclSpecifier();
copySimpleDeclSpec(copy, style);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
protected void copySimpleDeclSpec(CASTSimpleDeclSpecifier copy, CopyStyle style) {
copyBaseDeclSpec(copy);
protected <T extends CASTSimpleDeclSpecifier> T copy(T copy, CopyStyle style) {
copy.simpleType = simpleType;
copy.isSigned = isSigned;
copy.isUnsigned = isUnsigned;
@ -58,6 +53,7 @@ public class CASTSimpleDeclSpecifier extends CASTBaseDeclSpecifier
copy.imaginary = imaginary;
if (fDeclTypeExpression != null)
copy.setDeclTypeExpression(fDeclTypeExpression.copy(style));
return super.copy(copy, style);
}
@Override

View file

@ -46,18 +46,9 @@ public class CASTTranslationUnit extends ASTTranslationUnit implements IASTAmbig
@Override
public CASTTranslationUnit copy(CopyStyle style) {
CASTTranslationUnit copy = new CASTTranslationUnit();
copyAbstractTU(copy, style);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IASTTranslationUnit#getScope()
*/
@Override
public IScope getScope() {
if (compilationUnit == null)
@ -65,7 +56,6 @@ public class CASTTranslationUnit extends ASTTranslationUnit implements IASTAmbig
return compilationUnit;
}
@Override
public IASTName[] getDeclarationsInAST(IBinding binding) {
if (binding instanceof IMacroBinding) {

View file

@ -42,11 +42,7 @@ public class CASTTypeId extends ASTNode implements IASTTypeId {
CASTTypeId copy = new CASTTypeId();
copy.setDeclSpecifier(declSpecifier == null ? null : declSpecifier.copy(style));
copy.setAbstractDeclarator(declarator == null ? null : declarator.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -43,11 +43,7 @@ public class CASTTypeIdExpression extends ASTNode implements IASTTypeIdExpressio
public CASTTypeIdExpression copy(CopyStyle style) {
CASTTypeIdExpression copy = new CASTTypeIdExpression(op, typeId == null ? null
: typeId.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -43,13 +43,9 @@ public class CASTTypedefNameSpecifier extends CASTBaseDeclSpecifier implements
@Override
public CASTTypedefNameSpecifier copy(CopyStyle style) {
CASTTypedefNameSpecifier copy = new CASTTypedefNameSpecifier(name == null ? null
: name.copy(style));
copyBaseDeclSpec(copy);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
CASTTypedefNameSpecifier copy =
new CASTTypedefNameSpecifier(name == null ? null : name.copy(style));
return copy(copy, style);
}
@Override

View file

@ -35,11 +35,7 @@ public class GCCASTSimpleDeclSpecifier extends CASTSimpleDeclSpecifier implement
@Override
public GCCASTSimpleDeclSpecifier copy(CopyStyle style) {
GCCASTSimpleDeclSpecifier copy = new GCCASTSimpleDeclSpecifier();
copySimpleDeclSpec(copy, style);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -36,11 +36,7 @@ public class CPPASTASMDeclaration extends ASTNode implements IASTASMDeclaration
public CPPASTASMDeclaration copy(CopyStyle style) {
CPPASTASMDeclaration copy = new CPPASTASMDeclaration();
copy.assembly = assembly.clone();
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -44,14 +44,10 @@ public class CPPASTArrayDeclarator extends CPPASTDeclarator implements ICPPASTAr
@Override
public CPPASTArrayDeclarator copy(CopyStyle style) {
CPPASTArrayDeclarator copy = new CPPASTArrayDeclarator();
copyBaseDeclarator(copy, style);
for (IASTArrayModifier modifier : getArrayModifiers())
for (IASTArrayModifier modifier : getArrayModifiers()) {
copy.addArrayModifier(modifier == null ? null : modifier.copy(style));
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -44,11 +44,7 @@ public class CPPASTArrayModifier extends ASTNode implements IASTArrayModifier, I
@Override
public CPPASTArrayModifier copy(CopyStyle style) {
CPPASTArrayModifier copy = new CPPASTArrayModifier(exp == null ? null : exp.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -54,11 +54,7 @@ public class CPPASTArraySubscriptExpression extends ASTNode
CPPASTArraySubscriptExpression copy = new CPPASTArraySubscriptExpression();
copy.setArrayExpression(arrayExpression == null ? null : arrayExpression.copy(style));
copy.setArgument(subscriptExp == null ? null : subscriptExp.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -59,11 +59,7 @@ public class CPPASTBaseSpecifier extends ASTNode implements ICPPASTBaseSpecifier
copy.isVirtual = isVirtual;
copy.visibility = visibility;
copy.fIsPackExpansion= fIsPackExpansion;
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -48,11 +48,7 @@ public class CPPASTBinaryTypeIdExpression extends ASTNode implements ICPPASTExpr
CPPASTBinaryTypeIdExpression copy = new CPPASTBinaryTypeIdExpression(fOperator,
fOperand1 == null ? null : fOperand1.copy(style),
fOperand2 == null ? null : fOperand2.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -33,16 +33,12 @@ public class CPPASTCapture extends ASTNode implements ICPPASTCapture {
@Override
public CPPASTCapture copy(CopyStyle style) {
final CPPASTCapture result = new CPPASTCapture();
final CPPASTCapture copy = new CPPASTCapture();
if (fIdentifier != null)
result.setIdentifier(fIdentifier.copy(style));
result.fByReference = fByReference;
result.fPackExpansion = fPackExpansion;
result.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
result.setCopyLocation(this);
}
return result;
copy.setIdentifier(fIdentifier.copy(style));
copy.fByReference = fByReference;
copy.fPackExpansion = fPackExpansion;
return copy(copy, style);
}
@Override

View file

@ -57,11 +57,7 @@ public class CPPASTCastExpression extends ASTNode implements ICPPASTCastExpressi
copy.setTypeId(typeId == null ? null : typeId.copy(style));
IASTExpression operand = getOperand();
copy.setOperand(operand == null ? null : operand.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -64,11 +64,7 @@ public class CPPASTCompoundStatementExpression extends ASTNode implements IGNUAS
public CPPASTCompoundStatementExpression copy(CopyStyle style) {
CPPASTCompoundStatementExpression copy = new CPPASTCompoundStatementExpression();
copy.setCompoundStatement(statement == null ? null : statement.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -52,11 +52,7 @@ public class CPPASTConditionalExpression extends ASTNode implements IASTConditio
copy.setLogicalConditionExpression(fCondition == null ? null : fCondition.copy(style));
copy.setPositiveResultExpression(fPositive == null ? null : fPositive.copy(style));
copy.setNegativeResultExpression(fNegative == null ? null : fNegative.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -25,7 +25,6 @@ import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorInitializer;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDefinition;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
@ -70,12 +69,8 @@ public class CPPASTConstructorChainInitializer extends ASTNode implements
CPPASTConstructorChainInitializer copy = new CPPASTConstructorChainInitializer();
copy.setMemberInitializerId(name == null ? null : name.copy(style));
copy.setInitializer(initializer == null ? null : initializer.copy(style));
copy.setOffsetAndLength(this);
copy.fIsPackExpansion = fIsPackExpansion;
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -45,11 +45,7 @@ public class CPPASTConversionName extends CPPASTNameBase implements ICPPASTConve
public CPPASTConversionName copy(CopyStyle style) {
CPPASTConversionName copy = new CPPASTConversionName();
copy.setTypeId(typeId == null ? null : typeId.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -71,14 +71,10 @@ public class CPPASTDeclarator extends ASTNode implements ICPPASTDeclarator, IAST
@Override
public CPPASTDeclarator copy(CopyStyle style) {
CPPASTDeclarator copy = new CPPASTDeclarator();
copyBaseDeclarator(copy, style);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
protected void copyBaseDeclarator(CPPASTDeclarator copy, CopyStyle style) {
protected <T extends CPPASTDeclarator> T copy(T copy, CopyStyle style) {
copy.setName(name == null ? null : name.copy(style));
copy.setInitializer(initializer == null ? null : initializer.copy(style));
copy.setNestedDeclarator(nested == null ? null : nested.copy(style));
@ -89,7 +85,7 @@ public class CPPASTDeclarator extends ASTNode implements ICPPASTDeclarator, IAST
for (IASTAttribute attribute : getAttributes()) {
copy.addAttribute(attribute.copy(style));
}
copy.setOffsetAndLength(this);
return super.copy(copy, style);
}
@Override

View file

@ -43,11 +43,7 @@ public class CPPASTDecltypeSpecifier extends ASTNode implements ICPPASTDecltypeS
@Override
public CPPASTDecltypeSpecifier copy(CopyStyle style) {
CPPASTDecltypeSpecifier copy = new CPPASTDecltypeSpecifier((ICPPASTExpression) fDecltypeExpression.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -59,11 +59,7 @@ public class CPPASTDeleteExpression extends ASTNode implements ICPPASTDeleteExpr
: operand.copy(style));
copy.isGlobal = isGlobal;
copy.isVectored = isVectored;
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -35,10 +35,6 @@ public class CPPASTEqualsInitializer extends ASTEqualsInitializer {
IASTInitializerClause arg = getInitializerClause();
CPPASTEqualsInitializer copy = new CPPASTEqualsInitializer(arg == null ? null
: arg.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
}

View file

@ -45,11 +45,7 @@ public class CPPASTExplicitTemplateInstantiation extends ASTNode implements
CPPASTExplicitTemplateInstantiation copy = new CPPASTExplicitTemplateInstantiation();
copy.setDeclaration(declaration == null ? null : declaration.copy(style));
copy.setModifier(modifier);
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -50,11 +50,7 @@ public class CPPASTExpressionList extends ASTNode implements ICPPASTExpressionLi
CPPASTExpressionList copy = new CPPASTExpressionList();
for(IASTExpression expr : getExpressions())
copy.addExpression(expr == null ? null : expr.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -46,12 +46,8 @@ public class CPPASTFieldDeclarator extends CPPASTDeclarator implements
@Override
public CPPASTFieldDeclarator copy(CopyStyle style) {
CPPASTFieldDeclarator copy = new CPPASTFieldDeclarator();
copyBaseDeclarator(copy, style);
copy.setBitFieldSize(bitField == null ? null : bitField.copy(style));
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -63,7 +63,6 @@ public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements ICPPAS
@Override
public CPPASTFunctionDeclarator copy(CopyStyle style) {
CPPASTFunctionDeclarator copy = new CPPASTFunctionDeclarator();
copyBaseDeclarator(copy, style);
copy.varArgs = varArgs;
copy.pureVirtual = pureVirtual;
copy.isVolatile = isVolatile;
@ -85,10 +84,7 @@ public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements ICPPAS
if (trailingReturnType != null) {
copy.setTrailingReturnType(trailingReturnType.copy(style));
}
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -58,11 +58,7 @@ public class CPPASTFunctionWithTryBlock extends CPPASTFunctionDefinition impleme
copy.addCatchHandler(handler == null ? null : handler.copy(style));
}
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -35,10 +35,6 @@ public class CPPASTInitializerExpression extends CPPASTEqualsInitializer impleme
CPPASTInitializerExpression copy = new CPPASTInitializerExpression();
IASTInitializerClause init = getInitializerClause();
copy.setInitializerClause(init == null ? null : init.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
}

View file

@ -46,13 +46,9 @@ public class CPPASTInitializerList extends ASTNode implements ICPPASTInitializer
for (IASTInitializerClause initializer : getClauses()) {
copy.addClause(initializer == null ? null : initializer.copy(style));
}
copy.setOffsetAndLength(this);
copy.actualSize = getSize();
copy.fIsPackExpansion = fIsPackExpansion;
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -55,27 +55,23 @@ public class CPPASTLambdaExpression extends ASTNode implements ICPPASTLambdaExpr
@Override
public CPPASTLambdaExpression copy(CopyStyle style) {
CPPASTLambdaExpression result = new CPPASTLambdaExpression();
result.fCaptureDefault = fCaptureDefault;
CPPASTLambdaExpression copy = new CPPASTLambdaExpression();
copy.fCaptureDefault = fCaptureDefault;
if (fCaptures != null) {
for (ICPPASTCapture capture : fCaptures) {
if (capture != null) {
result.addCapture(capture.copy(style));
copy.addCapture(capture.copy(style));
}
}
}
if (fDeclarator != null) {
result.setDeclarator(fDeclarator.copy(style));
copy.setDeclarator(fDeclarator.copy(style));
}
if (fBody != null) {
result.setBody(fBody.copy(style));
copy.setBody(fBody.copy(style));
}
result.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
result.setCopyLocation(this);
}
return result;
return copy(copy, style);
}
@Override

View file

@ -53,11 +53,7 @@ public class CPPASTName extends CPPASTNameBase implements ICPPASTCompletionConte
@Override
public CPPASTName copy(CopyStyle style) {
CPPASTName copy = new CPPASTName(name == null ? null : name.clone());
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -37,11 +37,7 @@ public class CPPASTNamespaceAlias extends ASTNode implements ICPPASTNamespaceAli
CPPASTNamespaceAlias copy = new CPPASTNamespaceAlias(
alias == null ? null : alias.copy(style),
qualifiedName == null ? null : qualifiedName.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -54,11 +54,7 @@ public class CPPASTNamespaceDefinition extends ASTNode
for (IASTDeclaration declaration : getDeclarations()) {
copy.addDeclaration(declaration == null ? null : declaration.copy(style));
}
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -83,11 +83,7 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
}
copy.setTypeId(typeId == null ? null : typeId.copy(style));
copy.setInitializer(initializer == null ? null : initializer.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -37,10 +37,6 @@ public class CPPASTOperatorName extends CPPASTName implements ICPPASTOperatorNam
public CPPASTOperatorName copy(CopyStyle style) {
char[] name = toCharArray();
CPPASTOperatorName copy = new CPPASTOperatorName(name == null ? null : name.clone());
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
}

View file

@ -56,11 +56,7 @@ public class CPPASTPackExpansionExpression extends ASTNode implements ICPPASTPac
@Override
public CPPASTPackExpansionExpression copy(CopyStyle style) {
CPPASTPackExpansionExpression copy = new CPPASTPackExpansionExpression(fPattern.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -52,11 +52,7 @@ public class CPPASTParameterDeclaration extends ASTNode implements ICPPASTParame
CPPASTParameterDeclaration copy = new CPPASTParameterDeclaration();
copy.setDeclSpecifier(fDeclSpec == null ? null : fDeclSpec.copy(style));
copy.setDeclarator(fDeclarator == null ? null : fDeclarator.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -37,11 +37,7 @@ public class CPPASTPointer extends ASTNode implements IASTPointer {
copy.isConst = isConst;
copy.isVolatile = isVolatile;
copy.isRestrict = isRestrict;
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -37,11 +37,7 @@ public class CPPASTPointerToMember extends CPPASTPointer implements ICPPASTPoint
copy.setConst(isConst());
copy.setVolatile(isVolatile());
copy.setRestrict(isRestrict());
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -32,12 +32,8 @@ public class CPPASTProblem extends ASTProblem {
@Override
public CPPASTProblem copy(CopyStyle style) {
char[] arg = getArgument();
CPPASTProblem problem = new CPPASTProblem(getID(), arg == null ? null : arg.clone(), isError());
problem.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
problem.setCopyLocation(this);
}
return problem;
CPPASTProblem copy = new CPPASTProblem(getID(), arg == null ? null : arg.clone(), isError());
return copy(copy, style);
}
@Override

View file

@ -89,11 +89,7 @@ public class CPPASTQualifiedName extends CPPASTNameBase
copy.addNameSpecifier(nameSpecifier == null ? null : nameSpecifier.copy(style));
}
copy.setFullyQualified(fIsFullyQualified);
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -38,11 +38,7 @@ public class CPPASTReferenceOperator extends ASTNode implements ICPPASTReference
@Override
public CPPASTReferenceOperator copy(CopyStyle style) {
CPPASTReferenceOperator copy = new CPPASTReferenceOperator(fIsRValue);
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -52,11 +52,7 @@ public class CPPASTSimpleTypeConstructorExpression extends ASTNode implements
CPPASTSimpleTypeConstructorExpression copy = new CPPASTSimpleTypeConstructorExpression();
copy.setDeclSpecifier(fDeclSpec == null ? null : fDeclSpec.copy(style));
copy.setInitializer(fInitializer == null ? null : fInitializer.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -48,11 +48,7 @@ public class CPPASTSimpleTypeTemplateParameter extends ASTNode implements ICPPAS
copy.fIsParameterPack = fIsParameterPack;
copy.setName(fName == null ? null : fName.copy(style));
copy.setDefaultType(fTypeId == null ? null : fTypeId.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -58,11 +58,7 @@ public class CPPASTStaticAssertionDeclaration extends ASTNode implements ICPPAST
final ICPPASTLiteralExpression msgCopy = fMessage == null ? null : fMessage.copy(style);
CPPASTStaticAssertionDeclaration copy = new CPPASTStaticAssertionDeclaration(condCopy,
msgCopy);
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -53,11 +53,7 @@ public class CPPASTTemplateDeclaration extends ASTNode
copy.exported = exported;
for (ICPPASTTemplateParameter param : getTemplateParameters())
copy.addTemplateParameter(param == null ? null : param.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -49,11 +49,7 @@ public class CPPASTTemplateSpecialization extends ASTNode implements
public CPPASTTemplateSpecialization copy(CopyStyle style) {
CPPASTTemplateSpecialization copy = new CPPASTTemplateSpecialization();
copy.setDeclaration(declaration == null ? null : declaration.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -55,11 +55,7 @@ public class CPPASTTemplatedTypeTemplateParameter extends ASTNode implements
copy.fIsParameterPack = fIsParameterPack;
for (ICPPASTTemplateParameter param : getTemplateParameters())
copy.addTemplateParameter(param == null ? null : param.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -55,11 +55,7 @@ public class CPPASTTranslationUnit extends ASTTranslationUnit implements ICPPAST
@Override
public CPPASTTranslationUnit copy(CopyStyle style) {
CPPASTTranslationUnit copy = new CPPASTTranslationUnit();
copyAbstractTU(copy, style);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -43,11 +43,7 @@ public class CPPASTTypenameExpression extends CPPASTSimpleTypeConstructorExpress
IASTInitializer init = getInitializer();
copy.setDeclSpecifier(declSpec == null ? null : declSpec.copy(style));
copy.setInitializer(init == null ? null : init.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -61,11 +61,7 @@ public class CPPASTUnaryExpression extends ASTNode implements ICPPASTUnaryExpres
public CPPASTUnaryExpression copy(CopyStyle style) {
CPPASTUnaryExpression copy = new CPPASTUnaryExpression(fOperator, fOperand == null ? null
: fOperand.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -40,10 +40,6 @@ public class GPPASTExplicitTemplateInstantiation extends
IASTDeclaration declaration = getDeclaration();
copy.setDeclaration(declaration == null ? null : declaration.copy(style));
copy.setModifier(getModifier());
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
}

View file

@ -29,10 +29,6 @@ public class GPPASTPointer extends CPPASTPointer implements IGPPASTPointer {
copy.setConst(isConst());
copy.setVolatile(isVolatile());
copy.setRestrict(isRestrict());
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
}

View file

@ -41,10 +41,6 @@ public class GPPASTPointerToMember extends CPPASTPointerToMember implements
copy.setConst(isConst());
copy.setVolatile(isVolatile());
copy.setRestrict(isRestrict());
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
}

View file

@ -28,8 +28,6 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
* @author Emanuel Graf IFS
*/
public class ContainerNode extends ASTNode {
private final IASTTranslationUnit tu = null;
private final ArrayList<IASTNode> nodes = new ArrayList<IASTNode>();
public ContainerNode(IASTNode... nodes) {
@ -46,20 +44,14 @@ public class ContainerNode extends ASTNode {
@Override
public ContainerNode copy(CopyStyle style) {
ContainerNode copy = new ContainerNode();
for (IASTNode node : getNodes())
for (IASTNode node : getNodes()) {
copy.addNode(node == null ? null : node.copy(style));
copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
public void addNode(IASTNode node) {
nodes.add(node);
if (node.getParent() == null) {
node.setParent(tu);
}
}
@Override
@ -72,7 +64,7 @@ public class ContainerNode extends ASTNode {
}
public IASTTranslationUnit getTu() {
return tu;
return null;
}
public List<IASTNode> getNodes() {

View file

@ -44,14 +44,10 @@ public class UPCASTCompositeTypeSpecifier extends CASTCompositeTypeSpecifier imp
@Override
public UPCASTCompositeTypeSpecifier copy(CopyStyle style) {
UPCASTCompositeTypeSpecifier copy = new UPCASTCompositeTypeSpecifier();
copyCompositeTypeSpecifier(copy, style);
copy.referenceType = referenceType;
copy.sharedQualifier = sharedQualifier;
copy.setBlockSizeExpression(blockSizeExpression == null ? null : blockSizeExpression.copy(style));
if(style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -48,11 +48,7 @@ public class UPCASTElaboratedTypeSpecifier extends CASTElaboratedTypeSpecifier i
copy.referenceType = referenceType;
copy.sharedQualifier = sharedQualifier;
copy.setBlockSizeExpression(blockSizeExpression == null ? null : blockSizeExpression.copy(style));
copy.setOffsetAndLength(this);
if(style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -44,14 +44,10 @@ public class UPCASTEnumerationSpecifier extends CASTEnumerationSpecifier impleme
@Override
public UPCASTEnumerationSpecifier copy(CopyStyle style) {
UPCASTEnumerationSpecifier copy = new UPCASTEnumerationSpecifier();
copyEnumerationSpecifier(copy, style);
copy.referenceType = referenceType;
copy.sharedQualifier = sharedQualifier;
copy.setBlockSizeExpression(blockSizeExpression == null ? null : blockSizeExpression.copy(style));
if(style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -38,11 +38,7 @@ public class UPCASTKeywordExpression extends ASTNode implements IUPCASTKeywordEx
@Override
public UPCASTKeywordExpression copy(CopyStyle style) {
UPCASTKeywordExpression copy = new UPCASTKeywordExpression(keywordKind);
copy.setOffsetAndLength(this);
if(style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -33,11 +33,7 @@ public class UPCASTLayoutQualifier extends ASTNode implements IUPCASTLayoutQuali
copy.isPure = isPure;
copy.isIndefinite = isIndefinite;
copy.setBlockSizeExpression(blockSizeExpression == null ? null : blockSizeExpression.copy(style));
copy.setOffsetAndLength(this);
if(style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override
@ -45,37 +41,28 @@ public class UPCASTLayoutQualifier extends ASTNode implements IUPCASTLayoutQuali
return blockSizeExpression;
}
@Override
public boolean isIndefiniteBlockAllocation() {
return isIndefinite;
}
@Override
public boolean isPureBlockAllocation() {
return isPure;
}
@Override
public void setBlockSizeExpression(IASTExpression expr) {
this.blockSizeExpression = expr;
}
@Override
public void setIndefiniteBlockAllocation(boolean allocation) {
this.isIndefinite = allocation;
}
@Override
public void setPureBlockAllocation(boolean allocation) {
this.isPure = allocation;
}
}

View file

@ -39,14 +39,10 @@ public class UPCASTSimpleDeclSpecifier extends CASTSimpleDeclSpecifier
@Override
public UPCASTSimpleDeclSpecifier copy(CopyStyle style) {
UPCASTSimpleDeclSpecifier copy = new UPCASTSimpleDeclSpecifier();
copySimpleDeclSpec(copy, style);
copy.referenceType = referenceType;
copy.sharedQualifier = sharedQualifier;
copy.setBlockSizeExpression(blockSizeExpression == null ? null : blockSizeExpression.copy(style));
if(style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -17,7 +17,6 @@ import org.eclipse.cdt.internal.core.dom.parser.c.CASTTypeIdExpression;
@SuppressWarnings("restriction")
public class UPCASTTypeIdSizeofExpression extends CASTTypeIdExpression implements IUPCASTTypeIdSizeofExpression {
private int upcSizeofOperator;
public UPCASTTypeIdSizeofExpression() {
@ -44,11 +43,7 @@ public class UPCASTTypeIdSizeofExpression extends CASTTypeIdExpression implement
copy.setUPCSizeofOperator(upcSizeofOperator);
IASTTypeId typeId = getTypeId();
copy.setTypeId(typeId == null ? null : typeId.copy(style));
copy.setOffsetAndLength(this);
if(style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override
@ -60,5 +55,4 @@ public class UPCASTTypeIdSizeofExpression extends CASTTypeIdExpression implement
public void setUPCSizeofOperator(int upcSizeofOperator) {
this.upcSizeofOperator = upcSizeofOperator;
}
}

View file

@ -45,14 +45,10 @@ public class UPCASTTypedefNameSpecifier extends CASTTypedefNameSpecifier impleme
public UPCASTTypedefNameSpecifier copy(CopyStyle style) {
IASTName name = getName();
UPCASTTypedefNameSpecifier copy = new UPCASTTypedefNameSpecifier(name == null ? null : name.copy(style));
copyBaseDeclSpec(copy);
copy.referenceType = referenceType;
copy.sharedQualifier = sharedQualifier;
copy.setBlockSizeExpression(blockSizeExpression == null ? null : blockSizeExpression.copy(style));
if(style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -45,11 +45,7 @@ public class UPCASTUnarySizeofExpression extends CASTUnaryExpression implements
copy.setUPCSizeofOperator(upcSizeofOperator);
IASTExpression operand = getOperand();
copy.setOperand(operand == null ? null : operand.copy(style));
copy.setOffsetAndLength(this);
if(style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
@Override

View file

@ -15,7 +15,6 @@ import org.eclipse.cdt.internal.core.dom.parser.c.CASTSimpleDeclSpecifier;
@SuppressWarnings("restriction")
public class XlcCASTVectorTypeSpecifier extends CASTSimpleDeclSpecifier implements IXlcCASTVectorTypeSpecifier {
private boolean isPixel;
private boolean isBool;
@ -31,13 +30,9 @@ public class XlcCASTVectorTypeSpecifier extends CASTSimpleDeclSpecifier implemen
@Override
public XlcCASTVectorTypeSpecifier copy(CopyStyle style) {
XlcCASTVectorTypeSpecifier copy = new XlcCASTVectorTypeSpecifier();
copySimpleDeclSpec(copy, style);
copy.isPixel = isPixel;
copy.isBool = isBool;
if(style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
return copy(copy, style);
}
public boolean isPixel() {
@ -55,5 +50,4 @@ public class XlcCASTVectorTypeSpecifier extends CASTSimpleDeclSpecifier implemen
public void setBool(boolean isBool) {
this.isBool = isBool;
}
}

View file

@ -32,6 +32,11 @@ public class XlcCPPASTModifiedArrayModifier extends CPPASTArrayModifier implemen
@Override
public XlcCPPASTModifiedArrayModifier copy() {
return copy(CopyStyle.withoutLocations);
}
@Override
public XlcCPPASTModifiedArrayModifier copy(CopyStyle style) {
IASTExpression exp = getConstantExpression();
XlcCPPASTModifiedArrayModifier copy = new XlcCPPASTModifiedArrayModifier(exp == null ? null : exp.copy());
copy.isVolatile = isVolatile;
@ -39,8 +44,7 @@ public class XlcCPPASTModifiedArrayModifier extends CPPASTArrayModifier implemen
copy.isStatic = isStatic;
copy.isConst = isConst;
copy.varSized = varSized;
copy.setOffsetAndLength(this);
return copy;
return copy(copy, style);
}
public boolean isConst() {