1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 17:35:35 +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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -38,11 +38,19 @@ public class UPCASTCompositeTypeSpecifier extends CASTCompositeTypeSpecifier imp
@Override
public UPCASTCompositeTypeSpecifier copy() {
return copy(CopyStyle.withoutLocations);
}
@Override
public UPCASTCompositeTypeSpecifier copy(CopyStyle style) {
UPCASTCompositeTypeSpecifier copy = new UPCASTCompositeTypeSpecifier();
copyCompositeTypeSpecifier(copy);
copyCompositeTypeSpecifier(copy, style);
copy.referenceType = referenceType;
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;
}

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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -38,15 +38,23 @@ public class UPCASTElaboratedTypeSpecifier extends CASTElaboratedTypeSpecifier i
@Override
public UPCASTElaboratedTypeSpecifier copy() {
IASTName name = getName();
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;
return copy(CopyStyle.withoutLocations);
}
@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() {
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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -38,14 +38,22 @@ public class UPCASTEnumerationSpecifier extends CASTEnumerationSpecifier impleme
@Override
public UPCASTEnumerationSpecifier copy() {
UPCASTEnumerationSpecifier copy = new UPCASTEnumerationSpecifier();
copyEnumerationSpecifier(copy);
copy.referenceType = referenceType;
copy.sharedQualifier = sharedQualifier;
copy.setBlockSizeExpression(blockSizeExpression == null ? null : blockSizeExpression.copy());
return copy;
return copy(CopyStyle.withoutLocations);
}
@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() {
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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -34,9 +34,17 @@ public class UPCASTForallStatement extends CASTForStatement implements IUPCASTFo
@Override
public UPCASTForallStatement copy() {
return copy(CopyStyle.withoutLocations);
}
@Override
public UPCASTForallStatement copy(CopyStyle style) {
UPCASTForallStatement copy = new UPCASTForallStatement();
copyForStatement(copy);
copy.setAffinityExpression(affinity == null ? null : affinity.copy());
copyForStatement(copy, style);
copy.setAffinityExpression(affinity == null ? null : affinity.copy(style));
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -31,8 +31,15 @@ public class UPCASTKeywordExpression extends ASTNode implements IUPCASTKeywordEx
}
public UPCASTKeywordExpression copy() {
return copy(CopyStyle.withoutLocations);
}
public UPCASTKeywordExpression copy(CopyStyle style) {
UPCASTKeywordExpression copy = new UPCASTKeywordExpression(keywordKind);
copy.setOffsetAndLength(this);
if(style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -23,11 +23,18 @@ public class UPCASTLayoutQualifier extends ASTNode implements IUPCASTLayoutQuali
private IASTExpression blockSizeExpression;
public UPCASTLayoutQualifier copy() {
return copy(CopyStyle.withoutLocations);
}
public UPCASTLayoutQualifier copy(CopyStyle style) {
UPCASTLayoutQualifier copy = new UPCASTLayoutQualifier();
copy.isPure = isPure;
copy.isIndefinite = isIndefinite;
copy.setBlockSizeExpression(blockSizeExpression == null ? null : blockSizeExpression.copy());
copy.setBlockSizeExpression(blockSizeExpression == null ? null : blockSizeExpression.copy(style));
copy.setOffsetAndLength(this);
if(style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -33,14 +33,22 @@ public class UPCASTSimpleDeclSpecifier extends CASTSimpleDeclSpecifier
@Override
public UPCASTSimpleDeclSpecifier copy() {
UPCASTSimpleDeclSpecifier copy = new UPCASTSimpleDeclSpecifier();
copySimpleDeclSpec(copy);
copy.referenceType = referenceType;
copy.sharedQualifier = sharedQualifier;
copy.setBlockSizeExpression(blockSizeExpression == null ? null : blockSizeExpression.copy());
return copy;
return copy(CopyStyle.withoutLocations);
}
@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() {
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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -31,10 +31,17 @@ public class UPCASTSynchronizationStatement extends ASTNode implements IUPCASTSy
}
public UPCASTSynchronizationStatement copy() {
return copy(CopyStyle.withoutLocations);
}
public UPCASTSynchronizationStatement copy(CopyStyle style) {
UPCASTSynchronizationStatement copy = new UPCASTSynchronizationStatement();
copy.statmentKind = statmentKind;
copy.setBarrierExpression(barrierExpression == null ? null : barrierExpression.copy());
copy.setBarrierExpression(barrierExpression == null ? null : barrierExpression.copy(style));
copy.setOffsetAndLength(this);
if(style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
}
@ -83,4 +90,5 @@ public class UPCASTSynchronizationStatement extends ASTNode implements IUPCASTSy
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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -35,14 +35,22 @@ public class UPCASTTypeIdSizeofExpression extends CASTTypeIdExpression implement
@Override
public UPCASTTypeIdSizeofExpression copy() {
return copy(CopyStyle.withoutLocations);
}
@Override
public UPCASTTypeIdSizeofExpression copy(CopyStyle style) {
UPCASTTypeIdSizeofExpression copy = new UPCASTTypeIdSizeofExpression();
copy.setUPCSizeofOperator(upcSizeofOperator);
IASTTypeId typeId = getTypeId();
copy.setTypeId(typeId == null ? null : typeId.copy());
copy.setTypeId(typeId == null ? null : typeId.copy(style));
copy.setOffsetAndLength(this);
if(style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
}
public int getUPCSizeofOperator() {
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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -38,15 +38,23 @@ public class UPCASTTypedefNameSpecifier extends CASTTypedefNameSpecifier impleme
@Override
public UPCASTTypedefNameSpecifier copy() {
return copy(CopyStyle.withoutLocations);
}
@Override
public UPCASTTypedefNameSpecifier copy(CopyStyle style) {
IASTName name = getName();
UPCASTTypedefNameSpecifier copy = new UPCASTTypedefNameSpecifier(name == null ? null : name.copy());
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());
copy.setBlockSizeExpression(blockSizeExpression == null ? null : blockSizeExpression.copy(style));
if(style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
}
public IASTExpression getBlockSizeExpression() {
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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -36,14 +36,22 @@ public class UPCASTUnarySizeofExpression extends CASTUnaryExpression implements
@Override
public UPCASTUnarySizeofExpression copy() {
return copy(CopyStyle.withoutLocations);
}
@Override
public UPCASTUnarySizeofExpression copy(CopyStyle style) {
UPCASTUnarySizeofExpression copy = new UPCASTUnarySizeofExpression();
copy.setUPCSizeofOperator(upcSizeofOperator);
IASTExpression operand = getOperand();
copy.setOperand(operand == null ? null : operand.copy());
copy.setOperand(operand == null ? null : operand.copy(style));
copy.setOffsetAndLength(this);
if(style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
}
public int getUPCSizeofOperator() {
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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -25,10 +25,18 @@ public class XlcCASTVectorTypeSpecifier extends CASTSimpleDeclSpecifier implemen
@Override
public XlcCASTVectorTypeSpecifier copy() {
return copy(CopyStyle.withoutLocations);
}
@Override
public XlcCASTVectorTypeSpecifier copy(CopyStyle style) {
XlcCASTVectorTypeSpecifier copy = new XlcCASTVectorTypeSpecifier();
copySimpleDeclSpec(copy);
copySimpleDeclSpec(copy, style);
copy.isPixel = isPixel;
copy.isBool = isBool;
if(style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -24,9 +24,17 @@ public class XlcCPPASTVectorTypeSpecifier extends CPPASTSimpleDeclSpecifier impl
@Override
public XlcCPPASTVectorTypeSpecifier copy() {
return copy(CopyStyle.withoutLocations);
}
@Override
public XlcCPPASTVectorTypeSpecifier copy(CopyStyle style) {
XlcCPPASTVectorTypeSpecifier copy = new XlcCPPASTVectorTypeSpecifier();
copySimpleDeclSpec(copy);
copySimpleDeclSpec(copy, style);
copy.isPixel = isPixel;
if(style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
}