Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTNode.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTProblem.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTTranslationUnit.java4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTTypeIdInitializerExpression.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTASMDeclaration.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArrayDesignator.java34
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArrayModifier.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArrayRangeDesignator.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArraySubscriptExpression.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTBaseDeclSpecifier.java4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTCastExpression.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTCompositeTypeSpecifier.java13
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTCompoundStatementExpression.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTConditionalExpression.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTElaboratedTypeSpecifier.java10
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTEnumerationSpecifier.java13
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTEqualsInitializer.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTExpressionList.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTFieldDesignator.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTFieldReference.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTFunctionDefinition.java7
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTInitializerExpression.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTInitializerList.java9
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTLiteralExpression.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTName.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTParameterDeclaration.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTPointer.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTProblem.java12
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTSimpleDeclSpecifier.java10
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTranslationUnit.java12
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTypeId.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTypeIdExpression.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTypedefNameSpecifier.java10
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GCCASTSimpleDeclSpecifier.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTASMDeclaration.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArrayDeclarator.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArrayModifier.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArraySubscriptExpression.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBaseSpecifier.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryTypeIdExpression.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCapture.java14
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCastExpression.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCompoundStatementExpression.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTConditionalExpression.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTConstructorChainInitializer.java7
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTConversionName.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDeclarator.java10
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDecltypeSpecifier.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDeleteExpression.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTEqualsInitializer.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTExplicitTemplateInstantiation.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTExpressionList.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldDeclarator.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionDeclarator.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionWithTryBlock.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTInitializerExpression.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTInitializerList.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLambdaExpression.java16
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTName.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamespaceAlias.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamespaceDefinition.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNewExpression.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTOperatorName.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTPackExpansionExpression.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTParameterDeclaration.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTPointer.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTPointerToMember.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTProblem.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTQualifiedName.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTReferenceOperator.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleTypeConstructorExpression.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleTypeTemplateParameter.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTStaticAssertionDeclaration.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplateDeclaration.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplateSpecialization.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplatedTypeTemplateParameter.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTranslationUnit.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypenameExpression.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUnaryExpression.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GPPASTExplicitTemplateInstantiation.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GPPASTPointer.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GPPASTPointerToMember.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ContainerNode.java16
-rw-r--r--upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTCompositeTypeSpecifier.java6
-rw-r--r--upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTElaboratedTypeSpecifier.java6
-rw-r--r--upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTEnumerationSpecifier.java6
-rw-r--r--upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTKeywordExpression.java6
-rw-r--r--upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTLayoutQualifier.java15
-rw-r--r--upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTSimpleDeclSpecifier.java6
-rw-r--r--upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTTypeIdSizeofExpression.java8
-rw-r--r--upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTTypedefNameSpecifier.java6
-rw-r--r--upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTUnarySizeofExpression.java6
-rw-r--r--xlc/org.eclipse.cdt.core.lrparser.xlc/parser/org/eclipse/cdt/internal/core/lrparser/xlc/ast/XlcCASTVectorTypeSpecifier.java8
-rw-r--r--xlc/org.eclipse.cdt.core.lrparser.xlc/parser/org/eclipse/cdt/internal/core/lrparser/xlc/ast/XlcCPPASTModifiedArrayModifier.java8
94 files changed, 153 insertions, 526 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTNode.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTNode.java
index 4a7e8e59d3b..71ba34ef0c2 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTNode.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTNode.java
@@ -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) };
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTProblem.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTProblem.java
index ada44c0f132..6b04283e619 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTProblem.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTProblem.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTTranslationUnit.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTTranslationUnit.java
index e3e6fe5b925..3d14dc3c98a 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTTranslationUnit.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTTranslationUnit.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTTypeIdInitializerExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTTypeIdInitializerExpression.java
index 87d64e1673e..95388dff54c 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTTypeIdInitializerExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTTypeIdInitializerExpression.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTASMDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTASMDeclaration.java
index d4d5e6d835b..679440b39f5 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTASMDeclaration.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTASMDeclaration.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArrayDesignator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArrayDesignator.java
index 8335c471d2c..01c17b32bf6 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArrayDesignator.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArrayDesignator.java
@@ -6,9 +6,9 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * John Camelon (IBM Rational Software) - Initial API and implementation
- * Yuan Zhang / Beth Tibbitts (IBM Research)
- * Markus Schorn (Wind River Systems)
+ * John Camelon (IBM Rational Software) - Initial API and implementation
+ * Yuan Zhang / Beth Tibbitts (IBM Research)
+ * Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
@@ -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
@@ -59,19 +52,19 @@ public class CASTArrayDesignator extends ASTNode implements
public void setSubscriptExpression(IASTExpression value) {
assertNotFrozen();
exp = value;
- if(value != null) {
+ if (value != null) {
value.setParent(this);
value.setPropertyInParent(SUBSCRIPT_EXPRESSION);
}
}
@Override
- public boolean accept( ASTVisitor action ){
+ public boolean accept(ASTVisitor action) {
if (action.shouldVisitDesignators) {
switch (action.visit(this)) {
- case ASTVisitor.PROCESS_ABORT : return false;
- case ASTVisitor.PROCESS_SKIP : return true;
- default : break;
+ case ASTVisitor.PROCESS_ABORT: return false;
+ case ASTVisitor.PROCESS_SKIP: return true;
+ default: break;
}
}
if (exp != null && !exp.accept(action))
@@ -85,10 +78,9 @@ public class CASTArrayDesignator extends ASTNode implements
@Override
public void replace(IASTNode child, IASTNode other) {
- if( child == exp )
- {
- other.setPropertyInParent( child.getPropertyInParent() );
- other.setParent( child.getParent() );
+ if (child == exp) {
+ other.setPropertyInParent(child.getPropertyInParent());
+ other.setParent(child.getParent());
exp = (IASTExpression) other;
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArrayModifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArrayModifier.java
index e57ecbc271a..941746838d3 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArrayModifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArrayModifier.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArrayRangeDesignator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArrayRangeDesignator.java
index f248e614109..8254836c6c7 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArrayRangeDesignator.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArrayRangeDesignator.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArraySubscriptExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArraySubscriptExpression.java
index 292ab6d1957..ff9edbd9bc1 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArraySubscriptExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArraySubscriptExpression.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTBaseDeclSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTBaseDeclSpecifier.java
index 86d7f355079..d8f002bd023 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTBaseDeclSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTBaseDeclSpecifier.java
@@ -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);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTCastExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTCastExpression.java
index 8bcd8b5b112..95dd8536bdc 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTCastExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTCastExpression.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTCompositeTypeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTCompositeTypeSpecifier.java
index dba54022524..8647b1832d8 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTCompositeTypeSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTCompositeTypeSpecifier.java
@@ -50,19 +50,16 @@ 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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTCompoundStatementExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTCompoundStatementExpression.java
index 0dae9369d99..828c398995b 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTCompoundStatementExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTCompoundStatementExpression.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTConditionalExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTConditionalExpression.java
index e44f92c83e3..9c414454434 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTConditionalExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTConditionalExpression.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTElaboratedTypeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTElaboratedTypeSpecifier.java
index 6d76acc21f9..786da820f8a 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTElaboratedTypeSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTElaboratedTypeSpecifier.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTEnumerationSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTEnumerationSpecifier.java
index d601733693d..680c115c882 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTEnumerationSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTEnumerationSpecifier.java
@@ -43,18 +43,15 @@ 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);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTEqualsInitializer.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTEqualsInitializer.java
index e699e9c2282..a0067fff3d6 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTEqualsInitializer.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTEqualsInitializer.java
@@ -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);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTExpressionList.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTExpressionList.java
index 8182750f5fb..67987646701 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTExpressionList.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTExpressionList.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTFieldDesignator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTFieldDesignator.java
index 7d8a6edf8e0..ac233f35958 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTFieldDesignator.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTFieldDesignator.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTFieldReference.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTFieldReference.java
index 0b247b0f768..d7f8fa31bf2 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTFieldReference.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTFieldReference.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTFunctionDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTFunctionDefinition.java
index 6947035e1cf..9f778a19ace 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTFunctionDefinition.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTFunctionDefinition.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTInitializerExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTInitializerExpression.java
index b023dd83275..10392dc9e53 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTInitializerExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTInitializerExpression.java
@@ -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);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTInitializerList.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTInitializerList.java
index 134fbfb2e65..307962c68e0 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTInitializerList.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTInitializerList.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTLiteralExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTLiteralExpression.java
index 8e0f15927d7..6cdeebe13e1 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTLiteralExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTLiteralExpression.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTName.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTName.java
index 2b0c8403a37..fcb69af5a52 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTName.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTName.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTParameterDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTParameterDeclaration.java
index 11bf3f16ec4..369e2b993cf 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTParameterDeclaration.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTParameterDeclaration.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTPointer.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTPointer.java
index eaae82ec5c1..28d92423357 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTPointer.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTPointer.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTProblem.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTProblem.java
index c21c9c59197..ca131126c7c 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTProblem.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTProblem.java
@@ -27,12 +27,16 @@ 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
public boolean accept(ASTVisitor action) {
if (action.shouldVisitProblems) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTSimpleDeclSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTSimpleDeclSpecifier.java
index 02165d095a4..96e94ba3af2 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTSimpleDeclSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTSimpleDeclSpecifier.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTranslationUnit.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTranslationUnit.java
index 491f570695f..c462651af8e 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTranslationUnit.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTranslationUnit.java
@@ -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) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTypeId.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTypeId.java
index 3c9ceb40d1a..37e39bb5788 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTypeId.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTypeId.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTypeIdExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTypeIdExpression.java
index 9fd6650f0bd..0720bcaa4a9 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTypeIdExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTypeIdExpression.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTypedefNameSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTypedefNameSpecifier.java
index 4ad2bad2fe8..5585c7537e9 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTypedefNameSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTypedefNameSpecifier.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GCCASTSimpleDeclSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GCCASTSimpleDeclSpecifier.java
index 722ebb435fb..d80f8f2b8df 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GCCASTSimpleDeclSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GCCASTSimpleDeclSpecifier.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTASMDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTASMDeclaration.java
index 715ff2b1ff6..a30737d4953 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTASMDeclaration.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTASMDeclaration.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArrayDeclarator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArrayDeclarator.java
index a5bec51cd8f..f586c6bc028 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArrayDeclarator.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArrayDeclarator.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArrayModifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArrayModifier.java
index 93ad3de48fd..29c92c181ec 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArrayModifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArrayModifier.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArraySubscriptExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArraySubscriptExpression.java
index 2068c5b6ef5..63daca65bbf 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArraySubscriptExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArraySubscriptExpression.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBaseSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBaseSpecifier.java
index 56feb529af0..6fbbf27cf65 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBaseSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBaseSpecifier.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryTypeIdExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryTypeIdExpression.java
index 8f66d94a242..1f2a8c02fd1 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryTypeIdExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryTypeIdExpression.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCapture.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCapture.java
index 7fc7e052082..a907e750f55 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCapture.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCapture.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCastExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCastExpression.java
index 456e6263699..265cec3cac8 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCastExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCastExpression.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCompoundStatementExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCompoundStatementExpression.java
index 623b8436c5c..cd4938fff41 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCompoundStatementExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCompoundStatementExpression.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTConditionalExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTConditionalExpression.java
index 4b2f09961b2..c0a810ca0ce 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTConditionalExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTConditionalExpression.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTConstructorChainInitializer.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTConstructorChainInitializer.java
index 46b86d1f30a..964f0d26e62 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTConstructorChainInitializer.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTConstructorChainInitializer.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTConversionName.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTConversionName.java
index 06bbcb610f0..3a2ad37bf1c 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTConversionName.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTConversionName.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDeclarator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDeclarator.java
index afe67b15d14..a50372d576a 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDeclarator.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDeclarator.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDecltypeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDecltypeSpecifier.java
index 2fd1b0e4a18..500c1c2d3e5 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDecltypeSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDecltypeSpecifier.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDeleteExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDeleteExpression.java
index 0603d0c2ed7..53dbdb8b89c 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDeleteExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDeleteExpression.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTEqualsInitializer.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTEqualsInitializer.java
index 14009a09773..c12409a5a9c 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTEqualsInitializer.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTEqualsInitializer.java
@@ -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);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTExplicitTemplateInstantiation.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTExplicitTemplateInstantiation.java
index 4311194512b..500198f7af1 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTExplicitTemplateInstantiation.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTExplicitTemplateInstantiation.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTExpressionList.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTExpressionList.java
index 9f14ca221b2..051f7e1be7a 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTExpressionList.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTExpressionList.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldDeclarator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldDeclarator.java
index 6c0da203f24..30f3af61577 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldDeclarator.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldDeclarator.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionDeclarator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionDeclarator.java
index 06c875b746e..ff3fbcee596 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionDeclarator.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionDeclarator.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionWithTryBlock.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionWithTryBlock.java
index 8fde74f3faf..983aa10e36b 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionWithTryBlock.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionWithTryBlock.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTInitializerExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTInitializerExpression.java
index 04c94361966..da81a0fd69b 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTInitializerExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTInitializerExpression.java
@@ -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);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTInitializerList.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTInitializerList.java
index 08858266359..30b85288e91 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTInitializerList.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTInitializerList.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLambdaExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLambdaExpression.java
index 1c6fd852b18..293dd446654 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLambdaExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLambdaExpression.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTName.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTName.java
index 2456a54e4fc..f9797b8df18 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTName.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTName.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamespaceAlias.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamespaceAlias.java
index 524fdf37ea8..1f2559d86f1 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamespaceAlias.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamespaceAlias.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamespaceDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamespaceDefinition.java
index 718073ea8d8..031fcab0da0 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamespaceDefinition.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamespaceDefinition.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNewExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNewExpression.java
index 5c6098b719c..aebbb8ca50d 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNewExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNewExpression.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTOperatorName.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTOperatorName.java
index 0c59adb83fd..e0d79c0e620 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTOperatorName.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTOperatorName.java
@@ -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);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTPackExpansionExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTPackExpansionExpression.java
index 58747fd9592..8341fed79e9 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTPackExpansionExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTPackExpansionExpression.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTParameterDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTParameterDeclaration.java
index f317d66b1f7..eefd55cd87b 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTParameterDeclaration.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTParameterDeclaration.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTPointer.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTPointer.java
index 8d207e82e41..0171242a1eb 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTPointer.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTPointer.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTPointerToMember.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTPointerToMember.java
index f29967bd741..34241ea9d88 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTPointerToMember.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTPointerToMember.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTProblem.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTProblem.java
index 988787d934e..2e4122ad5a5 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTProblem.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTProblem.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTQualifiedName.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTQualifiedName.java
index 4fd14d34f65..ad915eb6629 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTQualifiedName.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTQualifiedName.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTReferenceOperator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTReferenceOperator.java
index 395d54479af..89f16aaaee1 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTReferenceOperator.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTReferenceOperator.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleTypeConstructorExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleTypeConstructorExpression.java
index 375b6a8a4a3..996b4a91c8e 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleTypeConstructorExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleTypeConstructorExpression.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleTypeTemplateParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleTypeTemplateParameter.java
index 9a49b0576c5..9c98344e07d 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleTypeTemplateParameter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleTypeTemplateParameter.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTStaticAssertionDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTStaticAssertionDeclaration.java
index fd3156c670f..ad1fc38b4fd 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTStaticAssertionDeclaration.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTStaticAssertionDeclaration.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplateDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplateDeclaration.java
index 4f31d51e060..0520f73f8d6 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplateDeclaration.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplateDeclaration.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplateSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplateSpecialization.java
index ceeca60f8a8..ec49667932e 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplateSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplateSpecialization.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplatedTypeTemplateParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplatedTypeTemplateParameter.java
index 15c83b747e5..63742c8ad9d 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplatedTypeTemplateParameter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplatedTypeTemplateParameter.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTranslationUnit.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTranslationUnit.java
index 1759cb2165e..b34be7ccaf3 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTranslationUnit.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTranslationUnit.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypenameExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypenameExpression.java
index ba3e732e58b..ea07517ea0a 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypenameExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypenameExpression.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUnaryExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUnaryExpression.java
index 9a68aad31bd..50de75b5d7d 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUnaryExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUnaryExpression.java
@@ -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
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GPPASTExplicitTemplateInstantiation.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GPPASTExplicitTemplateInstantiation.java
index 9939dba8dfd..1d863b06b26 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GPPASTExplicitTemplateInstantiation.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GPPASTExplicitTemplateInstantiation.java
@@ -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);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GPPASTPointer.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GPPASTPointer.java
index 50c8a49de9a..00b7927c21c 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GPPASTPointer.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GPPASTPointer.java
@@ -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);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GPPASTPointerToMember.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GPPASTPointerToMember.java
index 3996c644e1d..ca96805ffda 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GPPASTPointerToMember.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GPPASTPointerToMember.java
@@ -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);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ContainerNode.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ContainerNode.java
index f32f3a57262..d56083ff92d 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ContainerNode.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/ContainerNode.java
@@ -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,10 +64,10 @@ public class ContainerNode extends ASTNode {
}
public IASTTranslationUnit getTu() {
- return tu;
+ return null;
}
- public List<IASTNode> getNodes(){
+ public List<IASTNode> getNodes() {
return Collections.unmodifiableList(nodes);
}
}
diff --git a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTCompositeTypeSpecifier.java b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTCompositeTypeSpecifier.java
index 0ae87dd2132..a70eec76b74 100644
--- a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTCompositeTypeSpecifier.java
+++ b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTCompositeTypeSpecifier.java
@@ -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
diff --git a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTElaboratedTypeSpecifier.java b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTElaboratedTypeSpecifier.java
index 7bac8fa46d4..2bf643ebe0a 100644
--- a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTElaboratedTypeSpecifier.java
+++ b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTElaboratedTypeSpecifier.java
@@ -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
diff --git a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTEnumerationSpecifier.java b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTEnumerationSpecifier.java
index fa3a6d3f51a..d730e181fbc 100644
--- a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTEnumerationSpecifier.java
+++ b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTEnumerationSpecifier.java
@@ -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
diff --git a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTKeywordExpression.java b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTKeywordExpression.java
index 049b8186fa0..6aa6801e77f 100644
--- a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTKeywordExpression.java
+++ b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTKeywordExpression.java
@@ -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
diff --git a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTLayoutQualifier.java b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTLayoutQualifier.java
index d36ec1be589..6eb13565084 100644
--- a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTLayoutQualifier.java
+++ b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTLayoutQualifier.java
@@ -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;
}
-
-
-
}
diff --git a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTSimpleDeclSpecifier.java b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTSimpleDeclSpecifier.java
index 4111cc32a2b..42d664dc5ef 100644
--- a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTSimpleDeclSpecifier.java
+++ b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTSimpleDeclSpecifier.java
@@ -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
diff --git a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTTypeIdSizeofExpression.java b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTTypeIdSizeofExpression.java
index 592e87d2948..5f2ba570182 100644
--- a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTTypeIdSizeofExpression.java
+++ b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTTypeIdSizeofExpression.java
@@ -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;
}
-
}
diff --git a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTTypedefNameSpecifier.java b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTTypedefNameSpecifier.java
index 79506e438e9..07acfb49b83 100644
--- a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTTypedefNameSpecifier.java
+++ b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTTypedefNameSpecifier.java
@@ -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
diff --git a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTUnarySizeofExpression.java b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTUnarySizeofExpression.java
index 135b626112d..aed28081f32 100644
--- a/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTUnarySizeofExpression.java
+++ b/upc/org.eclipse.cdt.core.parser.upc/src/org/eclipse/cdt/internal/core/dom/parser/upc/ast/UPCASTUnarySizeofExpression.java
@@ -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
diff --git a/xlc/org.eclipse.cdt.core.lrparser.xlc/parser/org/eclipse/cdt/internal/core/lrparser/xlc/ast/XlcCASTVectorTypeSpecifier.java b/xlc/org.eclipse.cdt.core.lrparser.xlc/parser/org/eclipse/cdt/internal/core/lrparser/xlc/ast/XlcCASTVectorTypeSpecifier.java
index b2df81bcab5..2f058b27493 100644
--- a/xlc/org.eclipse.cdt.core.lrparser.xlc/parser/org/eclipse/cdt/internal/core/lrparser/xlc/ast/XlcCASTVectorTypeSpecifier.java
+++ b/xlc/org.eclipse.cdt.core.lrparser.xlc/parser/org/eclipse/cdt/internal/core/lrparser/xlc/ast/XlcCASTVectorTypeSpecifier.java
@@ -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;
}
-
}
diff --git a/xlc/org.eclipse.cdt.core.lrparser.xlc/parser/org/eclipse/cdt/internal/core/lrparser/xlc/ast/XlcCPPASTModifiedArrayModifier.java b/xlc/org.eclipse.cdt.core.lrparser.xlc/parser/org/eclipse/cdt/internal/core/lrparser/xlc/ast/XlcCPPASTModifiedArrayModifier.java
index 4231f03dc2f..e8edd8560ed 100644
--- a/xlc/org.eclipse.cdt.core.lrparser.xlc/parser/org/eclipse/cdt/internal/core/lrparser/xlc/ast/XlcCPPASTModifiedArrayModifier.java
+++ b/xlc/org.eclipse.cdt.core.lrparser.xlc/parser/org/eclipse/cdt/internal/core/lrparser/xlc/ast/XlcCPPASTModifiedArrayModifier.java
@@ -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() {

Back to the top