1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-11 18:25:40 +02:00

Bug 337937 - CopyLocation for copied AST-Node. Fix UPC and XLC compile errors

This commit is contained in:
Marc-Andre Laperle 2011-03-08 05:42:57 +00:00
parent 1be6fe3bd0
commit d2047f3306
13 changed files with 149 additions and 47 deletions

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2008 IBM Corporation and others. * Copyright (c) 2006, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -38,11 +38,19 @@ public class UPCASTCompositeTypeSpecifier extends CASTCompositeTypeSpecifier imp
@Override @Override
public UPCASTCompositeTypeSpecifier copy() { public UPCASTCompositeTypeSpecifier copy() {
return copy(CopyStyle.withoutLocations);
}
@Override
public UPCASTCompositeTypeSpecifier copy(CopyStyle style) {
UPCASTCompositeTypeSpecifier copy = new UPCASTCompositeTypeSpecifier(); UPCASTCompositeTypeSpecifier copy = new UPCASTCompositeTypeSpecifier();
copyCompositeTypeSpecifier(copy); copyCompositeTypeSpecifier(copy, style);
copy.referenceType = referenceType; copy.referenceType = referenceType;
copy.sharedQualifier = sharedQualifier; copy.sharedQualifier = sharedQualifier;
copy.setBlockSizeExpression(blockSizeExpression == null ? null : blockSizeExpression.copy()); copy.setBlockSizeExpression(blockSizeExpression == null ? null : blockSizeExpression.copy(style));
if(style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy; return copy;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2008 IBM Corporation and others. * Copyright (c) 2006, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -38,15 +38,23 @@ public class UPCASTElaboratedTypeSpecifier extends CASTElaboratedTypeSpecifier i
@Override @Override
public UPCASTElaboratedTypeSpecifier copy() { public UPCASTElaboratedTypeSpecifier copy() {
IASTName name = getName(); return copy(CopyStyle.withoutLocations);
UPCASTElaboratedTypeSpecifier copy = new UPCASTElaboratedTypeSpecifier(getKind(), name == null ? null : name.copy());
copy.referenceType = referenceType;
copy.sharedQualifier = sharedQualifier;
copy.setBlockSizeExpression(blockSizeExpression == null ? null : blockSizeExpression.copy());
copy.setOffsetAndLength(this);
return copy;
} }
@Override
public UPCASTElaboratedTypeSpecifier copy(CopyStyle style) {
IASTName name = getName();
UPCASTElaboratedTypeSpecifier copy = new UPCASTElaboratedTypeSpecifier(getKind(), name == null ? null : name.copy(style));
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;
}
public IASTExpression getBlockSizeExpression() { public IASTExpression getBlockSizeExpression() {
return blockSizeExpression; return blockSizeExpression;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2008 IBM Corporation and others. * Copyright (c) 2006, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -38,14 +38,22 @@ public class UPCASTEnumerationSpecifier extends CASTEnumerationSpecifier impleme
@Override @Override
public UPCASTEnumerationSpecifier copy() { public UPCASTEnumerationSpecifier copy() {
UPCASTEnumerationSpecifier copy = new UPCASTEnumerationSpecifier(); return copy(CopyStyle.withoutLocations);
copyEnumerationSpecifier(copy);
copy.referenceType = referenceType;
copy.sharedQualifier = sharedQualifier;
copy.setBlockSizeExpression(blockSizeExpression == null ? null : blockSizeExpression.copy());
return copy;
} }
@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;
}
public IASTExpression getBlockSizeExpression() { public IASTExpression getBlockSizeExpression() {
return blockSizeExpression; return blockSizeExpression;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2008 IBM Corporation and others. * Copyright (c) 2006, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -34,9 +34,17 @@ public class UPCASTForallStatement extends CASTForStatement implements IUPCASTFo
@Override @Override
public UPCASTForallStatement copy() { public UPCASTForallStatement copy() {
return copy(CopyStyle.withoutLocations);
}
@Override
public UPCASTForallStatement copy(CopyStyle style) {
UPCASTForallStatement copy = new UPCASTForallStatement(); UPCASTForallStatement copy = new UPCASTForallStatement();
copyForStatement(copy); copyForStatement(copy, style);
copy.setAffinityExpression(affinity == null ? null : affinity.copy()); copy.setAffinityExpression(affinity == null ? null : affinity.copy(style));
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy; return copy;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2010 IBM Corporation and others. * Copyright (c) 2006, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -31,8 +31,15 @@ public class UPCASTKeywordExpression extends ASTNode implements IUPCASTKeywordEx
} }
public UPCASTKeywordExpression copy() { public UPCASTKeywordExpression copy() {
return copy(CopyStyle.withoutLocations);
}
public UPCASTKeywordExpression copy(CopyStyle style) {
UPCASTKeywordExpression copy = new UPCASTKeywordExpression(keywordKind); UPCASTKeywordExpression copy = new UPCASTKeywordExpression(keywordKind);
copy.setOffsetAndLength(this); copy.setOffsetAndLength(this);
if(style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy; return copy;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2008 IBM Corporation and others. * Copyright (c) 2006, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -23,11 +23,18 @@ public class UPCASTLayoutQualifier extends ASTNode implements IUPCASTLayoutQuali
private IASTExpression blockSizeExpression; private IASTExpression blockSizeExpression;
public UPCASTLayoutQualifier copy() { public UPCASTLayoutQualifier copy() {
return copy(CopyStyle.withoutLocations);
}
public UPCASTLayoutQualifier copy(CopyStyle style) {
UPCASTLayoutQualifier copy = new UPCASTLayoutQualifier(); UPCASTLayoutQualifier copy = new UPCASTLayoutQualifier();
copy.isPure = isPure; copy.isPure = isPure;
copy.isIndefinite = isIndefinite; copy.isIndefinite = isIndefinite;
copy.setBlockSizeExpression(blockSizeExpression == null ? null : blockSizeExpression.copy()); copy.setBlockSizeExpression(blockSizeExpression == null ? null : blockSizeExpression.copy(style));
copy.setOffsetAndLength(this); copy.setOffsetAndLength(this);
if(style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy; return copy;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2008 IBM Corporation and others. * Copyright (c) 2006, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -33,14 +33,22 @@ public class UPCASTSimpleDeclSpecifier extends CASTSimpleDeclSpecifier
@Override @Override
public UPCASTSimpleDeclSpecifier copy() { public UPCASTSimpleDeclSpecifier copy() {
UPCASTSimpleDeclSpecifier copy = new UPCASTSimpleDeclSpecifier(); return copy(CopyStyle.withoutLocations);
copySimpleDeclSpec(copy);
copy.referenceType = referenceType;
copy.sharedQualifier = sharedQualifier;
copy.setBlockSizeExpression(blockSizeExpression == null ? null : blockSizeExpression.copy());
return copy;
} }
@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;
}
public IASTExpression getBlockSizeExpression() { public IASTExpression getBlockSizeExpression() {
return blockSizeExpression; return blockSizeExpression;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2008 IBM Corporation and others. * Copyright (c) 2006, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -31,10 +31,17 @@ public class UPCASTSynchronizationStatement extends ASTNode implements IUPCASTSy
} }
public UPCASTSynchronizationStatement copy() { public UPCASTSynchronizationStatement copy() {
return copy(CopyStyle.withoutLocations);
}
public UPCASTSynchronizationStatement copy(CopyStyle style) {
UPCASTSynchronizationStatement copy = new UPCASTSynchronizationStatement(); UPCASTSynchronizationStatement copy = new UPCASTSynchronizationStatement();
copy.statmentKind = statmentKind; copy.statmentKind = statmentKind;
copy.setBarrierExpression(barrierExpression == null ? null : barrierExpression.copy()); copy.setBarrierExpression(barrierExpression == null ? null : barrierExpression.copy(style));
copy.setOffsetAndLength(this); copy.setOffsetAndLength(this);
if(style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy; return copy;
} }
@ -83,4 +90,5 @@ public class UPCASTSynchronizationStatement extends ASTNode implements IUPCASTSy
return true; return true;
} }
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2008 IBM Corporation and others. * Copyright (c) 2006, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -35,14 +35,22 @@ public class UPCASTTypeIdSizeofExpression extends CASTTypeIdExpression implement
@Override @Override
public UPCASTTypeIdSizeofExpression copy() { public UPCASTTypeIdSizeofExpression copy() {
return copy(CopyStyle.withoutLocations);
}
@Override
public UPCASTTypeIdSizeofExpression copy(CopyStyle style) {
UPCASTTypeIdSizeofExpression copy = new UPCASTTypeIdSizeofExpression(); UPCASTTypeIdSizeofExpression copy = new UPCASTTypeIdSizeofExpression();
copy.setUPCSizeofOperator(upcSizeofOperator); copy.setUPCSizeofOperator(upcSizeofOperator);
IASTTypeId typeId = getTypeId(); IASTTypeId typeId = getTypeId();
copy.setTypeId(typeId == null ? null : typeId.copy()); copy.setTypeId(typeId == null ? null : typeId.copy(style));
copy.setOffsetAndLength(this); copy.setOffsetAndLength(this);
if(style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy; return copy;
} }
public int getUPCSizeofOperator() { public int getUPCSizeofOperator() {
return upcSizeofOperator; return upcSizeofOperator;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2008 IBM Corporation and others. * Copyright (c) 2006, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -38,15 +38,23 @@ public class UPCASTTypedefNameSpecifier extends CASTTypedefNameSpecifier impleme
@Override @Override
public UPCASTTypedefNameSpecifier copy() { public UPCASTTypedefNameSpecifier copy() {
return copy(CopyStyle.withoutLocations);
}
@Override
public UPCASTTypedefNameSpecifier copy(CopyStyle style) {
IASTName name = getName(); IASTName name = getName();
UPCASTTypedefNameSpecifier copy = new UPCASTTypedefNameSpecifier(name == null ? null : name.copy()); UPCASTTypedefNameSpecifier copy = new UPCASTTypedefNameSpecifier(name == null ? null : name.copy(style));
copyBaseDeclSpec(copy); copyBaseDeclSpec(copy);
copy.referenceType = referenceType; copy.referenceType = referenceType;
copy.sharedQualifier = sharedQualifier; copy.sharedQualifier = sharedQualifier;
copy.setBlockSizeExpression(blockSizeExpression == null ? null : blockSizeExpression.copy()); copy.setBlockSizeExpression(blockSizeExpression == null ? null : blockSizeExpression.copy(style));
if(style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy; return copy;
} }
public IASTExpression getBlockSizeExpression() { public IASTExpression getBlockSizeExpression() {
return blockSizeExpression; return blockSizeExpression;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2008 IBM Corporation and others. * Copyright (c) 2006, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -36,14 +36,22 @@ public class UPCASTUnarySizeofExpression extends CASTUnaryExpression implements
@Override @Override
public UPCASTUnarySizeofExpression copy() { public UPCASTUnarySizeofExpression copy() {
return copy(CopyStyle.withoutLocations);
}
@Override
public UPCASTUnarySizeofExpression copy(CopyStyle style) {
UPCASTUnarySizeofExpression copy = new UPCASTUnarySizeofExpression(); UPCASTUnarySizeofExpression copy = new UPCASTUnarySizeofExpression();
copy.setUPCSizeofOperator(upcSizeofOperator); copy.setUPCSizeofOperator(upcSizeofOperator);
IASTExpression operand = getOperand(); IASTExpression operand = getOperand();
copy.setOperand(operand == null ? null : operand.copy()); copy.setOperand(operand == null ? null : operand.copy(style));
copy.setOffsetAndLength(this); copy.setOffsetAndLength(this);
if(style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy; return copy;
} }
public int getUPCSizeofOperator() { public int getUPCSizeofOperator() {
return upcSizeofOperator; return upcSizeofOperator;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2009 IBM Corporation and others. * Copyright (c) 2009, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -25,10 +25,18 @@ public class XlcCASTVectorTypeSpecifier extends CASTSimpleDeclSpecifier implemen
@Override @Override
public XlcCASTVectorTypeSpecifier copy() { public XlcCASTVectorTypeSpecifier copy() {
return copy(CopyStyle.withoutLocations);
}
@Override
public XlcCASTVectorTypeSpecifier copy(CopyStyle style) {
XlcCASTVectorTypeSpecifier copy = new XlcCASTVectorTypeSpecifier(); XlcCASTVectorTypeSpecifier copy = new XlcCASTVectorTypeSpecifier();
copySimpleDeclSpec(copy); copySimpleDeclSpec(copy, style);
copy.isPixel = isPixel; copy.isPixel = isPixel;
copy.isBool = isBool; copy.isBool = isBool;
if(style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy; return copy;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2009 IBM Corporation and others. * Copyright (c) 2009, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -24,9 +24,17 @@ public class XlcCPPASTVectorTypeSpecifier extends CPPASTSimpleDeclSpecifier impl
@Override @Override
public XlcCPPASTVectorTypeSpecifier copy() { public XlcCPPASTVectorTypeSpecifier copy() {
return copy(CopyStyle.withoutLocations);
}
@Override
public XlcCPPASTVectorTypeSpecifier copy(CopyStyle style) {
XlcCPPASTVectorTypeSpecifier copy = new XlcCPPASTVectorTypeSpecifier(); XlcCPPASTVectorTypeSpecifier copy = new XlcCPPASTVectorTypeSpecifier();
copySimpleDeclSpec(copy); copySimpleDeclSpec(copy, style);
copy.isPixel = isPixel; copy.isPixel = isPixel;
if(style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy; return copy;
} }