1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-15 13:05: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; return copy;
} }
protected void setCopyLocation(IASTNode originalNode) { private void setCopyLocation(IASTNode originalNode) {
locations = new IASTNodeLocation[] { new ASTCopyLocation(originalNode) }; locations = new IASTNodeLocation[] { new ASTCopyLocation(originalNode) };
} }

View file

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

View file

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

View file

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

View file

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

View file

@ -22,12 +22,9 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
/** /**
* Implementation of array designators * Implementation of array designators
*/ */
public class CASTArrayDesignator extends ASTNode implements public class CASTArrayDesignator extends ASTNode implements ICASTArrayDesignator, IASTAmbiguityParent {
ICASTArrayDesignator, IASTAmbiguityParent {
private IASTExpression exp; private IASTExpression exp;
public CASTArrayDesignator() { public CASTArrayDesignator() {
} }
@ -43,11 +40,7 @@ public class CASTArrayDesignator extends ASTNode implements
@Override @Override
public CASTArrayDesignator copy(CopyStyle style) { public CASTArrayDesignator copy(CopyStyle style) {
CASTArrayDesignator copy = new CASTArrayDesignator(exp == null ? null : exp.copy(style)); CASTArrayDesignator copy = new CASTArrayDesignator(exp == null ? null : exp.copy(style));
copy.setOffsetAndLength(this); return copy(copy, style);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
} }
@Override @Override
@ -59,19 +52,19 @@ public class CASTArrayDesignator extends ASTNode implements
public void setSubscriptExpression(IASTExpression value) { public void setSubscriptExpression(IASTExpression value) {
assertNotFrozen(); assertNotFrozen();
exp = value; exp = value;
if(value != null) { if (value != null) {
value.setParent(this); value.setParent(this);
value.setPropertyInParent(SUBSCRIPT_EXPRESSION); value.setPropertyInParent(SUBSCRIPT_EXPRESSION);
} }
} }
@Override @Override
public boolean accept( ASTVisitor action ){ public boolean accept(ASTVisitor action) {
if (action.shouldVisitDesignators) { if (action.shouldVisitDesignators) {
switch (action.visit(this)) { switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT : return false; case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP : return true; case ASTVisitor.PROCESS_SKIP: return true;
default : break; default: break;
} }
} }
if (exp != null && !exp.accept(action)) if (exp != null && !exp.accept(action))
@ -85,10 +78,9 @@ public class CASTArrayDesignator extends ASTNode implements
@Override @Override
public void replace(IASTNode child, IASTNode other) { public void replace(IASTNode child, IASTNode other) {
if( child == exp ) if (child == exp) {
{ other.setPropertyInParent(child.getPropertyInParent());
other.setPropertyInParent( child.getPropertyInParent() ); other.setParent(child.getParent());
other.setParent( child.getParent() );
exp = (IASTExpression) other; exp = (IASTExpression) other;
} }
} }

View file

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

View file

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

View file

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

View file

@ -81,12 +81,12 @@ public abstract class CASTBaseDeclSpecifier extends ASTNode implements ICASTDecl
this.isInline = value; this.isInline = value;
} }
protected void copyBaseDeclSpec(CASTBaseDeclSpecifier copy) { protected <T extends CASTBaseDeclSpecifier> T copy(T copy, CopyStyle style) {
copy.storageClass = storageClass; copy.storageClass = storageClass;
copy.isConst = isConst; copy.isConst = isConst;
copy.isVolatile = isVolatile; copy.isVolatile = isVolatile;
copy.isRestrict = isRestrict; copy.isRestrict = isRestrict;
copy.isInline = isInline; 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)); copy.setTypeId(typeId == null ? null : typeId.copy(style));
IASTExpression operand = getOperand(); IASTExpression operand = getOperand();
copy.setOperand(operand == null ? null : operand.copy(style)); copy.setOperand(operand == null ? null : operand.copy(style));
copy.setOffsetAndLength(this); return copy(copy, style);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
} }
@Override @Override

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -40,14 +40,11 @@ public class CASTInitializerList extends ASTNode implements IASTInitializerList,
@Override @Override
public CASTInitializerList copy(CopyStyle style) { public CASTInitializerList copy(CopyStyle style) {
CASTInitializerList copy = new CASTInitializerList(); CASTInitializerList copy = new CASTInitializerList();
for (IASTInitializerClause initializer : getClauses()) for (IASTInitializerClause initializer : getClauses()) {
copy.addClause(initializer == null ? null : initializer.copy(style)); 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 @Override

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -52,11 +52,7 @@ public class CPPASTConditionalExpression extends ASTNode implements IASTConditio
copy.setLogicalConditionExpression(fCondition == null ? null : fCondition.copy(style)); copy.setLogicalConditionExpression(fCondition == null ? null : fCondition.copy(style));
copy.setPositiveResultExpression(fPositive == null ? null : fPositive.copy(style)); copy.setPositiveResultExpression(fPositive == null ? null : fPositive.copy(style));
copy.setNegativeResultExpression(fNegative == null ? null : fNegative.copy(style)); copy.setNegativeResultExpression(fNegative == null ? null : fNegative.copy(style));
copy.setOffsetAndLength(this); return copy(copy, style);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
} }
@Override @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.ICPPASTConstructorChainInitializer;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorInitializer; 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.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.ICPPBase;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor; import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
@ -70,12 +69,8 @@ public class CPPASTConstructorChainInitializer extends ASTNode implements
CPPASTConstructorChainInitializer copy = new CPPASTConstructorChainInitializer(); CPPASTConstructorChainInitializer copy = new CPPASTConstructorChainInitializer();
copy.setMemberInitializerId(name == null ? null : name.copy(style)); copy.setMemberInitializerId(name == null ? null : name.copy(style));
copy.setInitializer(initializer == null ? null : initializer.copy(style)); copy.setInitializer(initializer == null ? null : initializer.copy(style));
copy.setOffsetAndLength(this);
copy.fIsPackExpansion = fIsPackExpansion; copy.fIsPackExpansion = fIsPackExpansion;
if (style == CopyStyle.withLocations) { return copy(copy, style);
copy.setCopyLocation(this);
}
return copy;
} }
@Override @Override

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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