1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 06:32:10 +02:00

bug 258345, implementation of IASTNode.copy()

This commit is contained in:
Mike Kucera 2008-12-17 15:41:35 +00:00
parent de24d81d29
commit a036483c18
333 changed files with 4860 additions and 2192 deletions

View file

@ -0,0 +1,118 @@
package org.eclipse.cdt.core.parser.tests;
import java.beans.BeanInfo;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import junit.framework.Assert;
import junit.framework.AssertionFailedError;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
public class ASTComparer extends Assert {
private static Set<String> methodsToIgnore = new HashSet<String>(Arrays.asList(
// prevent infinite recursion
"getParent",
"getTranslationUnit",
"getLastName",
// original is usually frozen but copy must not be
"isFrozen",
// these methods are problematic
"getChildren",
"getProblem",
"getContainingFilename",
// ignore preprocessor nodes
"getMacroDefinitions",
"getBuiltinMacroDefinitions",
"getIncludeDirectives",
"getAllPreprocessorStatements",
"getMacroExpansions",
"getPreprocessorProblems",
"getComments"
));
public static void assertCopy(IASTNode node1, IASTNode node2) {
try {
assertCopy(node1, node2, 0);
} catch(Exception e) {
throw new RuntimeException(e);
}
}
private static void assertCopy(IASTNode node1, IASTNode node2, int n) throws Exception {
if(node1 == null && node2 == null)
return;
assertNotNull(node1);
assertNotNull(node2);
assertFalse(node1 == node2); // must be distinct copy
Class klass1 = node1.getClass();
Class klass2 = node2.getClass();
assertTrue(klass1.equals(klass2)); // nodes must be the same concrete type
//System.out.println(spaces(n) + klass1.getSimpleName());
BeanInfo beanInfo = Introspector.getBeanInfo(klass1);
for(PropertyDescriptor property : beanInfo.getPropertyDescriptors()) {
Method getter = property.getReadMethod();
if(getter == null)
continue;
if(methodsToIgnore.contains(getter.getName()))
continue;
try {
Class returnType = getter.getReturnType();
if(IASTNode.class.isAssignableFrom(returnType)) {
//System.out.println(spaces(n) + "Testing1: " + getter.getName());
IASTNode result1 = (IASTNode) getter.invoke(node1);
IASTNode result2 = (IASTNode) getter.invoke(node2);
assertCopy(result1, result2, n+1); // members must be same
}
else if(returnType.isArray() && IASTNode.class.isAssignableFrom(returnType.getComponentType())) {
//System.out.println(spaces(n) + "Testing2: " + getter.getName());
IASTNode[] result1 = (IASTNode[]) getter.invoke(node1);
IASTNode[] result2 = (IASTNode[]) getter.invoke(node2);
if(result1 == null && result2 == null)
continue;
assertNotNull(result1);
assertNotNull(result2);
assertEquals(result1.length, result2.length);
for(int i = 0; i < result1.length; i++)
assertCopy(result1[i], result2[i], n+1);
}
else if((returnType.isPrimitive() || returnType.equals(String.class)) && !returnType.equals(Void.class)) {
//System.out.println(spaces(n) + "Testing3: " + getter.getName());
Object result1 = getter.invoke(node1);
Object result2 = getter.invoke(node2);
assertEquals(result1, result2);
}
} catch(AssertionFailedError e) {
System.out.printf("Failure when calling %s.%s() @(%d,%d)\n",
node1.getClass().getSimpleName(),
getter.getName(),
((ASTNode)node1).getOffset(),
((ASTNode)node1).getLength());
throw e;
}
}
}
// private static String spaces(int n) {
// char[] spaces = new char[n*2];
// Arrays.fill(spaces, ' ');
// return new String(spaces);
// }
}

View file

@ -36,6 +36,7 @@ import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement;
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTStatement;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
@ -70,6 +71,7 @@ import org.eclipse.cdt.core.parser.NullLogService;
import org.eclipse.cdt.core.parser.ParserLanguage;
import org.eclipse.cdt.core.parser.ParserMode;
import org.eclipse.cdt.core.parser.ScannerInfo;
import org.eclipse.cdt.core.parser.tests.ASTComparer;
import org.eclipse.cdt.core.parser.tests.scanner.FileCodeReaderFactory;
import org.eclipse.cdt.core.testplugin.CTestPlugin;
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
@ -141,6 +143,8 @@ public class AST2BaseTest extends BaseTestCase {
parser.setSkipTrivialExpressionsInAggregateInitializers(true);
IASTTranslationUnit tu = parser.parse();
assertTrue(tu.isFrozen());
validateCopy(tu);
if (parser.encounteredError() && expectNoProblems)
throw new ParserException("FAILURE"); //$NON-NLS-1$
@ -260,6 +264,14 @@ public class AST2BaseTest extends BaseTestCase {
return s.getExpression();
}
protected <T extends IASTNode> T validateCopy(T tu) {
IASTNode copy = tu.copy();
assertFalse(copy.isFrozen());
ASTComparer.assertCopy(tu, copy);
return (T) copy;
}
static protected class CNameCollector extends CASTVisitor {
{
shouldVisitNames = true;

View file

@ -115,6 +115,8 @@ import org.eclipse.cdt.internal.core.parser.ParserException;
*/
public class AST2Tests extends AST2BaseTest {
private static final int NUM_TESTS = 3;
public static TestSuite suite() {
return suite(AST2Tests.class);
}
@ -127,6 +129,8 @@ public class AST2Tests extends AST2BaseTest {
super(name);
}
protected IASTTranslationUnit parseAndCheckBindings( String code ) throws Exception {
return parseAndCheckBindings(code, ParserLanguage.C);
}
@ -181,6 +185,8 @@ public class AST2Tests extends AST2BaseTest {
// }
public void testBasicFunction() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
IScope globalScope = tu.getScope();
IASTDeclaration[] declarations = tu.getDeclarations();
@ -311,6 +317,9 @@ public class AST2Tests extends AST2BaseTest {
// assertNull(((ICScope) body_f.getScope()).getBinding(
// ICScope.NAMESPACE_TYPE_OTHER, new String("y").toCharArray()));
// //$NON-NLS-1$
tu = validateCopy(tu);
}
}
// typedef struct {
@ -323,6 +332,8 @@ public class AST2Tests extends AST2BaseTest {
// }
public void testSimpleStruct() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
IASTSimpleDeclaration decl = (IASTSimpleDeclaration) tu
.getDeclarations()[0];
IASTCompositeTypeSpecifier type = (IASTCompositeTypeSpecifier) decl
@ -434,6 +445,9 @@ public class AST2Tests extends AST2BaseTest {
decls = tu.getDeclarationsInAST(fieldref.getFieldName().resolveBinding());
assertEquals(decls.length, 1);
assertEquals(decls[0], name_x);
tu = validateCopy(tu);
}
}
public void testCExpressions() throws ParserException {
@ -507,6 +521,8 @@ public class AST2Tests extends AST2BaseTest {
public void testMultipleDeclarators() throws Exception {
IASTTranslationUnit tu = parse("int r, s;", ParserLanguage.C); //$NON-NLS-1$
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
IASTSimpleDeclaration decl = (IASTSimpleDeclaration) tu
.getDeclarations()[0];
IASTDeclarator[] declarators = decl.getDeclarators();
@ -529,6 +545,9 @@ public class AST2Tests extends AST2BaseTest {
decls = tu.getDeclarationsInAST(name2.resolveBinding());
assertEquals(decls.length, 1);
assertEquals(decls[0], name2);
tu = validateCopy(tu);
}
}
@ -542,6 +561,8 @@ public class AST2Tests extends AST2BaseTest {
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
// struct A;
IASTSimpleDeclaration decl1 = (IASTSimpleDeclaration) tu
.getDeclarations()[0];
@ -614,6 +635,9 @@ public class AST2Tests extends AST2BaseTest {
decls = tu.getDeclarationsInAST(namea.resolveBinding());
assertEquals(decls.length, 1);
assertEquals(decls[0], namea);
tu = validateCopy(tu);
}
}
public void testStructureTagScoping_2() throws Exception {
@ -625,6 +649,8 @@ public class AST2Tests extends AST2BaseTest {
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
// struct A;
IASTSimpleDeclaration decl1 = (IASTSimpleDeclaration) tu
.getDeclarations()[0];
@ -679,6 +705,9 @@ public class AST2Tests extends AST2BaseTest {
decls = tu.getDeclarationsInAST(namea.resolveBinding());
assertEquals(decls.length, 1);
assertEquals(decls[0], namea);
tu = validateCopy(tu);
}
}
public void testStructureDef() throws Exception {
@ -692,6 +721,8 @@ public class AST2Tests extends AST2BaseTest {
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
// struct A;
IASTSimpleDeclaration decl1 = (IASTSimpleDeclaration) tu
.getDeclarations()[0];
@ -793,6 +824,9 @@ public class AST2Tests extends AST2BaseTest {
decls = tu.getDeclarationsInAST(name_iref.resolveBinding());
assertEquals(decls.length, 1);
assertEquals(decls[0], name_i);
tu = validateCopy(tu);
}
}
// struct x {};
@ -802,6 +836,8 @@ public class AST2Tests extends AST2BaseTest {
public void testStructureNamespace() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
IASTSimpleDeclaration declaration1 = (IASTSimpleDeclaration) tu
.getDeclarations()[0];
IASTCompositeTypeSpecifier typeSpec = (IASTCompositeTypeSpecifier) declaration1
@ -884,6 +920,9 @@ public class AST2Tests extends AST2BaseTest {
// assertNull(((ICScope) compound.getScope()).getBinding(
// ICScope.NAMESPACE_TYPE_OTHER, new String("i").toCharArray()));
// //$NON-NLS-1$
tu = validateCopy(tu);
}
}
// void f( int a );
@ -893,6 +932,8 @@ public class AST2Tests extends AST2BaseTest {
public void testFunctionParameters() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
// void f(
IASTSimpleDeclaration f_decl = (IASTSimpleDeclaration) tu
.getDeclarations()[0];
@ -969,12 +1010,16 @@ public class AST2Tests extends AST2BaseTest {
assertEquals(decls.length, 2);
assertEquals(decls[0], name_param1);
assertEquals(decls[1], name_param2);
tu = validateCopy(tu);
}
}
// void f( int a, int b ) { }
public void testSimpleFunction() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
IASTFunctionDefinition fDef = (IASTFunctionDefinition) tu
.getDeclarations()[0];
assertTrue(fDef.getDeclarator() instanceof IASTStandardFunctionDeclarator);
@ -1013,6 +1058,9 @@ public class AST2Tests extends AST2BaseTest {
decls = tu.getDeclarationsInAST(name_b.resolveBinding());
assertEquals(decls.length, 1);
assertEquals(decls[0], name_b);
tu = validateCopy(tu);
}
}
// void f();
@ -1023,6 +1071,8 @@ public class AST2Tests extends AST2BaseTest {
public void testSimpleFunctionCall() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
// void f();
IASTSimpleDeclaration fdecl = (IASTSimpleDeclaration) tu
.getDeclarations()[0];
@ -1081,6 +1131,9 @@ public class AST2Tests extends AST2BaseTest {
assertEquals(decls.length, 2);
assertEquals(decls[0], name_f);
assertEquals(decls[1], name_fdef);
tu = validateCopy(tu);
}
}
// void f() {
@ -1090,7 +1143,8 @@ public class AST2Tests extends AST2BaseTest {
// }
public void testForLoop() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
// void f() {
IASTFunctionDefinition fdef = (IASTFunctionDefinition) tu
.getDeclarations()[0];
@ -1156,6 +1210,9 @@ public class AST2Tests extends AST2BaseTest {
decls = tu.getDeclarationsInAST(name_i4.resolveBinding());
assertEquals(decls.length, 1);
assertEquals(decls[0], name_i);
tu = validateCopy(tu);
}
}
// struct A { int x; };
@ -1164,7 +1221,8 @@ public class AST2Tests extends AST2BaseTest {
// }
public void testExpressionFieldReference() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
IASTSimpleDeclaration simpleDecl = (IASTSimpleDeclaration) tu
.getDeclarations()[0];
IASTCompositeTypeSpecifier compType = (IASTCompositeTypeSpecifier) simpleDecl
@ -1214,6 +1272,9 @@ public class AST2Tests extends AST2BaseTest {
decls = tu.getDeclarationsInAST(name_x2.resolveBinding());
assertEquals(decls.length, 1);
assertEquals(decls[0], name_x1);
tu = validateCopy(tu);
}
}
// void f() {
@ -1225,7 +1286,8 @@ public class AST2Tests extends AST2BaseTest {
// }
public void testLabels() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
CNameCollector collector = new CNameCollector();
tu.accept(collector);
@ -1250,13 +1312,17 @@ public class AST2Tests extends AST2BaseTest {
decls = tu.getDeclarationsInAST(collector.getName(2).resolveBinding());
assertEquals(decls.length, 1);
assertEquals(decls[0], collector.getName(2));
tu = validateCopy(tu);
}
}
// typedef struct { } X;
// int f( X x );
public void testAnonStruct() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
// test tu.getDeclarationsInAST(IBinding)
IASTSimpleDeclaration decl1 = (IASTSimpleDeclaration) tu
.getDeclarations()[0];
@ -1286,6 +1352,10 @@ public class AST2Tests extends AST2BaseTest {
decls = tu.getDeclarationsInAST(name_x.resolveBinding());
assertEquals(decls.length, 1);
assertEquals(decls[0], name_x);
tu = validateCopy(tu);
}
}
public void testLongLong() throws ParserException {
@ -1311,7 +1381,8 @@ public class AST2Tests extends AST2BaseTest {
// }
public void testEnumerations() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
IASTSimpleDeclaration decl1 = (IASTSimpleDeclaration) tu
.getDeclarations()[0];
assertEquals(decl1.getDeclarators().length, 0);
@ -1451,10 +1522,15 @@ public class AST2Tests extends AST2BaseTest {
decls = tu.getDeclarationsInAST(r_red.resolveBinding());
assertEquals(decls.length, 1);
assertEquals(decls[0], e1.getName());
tu = validateCopy(tu);
}
}
public void testPointerToFunction() throws Exception {
IASTTranslationUnit tu = parse("int (*pfi)();", ParserLanguage.C); //$NON-NLS-1$
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
assertEquals(tu.getDeclarations().length, 1);
IASTSimpleDeclaration d = (IASTSimpleDeclaration) tu.getDeclarations()[0];
assertEquals(d.getDeclarators().length, 1);
@ -1471,6 +1547,9 @@ public class AST2Tests extends AST2BaseTest {
.resolveBinding());
assertEquals(decls.length, 1);
assertEquals(decls[0], f.getNestedDeclarator().getName());
tu = validateCopy(tu);
}
}
// int a;
@ -1481,7 +1560,8 @@ public class AST2Tests extends AST2BaseTest {
// const char * const * const volatile ** const * f;
public void testBasicTypes() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
IASTSimpleDeclaration decl = (IASTSimpleDeclaration) tu
.getDeclarations()[0];
IVariable a = (IVariable) decl.getDeclarators()[0].getName()
@ -1572,6 +1652,9 @@ public class AST2Tests extends AST2BaseTest {
IType t_f_7 = ((IQualifierType) t_f_6).getType();
assertTrue(t_f_7 instanceof IBasicType);
assertEquals(((IBasicType) t_f_7).getType(), IBasicType.t_char);
tu = validateCopy(tu);
}
}
// struct A {} a1;
@ -1580,7 +1663,8 @@ public class AST2Tests extends AST2BaseTest {
// AP a3;
public void testCompositeTypes() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
IASTSimpleDeclaration decl = (IASTSimpleDeclaration) tu
.getDeclarations()[0];
IASTCompositeTypeSpecifier compSpec = (IASTCompositeTypeSpecifier) decl
@ -1655,6 +1739,9 @@ public class AST2Tests extends AST2BaseTest {
decls = tu.getDeclarationsInAST(name_a3.resolveBinding());
assertEquals(decls.length, 1);
assertEquals(decls[0], name_a3);
tu = validateCopy(tu);
}
}
// int a[restrict];
@ -1663,7 +1750,8 @@ public class AST2Tests extends AST2BaseTest {
// char* d[const][];
public void testArrayTypes() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
IASTSimpleDeclaration decl = (IASTSimpleDeclaration) tu.getDeclarations()[0];
IASTName name_a = decl.getDeclarators()[0].getName();
IVariable a = (IVariable) decl.getDeclarators()[0].getName().resolveBinding();
@ -1732,6 +1820,9 @@ public class AST2Tests extends AST2BaseTest {
decls = tu.getDeclarationsInAST(name_c.resolveBinding());
assertEquals(decls.length, 1);
assertEquals(decls[0], name_c);
tu = validateCopy(tu);
}
}
// struct A;
@ -1740,7 +1831,8 @@ public class AST2Tests extends AST2BaseTest {
// void (* (*h)(struct A**) ) ( int d );
public void testFunctionTypes() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
IASTSimpleDeclaration decl = (IASTSimpleDeclaration) tu
.getDeclarations()[0];
IASTElaboratedTypeSpecifier elabSpec = (IASTElaboratedTypeSpecifier) decl
@ -1865,6 +1957,9 @@ public class AST2Tests extends AST2BaseTest {
assertEquals(decls[0], name_A1);
assertNull("Expected null, got "+name_d.resolveBinding(), name_d.resolveBinding());
tu = validateCopy(tu);
}
}
// typedef struct {
@ -1882,6 +1977,8 @@ public class AST2Tests extends AST2BaseTest {
// }
public void testDesignatedInitializers() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
assertNotNull(tu);
IASTDeclaration[] declarations = tu.getDeclarations();
IASTName name_Coord = ((IASTSimpleDeclaration) declarations[0])
@ -1938,8 +2035,8 @@ public class AST2Tests extends AST2BaseTest {
.getOperandInitializer()).getExpression()).getOperand())
.getName();
for (int i = 0; i < 2; ++i) {
ICASTDesignatedInitializer designatedInitializer = (ICASTDesignatedInitializer) initializers1[i];
for (int j = 0; j < 2; ++j) {
ICASTDesignatedInitializer designatedInitializer = (ICASTDesignatedInitializer) initializers1[j];
assertEquals(designatedInitializer.getDesignators().length, 1);
ICASTFieldDesignator fieldDesignator = (ICASTFieldDesignator) designatedInitializer
.getDesignators()[0];
@ -1982,6 +2079,9 @@ public class AST2Tests extends AST2BaseTest {
decls = tu.getDeclarationsInAST(name_xy2.resolveBinding());
assertEquals(decls.length, 1);
assertEquals(decls[0], name_xy);
tu = validateCopy(tu);
}
}
// struct S {
@ -1993,7 +2093,8 @@ public class AST2Tests extends AST2BaseTest {
// }
public void testMoregetDeclarationsInAST1() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
IASTSimpleDeclaration S_decl = (IASTSimpleDeclaration) tu
.getDeclarations()[0];
IASTFunctionDefinition f_def = (IASTFunctionDefinition) tu
@ -2024,6 +2125,9 @@ public class AST2Tests extends AST2BaseTest {
decls = tu.getDeclarationsInAST(b1.resolveBinding());
assertEquals(decls.length, 1);
assertEquals(b1, decls[0]);
tu = validateCopy(tu);
}
}
// struct S {
@ -2032,7 +2136,8 @@ public class AST2Tests extends AST2BaseTest {
// } s = {.a=1,.b=2};
public void testMoregetDeclarationsInAST2() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
IASTSimpleDeclaration S_decl = (IASTSimpleDeclaration) tu
.getDeclarations()[0];
@ -2059,6 +2164,9 @@ public class AST2Tests extends AST2BaseTest {
decls = tu.getDeclarationsInAST(b1.resolveBinding());
assertEquals(decls.length, 1);
assertEquals(b1, decls[0]);
tu = validateCopy(tu);
}
}
// typedef struct S {
@ -2070,7 +2178,8 @@ public class AST2Tests extends AST2BaseTest {
// y x = {.a=1,.b=2};
public void testMoregetDeclarationsInAST3() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
IASTSimpleDeclaration S_decl = (IASTSimpleDeclaration) tu
.getDeclarations()[0];
IASTSimpleDeclaration x_decl = (IASTSimpleDeclaration) tu
@ -2099,12 +2208,16 @@ public class AST2Tests extends AST2BaseTest {
decls = tu.getDeclarationsInAST(b1.resolveBinding());
assertEquals(decls.length, 1);
assertEquals(b1, decls[0]);
tu = validateCopy(tu);
}
}
public void testFnReturningPtrToFn() throws Exception {
IASTTranslationUnit tu = parse(
"void ( * f( int ) )(){}", ParserLanguage.C); //$NON-NLS-1$
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
IASTFunctionDefinition def = (IASTFunctionDefinition) tu.getDeclarations()[0];
final IASTName fname = def.getDeclarator().getName();
IFunction f = (IFunction) fname.resolveBinding();
@ -2118,6 +2231,9 @@ public class AST2Tests extends AST2BaseTest {
IASTName[] decls = tu.getDeclarationsInAST(f);
assertEquals(decls.length, 1);
assertEquals(decls[0], fname);
tu = validateCopy(tu);
}
}
// test C99: 6.7.5.3-7 A declaration of a parameter as ''array of type''
@ -2128,7 +2244,8 @@ public class AST2Tests extends AST2BaseTest {
public void testArrayTypeToQualifiedPointerTypeParm() throws Exception {
IASTTranslationUnit tu = parse(
"void f(int parm[const 3]);", ParserLanguage.C); //$NON-NLS-1$
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
IASTSimpleDeclaration def = (IASTSimpleDeclaration) tu
.getDeclarations()[0];
IFunction f = (IFunction) def.getDeclarators()[0].getName()
@ -2145,6 +2262,9 @@ public class AST2Tests extends AST2BaseTest {
IASTName[] decls = tu.getDeclarationsInAST(name_parm.resolveBinding());
assertEquals(decls.length, 1);
assertEquals(decls[0], name_parm);
tu = validateCopy(tu);
}
}
// int f() {}
@ -2153,6 +2273,8 @@ public class AST2Tests extends AST2BaseTest {
public void testFunctionDefTypes() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
IASTFunctionDefinition def1 = (IASTFunctionDefinition) tu
.getDeclarations()[0];
IFunction f = (IFunction) def1.getDeclarator().getName()
@ -2192,6 +2314,9 @@ public class AST2Tests extends AST2BaseTest {
decls = tu.getDeclarationsInAST(def3.getDeclarator().getName().resolveBinding());
assertEquals(decls.length, 1);
assertEquals(decls[0], def3.getDeclarator().getName());
tu = validateCopy(tu);
}
}
// any parameter to type function returning T is adjusted to be pointer to
@ -2199,7 +2324,8 @@ public class AST2Tests extends AST2BaseTest {
public void testParmToFunction() throws Exception {
IASTTranslationUnit tu = parse(
"int f(int g(void)) { return g();}", ParserLanguage.C); //$NON-NLS-1$
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
IASTFunctionDefinition def = (IASTFunctionDefinition) tu
.getDeclarations()[0];
IFunction f = (IFunction) def.getDeclarator().getName()
@ -2228,12 +2354,17 @@ public class AST2Tests extends AST2BaseTest {
IASTName[] decls = tu.getDeclarationsInAST(name_g_call.resolveBinding());
assertEquals(decls.length, 1);
assertEquals(decls[0], name_g);
tu = validateCopy(tu);
}
}
public void testArrayPointerFunction() throws Exception {
IASTTranslationUnit tu = parse(
"int (*v[])(int *x, int *y);", ParserLanguage.C); //$NON-NLS-1$
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
IASTSimpleDeclaration decl = (IASTSimpleDeclaration) tu
.getDeclarations()[0];
IVariable v = (IVariable) ((IASTStandardFunctionDeclarator) decl
@ -2269,6 +2400,9 @@ public class AST2Tests extends AST2BaseTest {
assertEquals(decls.length, 1);
assertEquals(decls[0], ((IASTStandardFunctionDeclarator) decl
.getDeclarators()[0]).getNestedDeclarator().getName());
tu = validateCopy(tu);
}
}
// typedef void DWORD;
@ -2277,6 +2411,8 @@ public class AST2Tests extends AST2BaseTest {
public void testTypedefExample4a() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
IASTSimpleDeclaration decl1 = (IASTSimpleDeclaration) tu
.getDeclarations()[0];
ITypedef dword = (ITypedef) decl1.getDeclarators()[0].getName()
@ -2325,6 +2461,9 @@ public class AST2Tests extends AST2BaseTest {
.getDeclSpecifier()).getName().resolveBinding());
assertEquals(decls.length, 1);
assertEquals(decls[0], name_v);
tu = validateCopy(tu);
}
}
// typedef void DWORD;
@ -2332,7 +2471,8 @@ public class AST2Tests extends AST2BaseTest {
// pfv signal(int, pfv);
public void testTypedefExample4b() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
IASTSimpleDeclaration decl1 = (IASTSimpleDeclaration) tu
.getDeclarations()[0];
ITypedef dword = (ITypedef) decl1.getDeclarators()[0].getName()
@ -2413,6 +2553,9 @@ public class AST2Tests extends AST2BaseTest {
decls = tu.getDeclarationsInAST(name_pfv2.resolveBinding());
assertEquals(decls.length, 1);
assertEquals(decls[0], name_pfv);
tu = validateCopy(tu);
}
}
// typedef void fv(int), (*pfv)(int);
@ -2422,6 +2565,8 @@ public class AST2Tests extends AST2BaseTest {
public void testTypedefExample4c() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
IASTSimpleDeclaration decl = (IASTSimpleDeclaration) tu
.getDeclarations()[0];
ITypedef fv = (ITypedef) decl.getDeclarators()[0].getName()
@ -2503,6 +2648,9 @@ public class AST2Tests extends AST2BaseTest {
.getParameterTypes()[1]).getType()).getType())
.getParameterTypes()[0]).getType(), IBasicType.t_int);
tu = validateCopy(tu);
}
}
// const int x = 10;
@ -2559,6 +2707,8 @@ public class AST2Tests extends AST2BaseTest {
// }
public void testExternalDefs() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
CNameCollector col = new CNameCollector();
tu.accept(col);
@ -2571,6 +2721,9 @@ public class AST2Tests extends AST2BaseTest {
assertEquals(col.size(), 11);
assertInstances(col, a, 7);
assertInstances(col, g, 3);
tu = validateCopy(tu);
}
}
// typedef struct { int x; int y; } Coord;
@ -2579,6 +2732,8 @@ public class AST2Tests extends AST2BaseTest {
// }
public void testFieldDesignators() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
CNameCollector col = new CNameCollector();
tu.accept(col);
@ -2590,6 +2745,9 @@ public class AST2Tests extends AST2BaseTest {
assertInstances(col, x, 2);
assertInstances(col, y, 2);
assertInstances(col, Coord, 2);
tu = validateCopy(tu);
}
}
// enum { member_one, member_two };
@ -2599,6 +2757,8 @@ public class AST2Tests extends AST2BaseTest {
// };
public void testArrayDesignator() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
CNameCollector col = new CNameCollector();
tu.accept(col);
@ -2608,6 +2768,9 @@ public class AST2Tests extends AST2BaseTest {
assertInstances(col, one, 2);
assertInstances(col, two, 2);
tu = validateCopy(tu);
}
}
// void f() {
@ -2620,6 +2783,8 @@ public class AST2Tests extends AST2BaseTest {
// }
public void testBug83737() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
IASTIfStatement if_statement = (IASTIfStatement) ((IASTCompoundStatement) ((IASTFunctionDefinition) tu
.getDeclarations()[0]).getBody()).getStatements()[0];
assertEquals(((IASTBinaryExpression) if_statement
@ -2635,6 +2800,9 @@ public class AST2Tests extends AST2BaseTest {
assertEquals(((IASTBinaryExpression) third_if_statement
.getConditionExpression()).getOperator(),
IASTBinaryExpression.op_greaterThan);
tu = validateCopy(tu);
}
}
// void f() {
@ -2645,6 +2813,8 @@ public class AST2Tests extends AST2BaseTest {
// }
public void testBug84090_LabelReferences() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
CNameCollector col = new CNameCollector();
tu.accept(col);
@ -2654,12 +2824,17 @@ public class AST2Tests extends AST2BaseTest {
IASTName[] refs = tu.getReferences(end);
assertEquals(refs.length, 1);
assertSame(refs[0].resolveBinding(), end);
tu = validateCopy(tu);
}
}
// enum col { red, blue };
// enum col c;
public void testBug84092_EnumReferences() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
CNameCollector collector = new CNameCollector();
tu.accept(collector);
@ -2669,11 +2844,16 @@ public class AST2Tests extends AST2BaseTest {
IASTName[] refs = tu.getReferences(col);
assertEquals(refs.length, 1);
assertSame(refs[0].resolveBinding(), col);
tu = validateCopy(tu);
}
}
public void testBug84096_FieldDesignatorRef() throws Exception {
IASTTranslationUnit tu = parse(
"struct s { int a; } ss = { .a = 1 }; \n", ParserLanguage.C); //$NON-NLS-1$
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
CNameCollector collector = new CNameCollector();
tu.accept(collector);
@ -2683,6 +2863,9 @@ public class AST2Tests extends AST2BaseTest {
IASTName[] refs = tu.getReferences(a);
assertEquals(refs.length, 1);
assertSame(refs[0].resolveBinding(), a);
tu = validateCopy(tu);
}
}
public void testProblems() throws Exception {
@ -2698,6 +2881,8 @@ public class AST2Tests extends AST2BaseTest {
// enum e{ one };
public void testEnumerationForwards() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
CNameCollector col = new CNameCollector();
tu.accept(col);
@ -2708,6 +2893,9 @@ public class AST2Tests extends AST2BaseTest {
assertFalse(etors[0] instanceof IProblemBinding);
assertInstances(col, e, 2);
tu = validateCopy(tu);
}
}
// void f() {
@ -3633,6 +3821,8 @@ public class AST2Tests extends AST2BaseTest {
// };
public void test186736() throws Exception {
IASTTranslationUnit tu= parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
CNameCollector col = new CNameCollector();
tu.accept(col);
IBinding methodb= col.getName(27).resolveBinding();
@ -3643,6 +3833,9 @@ public class AST2Tests extends AST2BaseTest {
assertInstance(methodc, ICPPMethod.class);
assertEquals("A", ((ICPPMethod)methodb).getClassOwner().getName());
assertEquals("A", ((ICPPMethod)methodc).getClassOwner().getName());
tu = validateCopy(tu);
}
}
// template <typename T, typename U>
@ -3680,6 +3873,8 @@ public class AST2Tests extends AST2BaseTest {
// };
public void test186736_variant1() throws Exception {
IASTTranslationUnit tu= parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
CNameCollector col = new CNameCollector();
tu.accept(col);
IBinding methodA= col.getName(30).resolveBinding();
@ -3690,6 +3885,9 @@ public class AST2Tests extends AST2BaseTest {
assertInstance(methodAA, ICPPMethod.class);
assertEquals("A", ((ICPPMethod)methodA).getClassOwner().getName());
assertEquals("AA", ((ICPPMethod)methodAA).getClassOwner().getName());
tu = validateCopy(tu);
}
}
// class B {
@ -3713,6 +3911,7 @@ public class AST2Tests extends AST2BaseTest {
// }
public void test186736_variant2() throws Exception {
IASTTranslationUnit tu= parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP);
validateCopy(tu);
}
// typedef int int32;
@ -3840,12 +4039,17 @@ public class AST2Tests extends AST2BaseTest {
// class NameClash2 {};
public void testBug202271_nameClash() throws Exception {
IASTTranslationUnit tu= parseAndCheckBindings( getAboveComment(), ParserLanguage.CPP, true );
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
CNameCollector col = new CNameCollector();
tu.accept(col);
assertInstance(col.getName(0).resolveBinding(), ICPPClassType.class);
assertInstance(col.getName(1).resolveBinding(), ICPPNamespace.class);
assertInstance(col.getName(2).resolveBinding(), ICPPNamespace.class);
assertInstance(col.getName(3).resolveBinding(), ICPPClassType.class);
tu = validateCopy(tu);
}
}
// #define WRAP(var) var
@ -4023,6 +4227,8 @@ public class AST2Tests extends AST2BaseTest {
// };
public void testBug210019_designatedInitializers() throws Exception {
IASTTranslationUnit tu = parseAndCheckBindings(getAboveComment(), ParserLanguage.C);
assertTrue(tu.isFrozen());
for(int i = 0; i < NUM_TESTS; i++) {
CNameCollector col = new CNameCollector();
tu.accept(col);
@ -4045,6 +4251,9 @@ public class AST2Tests extends AST2BaseTest {
assertField(col.getName(33).resolveBinding(), "x", "S2");
assertField(col.getName(34).resolveBinding(), "x", "S2");
tu = validateCopy(tu);
}
}
// extern "C" {

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.parser.tests.rewrite.comenthandler;
import junit.framework.TestCase;
import org.eclipse.cdt.core.dom.ast.IASTComment;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName;
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
@ -141,5 +142,8 @@ public class NodeCommentMapTest extends TestCase {
}
//not used
public boolean isBlockComment() {return false;}
public IASTNode copy() {
return null;
}
}
}

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.dom.ast;
* ASM Statement as a Declaration.
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTASMDeclaration extends IASTDeclaration {
@ -29,4 +30,10 @@ public interface IASTASMDeclaration extends IASTDeclaration {
* @param assembly
*/
public void setAssembly(String assembly);
/**
* @since 5.1
*/
public IASTASMDeclaration copy();
}

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.dom.ast;
* This is the declarator for an array.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTArrayDeclarator extends IASTDeclarator {
@ -39,4 +40,9 @@ public interface IASTArrayDeclarator extends IASTDeclarator {
*/
public void addArrayModifier(IASTArrayModifier arrayModifier);
/**
* @since 5.1
*/
public IASTArrayDeclarator copy();
}

View file

@ -15,6 +15,7 @@ package org.eclipse.cdt.core.dom.ast;
* declares a variable/type which is an array.
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTArrayModifier extends IASTNode {
@ -45,4 +46,8 @@ public interface IASTArrayModifier extends IASTNode {
*/
public void setConstantExpression(IASTExpression expression);
/**
* @since 5.1
*/
public IASTArrayModifier copy();
}

View file

@ -15,6 +15,7 @@ package org.eclipse.cdt.core.dom.ast;
* y.z()[ t * t ]
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTArraySubscriptExpression extends IASTExpression {
@ -63,4 +64,8 @@ public interface IASTArraySubscriptExpression extends IASTExpression {
*/
public void setSubscriptExpression(IASTExpression expression);
/**
* @since 5.1
*/
public IASTArraySubscriptExpression copy();
}

View file

@ -15,6 +15,7 @@ package org.eclipse.cdt.core.dom.ast;
* This interface represents a binary expression.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTBinaryExpression extends IASTExpression {
@ -258,4 +259,9 @@ public interface IASTBinaryExpression extends IASTExpression {
* <code>IASTExpression</code> value
*/
public void setOperand2(IASTExpression expression);
/**
* @since 5.1
*/
public IASTBinaryExpression copy();
}

View file

@ -14,7 +14,12 @@ package org.eclipse.cdt.core.dom.ast;
* This is the break clause in a loop.
*
* @author Doug Schaefer
* @noimplement
*/
public interface IASTBreakStatement extends IASTStatement {
/**
* @since 5.1
*/
public IASTBreakStatement copy();
}

View file

@ -17,6 +17,7 @@ package org.eclipse.cdt.core.dom.ast;
* following this clause.
*
* @author Doug Schaefer
* @noimplement
*/
public interface IASTCaseStatement extends IASTStatement {
@ -40,4 +41,8 @@ public interface IASTCaseStatement extends IASTStatement {
*/
public void setExpression(IASTExpression expression);
/**
* @since 5.1
*/
public IASTCaseStatement copy();
}

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.dom.ast;
* This interface represents a cast expression of the form (TypeId)operand.
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTCastExpression extends IASTExpression {
@ -83,4 +84,8 @@ public interface IASTCastExpression extends IASTExpression {
*/
public IASTTypeId getTypeId();
/**
* @since 5.1
*/
public IASTCastExpression copy();
}

View file

@ -15,6 +15,7 @@ package org.eclipse.cdt.core.dom.ast;
* declarations).
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTCompositeTypeSpecifier extends IASTDeclSpecifier , IASTNameOwner {
@ -96,4 +97,9 @@ public interface IASTCompositeTypeSpecifier extends IASTDeclSpecifier , IASTName
*
*/
public IScope getScope();
/**
* @since 5.1
*/
public IASTCompositeTypeSpecifier copy();
}

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.dom.ast;
* This represents a block of statements.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTCompoundStatement extends IASTStatement {
@ -47,4 +48,9 @@ public interface IASTCompoundStatement extends IASTStatement {
* @return the <code>IScope</code>
*/
public IScope getScope();
/**
* @since 5.1
*/
public IASTCompoundStatement copy();
}

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.dom.ast;
* Conditional Expression of the format X ? Y : Z
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTConditionalExpression extends IASTExpression {
@ -87,4 +88,9 @@ public interface IASTConditionalExpression extends IASTExpression {
*/
public void setNegativeResultExpression(IASTExpression expression);
/**
* @since 5.1
*/
public IASTConditionalExpression copy();
}

View file

@ -14,7 +14,12 @@ package org.eclipse.cdt.core.dom.ast;
* This is the continue clause in a loop.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTContinueStatement extends IASTStatement {
/**
* @since 5.1
*/
public IASTContinueStatement copy();
}

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.dom.ast;
* This is the base interface that represents a declaration specifier sequence.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTDeclSpecifier extends IASTNode {
@ -125,4 +126,9 @@ public interface IASTDeclSpecifier extends IASTNode {
*/
public String getRawSignature();
/**
* @since 5.1
*/
public IASTDeclSpecifier copy();
}

View file

@ -14,8 +14,13 @@ package org.eclipse.cdt.core.dom.ast;
* This is the root class of all declarations.
*
* @author Doug Schaefer
* @noimplement
*/
public interface IASTDeclaration extends IASTNode {
public static final IASTDeclaration[] EMPTY_DECLARATION_ARRAY = new IASTDeclaration[0];
/**
* @since 5.1
*/
public IASTDeclaration copy();
}

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.dom.ast;
* A declaration statement that introduces a declaration.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTDeclarationStatement extends IASTStatement {
@ -38,4 +39,9 @@ public interface IASTDeclarationStatement extends IASTStatement {
*/
public void setDeclaration(IASTDeclaration declaration);
/**
* @since 5.1
*/
public IASTDeclarationStatement copy();
}

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.dom.ast;
* Base interface for a declarator.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTDeclarator extends IASTNode, IASTNameOwner {
@ -107,4 +108,9 @@ public interface IASTDeclarator extends IASTNode, IASTNameOwner {
*/
public void setInitializer(IASTInitializer initializer);
/**
* @since 5.1
*/
public IASTDeclarator copy();
}

View file

@ -17,7 +17,12 @@ package org.eclipse.cdt.core.dom.ast;
* one statement following this clause.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTDefaultStatement extends IASTStatement {
/**
* @since 5.1
*/
public IASTDefaultStatement copy();
}

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.dom.ast;
* Ye ol' do statement.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTDoStatement extends IASTStatement {
@ -62,4 +63,9 @@ public interface IASTDoStatement extends IASTStatement {
*/
public void setCondition(IASTExpression condition);
/**
* @since 5.1
*/
public IASTDoStatement copy();
}

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.dom.ast;
* This represents an elaborated type specifier in the C & C++ language grammar.
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTElaboratedTypeSpecifier extends IASTDeclSpecifier, IASTNameOwner {
@ -74,4 +75,8 @@ public interface IASTElaboratedTypeSpecifier extends IASTDeclSpecifier, IASTName
*/
public void setName(IASTName name);
/**
* @since 5.1
*/
public IASTElaboratedTypeSpecifier copy();
}

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.dom.ast;
* This interface represents enumerations in C and C++.
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTEnumerationSpecifier extends IASTDeclSpecifier, IASTNameOwner {
@ -21,6 +22,7 @@ public interface IASTEnumerationSpecifier extends IASTDeclSpecifier, IASTNameOwn
* This interface represents an enumerator member of an enum specifier.
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTEnumerator extends IASTNode, IASTNameOwner {
/**
@ -70,6 +72,11 @@ public interface IASTEnumerationSpecifier extends IASTDeclSpecifier, IASTNameOwn
*/
public IASTExpression getValue();
/**
* @since 5.1
*/
public IASTEnumerator copy();
}
/**
@ -114,4 +121,8 @@ public interface IASTEnumerationSpecifier extends IASTDeclSpecifier, IASTNameOwn
*/
public IASTName getName();
/**
* @since 5.1
*/
public IASTEnumerationSpecifier copy();
}

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.dom.ast;
* This is the root class of expressions.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTExpression extends IASTNode {
/**
@ -23,4 +24,8 @@ public interface IASTExpression extends IASTNode {
public IType getExpressionType();
/**
* @since 5.1
*/
public IASTExpression copy();
}

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.dom.ast;
* Expression List (Comma separated list of expressions).
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTExpressionList extends IASTExpression {
@ -39,4 +40,9 @@ public interface IASTExpressionList extends IASTExpression {
* <code>IASTExpression</code> value to be added.
*/
public void addExpression(IASTExpression expression);
/**
* @since 5.1
*/
public IASTExpressionList copy();
}

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.dom.ast;
* Expression statement.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTExpressionStatement extends IASTStatement {
@ -37,4 +38,9 @@ public interface IASTExpressionStatement extends IASTStatement {
* @param expression
*/
public void setExpression(IASTExpression expression);
/**
* @since 5.1
*/
public IASTExpressionStatement copy();
}

View file

@ -15,6 +15,7 @@ package org.eclipse.cdt.core.dom.ast;
* size for a bit field.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTFieldDeclarator extends IASTDeclarator {
@ -41,4 +42,8 @@ public interface IASTFieldDeclarator extends IASTDeclarator {
*/
public void setBitFieldSize(IASTExpression size);
/**
* @since 5.1
*/
public IASTFieldDeclarator copy();
}

View file

@ -16,6 +16,7 @@ package org.eclipse.cdt.core.dom.ast;
* expression, def is the field name.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTFieldReference extends IASTExpression, IASTNameOwner {
@ -79,4 +80,9 @@ public interface IASTFieldReference extends IASTExpression, IASTNameOwner {
*/
public void setIsPointerDereference(boolean value);
/**
* @since 5.1
*/
public IASTFieldReference copy();
}

View file

@ -15,6 +15,7 @@ package org.eclipse.cdt.core.dom.ast;
* declaration but not both.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTForStatement extends IASTStatement {
@ -111,4 +112,9 @@ public interface IASTForStatement extends IASTStatement {
* @return <code>IScope</code>
*/
public IScope getScope();
/**
* @since 5.1
*/
public IASTForStatement copy();
}

View file

@ -15,6 +15,7 @@ package org.eclipse.cdt.core.dom.ast;
* function name expression, x is the parameter expression.
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTFunctionCallExpression extends IASTExpression {
@ -64,4 +65,9 @@ public interface IASTFunctionCallExpression extends IASTExpression {
*/
public IASTExpression getParameterExpression();
/**
* @since 5.1
*/
public IASTFunctionCallExpression copy();
}

View file

@ -14,7 +14,12 @@ package org.eclipse.cdt.core.dom.ast;
* This is a declarator for a function.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTFunctionDeclarator extends IASTDeclarator {
/**
* @since 5.1
*/
public IASTFunctionDeclarator copy();
}

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.dom.ast;
* This is a function definition, i.e. it has a body.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTFunctionDefinition extends IASTDeclaration {
@ -98,4 +99,9 @@ public interface IASTFunctionDefinition extends IASTDeclaration {
* @return <code>IScope</code> representing function body.
*/
public IScope getScope();
/**
* @since 5.1
*/
public IASTFunctionDefinition copy();
}

View file

@ -15,6 +15,7 @@ package org.eclipse.cdt.core.dom.ast;
* is not an IASTName, as there are not any bindings for
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTFunctionStyleMacroParameter extends IASTNode {

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.dom.ast;
* Represents a goto statement.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTGotoStatement extends IASTStatement, IASTNameOwner {
@ -34,4 +35,9 @@ public interface IASTGotoStatement extends IASTStatement, IASTNameOwner {
*/
public void setName(IASTName name);
/**
* @since 5.1
*/
public IASTGotoStatement copy();
}

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.dom.ast;
* This is a name used in an expression.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTIdExpression extends IASTExpression, IASTNameOwner {
@ -37,4 +38,9 @@ public interface IASTIdExpression extends IASTExpression, IASTNameOwner {
* @param name
*/
public void setName(IASTName name);
/**
* @since 5.1
*/
public IASTIdExpression copy();
}

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.dom.ast;
* The if statement including the optional else clause.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTIfStatement extends IASTStatement {
@ -84,4 +85,8 @@ public interface IASTIfStatement extends IASTStatement {
*/
public void setElseClause(IASTStatement elseClause);
/**
* @since 5.1
*/
public IASTIfStatement copy();
}

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.dom.ast;
* This represents an initializer for a declarator.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTInitializer extends IASTNode {
@ -22,4 +23,8 @@ public interface IASTInitializer extends IASTNode {
*/
public final static IASTInitializer[] EMPTY_INITIALIZER_ARRAY = new IASTInitializer[0];
/**
* @since 5.1
*/
public IASTInitializer copy();
}

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.dom.ast;
* This is an initializer that is simply an expression.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTInitializerExpression extends IASTInitializer {
@ -38,4 +39,9 @@ public interface IASTInitializerExpression extends IASTInitializer {
* <code>IASTExpression</code>
*/
public void setExpression(IASTExpression expression);
/**
* @since 5.1
*/
public IASTInitializerExpression copy();
}

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.dom.ast;
* This is an an initializer that is a list of initializers.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTInitializerList extends IASTInitializer {
@ -38,4 +39,9 @@ public interface IASTInitializerList extends IASTInitializer {
* <code>IASTInitializer</code>
*/
public void addInitializer(IASTInitializer initializer);
/**
* @since 5.1
*/
public IASTInitializerList copy();
}

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.dom.ast;
* Represents a label statement.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTLabelStatement extends IASTStatement, IASTNameOwner {
@ -42,4 +43,9 @@ public interface IASTLabelStatement extends IASTStatement, IASTNameOwner {
*/
public void setNestedStatement( IASTStatement s );
/**
* @since 5.1
*/
public IASTLabelStatement copy();
}

View file

@ -96,4 +96,9 @@ public interface IASTLiteralExpression extends IASTExpression {
*/
public void setValue(String value);
/**
* @since 5.1
*/
public IASTLiteralExpression copy();
}

View file

@ -95,4 +95,9 @@ public interface IASTName extends IASTNode, IName {
* @since 5.1
*/
public IASTName getLastName();
/**
* @since 5.1
*/
public IASTName copy();
}

View file

@ -15,6 +15,7 @@ package org.eclipse.cdt.core.dom.ast;
* class/struct/union names in C.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTNamedTypeSpecifier extends IASTDeclSpecifier, IASTNameOwner {
@ -39,4 +40,8 @@ public interface IASTNamedTypeSpecifier extends IASTDeclSpecifier, IASTNameOwner
*/
public void setName(IASTName name);
/**
* @since 5.1
*/
public IASTNamedTypeSpecifier copy();
}

View file

@ -193,4 +193,23 @@ public interface IASTNode {
* @since 5.1
*/
public boolean isFrozen();
/**
* Returns a copy of the tree rooted at this node.
* The following postconditions hold:
*
* <code>
* copy.getParent() == null
* copy.getPropertyInParent() == null
* copy.isFrozen() == false
* </code>
*
* Preprocessor nodes do not currently support being copied.
*
* @since 5.1
* @throws UnsupportedOperationException if this node or one of its descendants
* does not support copying
*/
public IASTNode copy();
}

View file

@ -14,7 +14,12 @@ package org.eclipse.cdt.core.dom.ast;
* This node represents a null statement. ';'
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTNullStatement extends IASTStatement {
/**
* @since 5.1
*/
public IASTNullStatement copy();
}

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.dom.ast;
* This class represents a parameter declaration
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTParameterDeclaration extends IASTNode {
/**
@ -67,4 +68,8 @@ public interface IASTParameterDeclaration extends IASTNode {
*/
public void setDeclarator(IASTDeclarator declarator);
/**
* @since 5.1
*/
public IASTParameterDeclaration copy();
}

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.dom.ast;
* This represents the good ol' * pointer operator.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTPointer extends IASTPointerOperator {
@ -48,4 +49,10 @@ public interface IASTPointer extends IASTPointerOperator {
*/
public void setVolatile(boolean value);
/**
* @since 5.1
*/
public IASTPointer copy();
}

View file

@ -12,6 +12,7 @@ package org.eclipse.cdt.core.dom.ast;
/**
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTPointerOperator extends IASTNode {
@ -20,4 +21,8 @@ public interface IASTPointerOperator extends IASTNode {
*/
public static final IASTPointerOperator[] EMPTY_ARRAY = new IASTPointerOperator[0];
/**
* @since 5.1
*/
public IASTPointerOperator copy();
}

View file

@ -15,6 +15,12 @@ import org.eclipse.cdt.core.parser.IProblem;
/**
* Interface for problems in the ast tree.
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTProblem extends IProblem, IASTNode {
/**
* @since 5.1
*/
public IASTProblem copy();
}

View file

@ -15,8 +15,12 @@ package org.eclipse.cdt.core.dom.ast;
* declaration.
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTProblemDeclaration extends IASTDeclaration,
IASTProblemHolder {
public interface IASTProblemDeclaration extends IASTDeclaration, IASTProblemHolder {
/**
* @since 5.1
*/
public IASTProblemDeclaration copy();
}

View file

@ -15,8 +15,12 @@ package org.eclipse.cdt.core.dom.ast;
* expression.
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTProblemExpression extends IASTExpression,
IASTProblemHolder {
public interface IASTProblemExpression extends IASTExpression, IASTProblemHolder {
/**
* @since 5.1
*/
public IASTProblemExpression copy();
}

View file

@ -15,6 +15,7 @@ package org.eclipse.cdt.core.dom.ast;
* holder.
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTProblemHolder {
/**
@ -37,4 +38,5 @@ public interface IASTProblemHolder {
* <code>IASTProblem</code>
*/
public void setProblem(IASTProblem p);
}

View file

@ -15,7 +15,12 @@ package org.eclipse.cdt.core.dom.ast;
* statement.
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTProblemStatement extends IASTStatement, IASTProblemHolder {
/**
* @since 5.1
*/
public IASTProblemStatement copy();
}

View file

@ -15,7 +15,12 @@ package org.eclipse.cdt.core.dom.ast;
* type-id.
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTProblemTypeId extends IASTTypeId, IASTProblemHolder {
/**
* @since 5.1
*/
public IASTProblemTypeId copy();
}

View file

@ -12,6 +12,7 @@ package org.eclipse.cdt.core.dom.ast;
/**
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTReturnStatement extends IASTStatement {
@ -38,4 +39,8 @@ public interface IASTReturnStatement extends IASTStatement {
*/
public void setReturnValue(IASTExpression returnValue);
/**
* @since 5.1
*/
public IASTReturnStatement copy();
}

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.dom.ast;
* This represents a decl specifier for a built-in type.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTSimpleDeclSpecifier extends IASTDeclSpecifier {
@ -130,4 +131,9 @@ public interface IASTSimpleDeclSpecifier extends IASTDeclSpecifier {
*/
public void setShort(boolean value);
/**
* @since 5.1
*/
public IASTSimpleDeclSpecifier copy();
}

View file

@ -15,6 +15,7 @@ package org.eclipse.cdt.core.dom.ast;
* followed by a list of declarators.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTSimpleDeclaration extends IASTDeclaration {
@ -65,4 +66,8 @@ public interface IASTSimpleDeclaration extends IASTDeclaration {
*/
public void addDeclarator(IASTDeclarator declarator);
/**
* @since 5.1
*/
public IASTSimpleDeclaration copy();
}

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.dom.ast;
* This is a declarator for a non K&R C function.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTStandardFunctionDeclarator extends IASTFunctionDeclarator {
@ -54,4 +55,9 @@ public interface IASTStandardFunctionDeclarator extends IASTFunctionDeclarator {
* boolean
*/
public void setVarArgs(boolean value);
/**
* @since 5.1
*/
public IASTStandardFunctionDeclarator copy();
}

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.dom.ast;
* This is the root interface for statements.
*
* @author Doug Schaefer
* @noimplement
*/
public interface IASTStatement extends IASTNode {
/**
@ -21,4 +22,9 @@ public interface IASTStatement extends IASTNode {
*/
public static final IASTStatement[] EMPTY_STATEMENT_ARRAY = new IASTStatement[0];
/**
* @since 5.1
*/
public IASTStatement copy();
}

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.dom.ast;
* The switch statement.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTSwitchStatement extends IASTStatement {
@ -64,4 +65,8 @@ public interface IASTSwitchStatement extends IASTStatement {
*/
public void setBody(IASTStatement body);
/**
* @since 5.1
*/
public IASTSwitchStatement copy();
}

View file

@ -292,4 +292,16 @@ public interface IASTTranslationUnit extends IASTNode, IAdaptable {
* @since 5.1
*/
public void freeze();
/**
* Returns a copy of the AST, however the ILocationResolver
* and the preprocessor nodes are not copied.
*
* @see IASTNode#copy()
*
* @noreference This method is not intended to be referenced by clients.
* @since 5.1
*/
public IASTTranslationUnit copy();
}

View file

@ -12,6 +12,7 @@ package org.eclipse.cdt.core.dom.ast;
/**
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTTypeId extends IASTNode {
@ -58,4 +59,9 @@ public interface IASTTypeId extends IASTNode {
* @param abstractDeclarator <code>IASTDeclarator</code>
*/
public void setAbstractDeclarator(IASTDeclarator abstractDeclarator);
/**
* @since 5.1
*/
public IASTTypeId copy();
}

View file

@ -13,6 +13,7 @@ package org.eclipse.cdt.core.dom.ast;
/**
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTTypeIdExpression extends IASTExpression {
@ -75,4 +76,8 @@ public interface IASTTypeIdExpression extends IASTExpression {
*/
public IASTTypeId getTypeId();
/**
* @since 5.1
*/
public IASTTypeIdExpression copy();
}

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.dom.ast;
* This interface is used to represent a unary expression in the AST.
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTUnaryExpression extends IASTExpression {
@ -152,4 +153,8 @@ public interface IASTUnaryExpression extends IASTExpression {
*/
public void setOperand(IASTExpression expression);
/**
* @since 5.1
*/
public IASTUnaryExpression copy();
}

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.dom.ast;
* Ye ol' while statement.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IASTWhileStatement extends IASTStatement {
@ -58,4 +59,8 @@ public interface IASTWhileStatement extends IASTStatement {
*/
public void setBody(IASTStatement body);
/**
* @since 5.1
*/
public IASTWhileStatement copy();
}

View file

@ -18,6 +18,7 @@ import org.eclipse.cdt.core.dom.ast.IASTExpression;
* instance = { def[0] = 9 };
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICASTArrayDesignator extends ICASTDesignator {
@ -43,4 +44,8 @@ public interface ICASTArrayDesignator extends ICASTDesignator {
*/
public void setSubscriptExpression(IASTExpression value);
/**
* @since 5.1
*/
public ICASTArrayDesignator copy();
}

View file

@ -17,6 +17,7 @@ import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
* modifiers (const, restrict, etc.) as well as variable sized arrays.
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICASTArrayModifier extends IASTArrayModifier {
@ -94,4 +95,9 @@ public interface ICASTArrayModifier extends IASTArrayModifier {
* boolean
*/
public void setVariableSized(boolean value);
/**
* @since 5.1
*/
public ICASTArrayModifier copy();
}

View file

@ -16,8 +16,13 @@ import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
* Structs and Unions in C can be qualified w/restrict keyword.
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICASTCompositeTypeSpecifier extends
IASTCompositeTypeSpecifier, ICASTDeclSpecifier {
/**
* @since 5.1
*/
public ICASTCompositeTypeSpecifier copy();
}

View file

@ -16,6 +16,7 @@ import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
* C extension to IASTDeclSpecifier. (restrict keyword)
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICASTDeclSpecifier extends IASTDeclSpecifier {
@ -33,4 +34,9 @@ public interface ICASTDeclSpecifier extends IASTDeclSpecifier {
*/
public void setRestrict(boolean value);
/**
* @since 5.1
*/
public ICASTDeclSpecifier copy();
}

View file

@ -18,7 +18,7 @@ import org.eclipse.cdt.core.dom.ast.IASTInitializer;
* .t[1] = 3 };
*
* @author jcamelon
*
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICASTDesignatedInitializer extends IASTInitializer {
@ -72,4 +72,9 @@ public interface ICASTDesignatedInitializer extends IASTInitializer {
* <code>IASTInitializer</code>
*/
public void setOperandInitializer(IASTInitializer rhs);
/**
* @since 5.1
*/
public ICASTDesignatedInitializer copy();
}

View file

@ -16,7 +16,12 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
* Base interface for all C-style designators.
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICASTDesignator extends IASTNode {
/**
* @since 5.1
*/
public ICASTDesignator copy();
}

View file

@ -17,8 +17,13 @@ import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier;
* for the addition of the restrict keyword.
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICASTElaboratedTypeSpecifier extends
IASTElaboratedTypeSpecifier, ICASTDeclSpecifier {
/**
* @since 5.1
*/
public ICASTElaboratedTypeSpecifier copy();
}

View file

@ -16,8 +16,13 @@ import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier;
* C Enumeration decl specifier. Allows for "restrict enum X { a, b, c };
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICASTEnumerationSpecifier extends ICASTDeclSpecifier,
IASTEnumerationSpecifier {
/**
* @since 5.1
*/
public ICASTEnumerationSpecifier copy();
}

View file

@ -17,6 +17,7 @@ import org.eclipse.cdt.core.dom.ast.IASTName;
* Specific Designator that represents a field reference.
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICASTFieldDesignator extends ICASTDesignator {
@ -41,4 +42,9 @@ public interface ICASTFieldDesignator extends ICASTDesignator {
* <code>IASTName</code>
*/
public void setName(IASTName name);
/**
* @since 5.1
*/
public ICASTFieldDesignator copy();
}

View file

@ -16,6 +16,7 @@ import org.eclipse.cdt.core.dom.ast.IASTPointer;
* C-specific pointer. (includes restrict modifier).
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICASTPointer extends IASTPointer {
@ -33,4 +34,9 @@ public interface ICASTPointer extends IASTPointer {
*/
void setRestrict(boolean value);
/**
* @since 5.1
*/
public ICASTPointer copy();
}

View file

@ -16,6 +16,7 @@ import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
* This interface represents a built-in type in C.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICASTSimpleDeclSpecifier extends IASTSimpleDeclSpecifier,
ICASTDeclSpecifier {
@ -71,4 +72,9 @@ public interface ICASTSimpleDeclSpecifier extends IASTSimpleDeclSpecifier,
*/
public void setLongLong(boolean value);
/**
* @since 5.1
*/
public ICASTSimpleDeclSpecifier copy();
}

View file

@ -19,6 +19,8 @@ import org.eclipse.cdt.core.dom.ast.IASTTypeId;
* C Expression of the format type-id { initializer }
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*
*/
public interface ICASTTypeIdInitializerExpression extends IASTExpression {
@ -67,4 +69,9 @@ public interface ICASTTypeIdInitializerExpression extends IASTExpression {
*/
public void setInitializer(IASTInitializer initializer);
/**
* @since 5.1
*/
public ICASTTypeIdInitializerExpression copy();
}

View file

@ -17,8 +17,12 @@ import org.eclipse.cdt.core.dom.ast.IASTNamedTypeSpecifier;
* includes the abiliy to use the restrict modifier.
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICASTTypedefNameSpecifier extends IASTNamedTypeSpecifier,
ICASTDeclSpecifier {
public interface ICASTTypedefNameSpecifier extends IASTNamedTypeSpecifier, ICASTDeclSpecifier {
/**
* @since 5.1
*/
public ICASTTypedefNameSpecifier copy();
}

View file

@ -16,6 +16,7 @@ import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
* C++ adds a few more binary expressions over C.
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICPPASTBinaryExpression extends IASTBinaryExpression {
@ -35,4 +36,9 @@ public interface ICPPASTBinaryExpression extends IASTBinaryExpression {
*/
@Deprecated
public static final int op_last = IASTBinaryExpression.op_last;
/**
* @since 5.1
*/
public ICPPASTBinaryExpression copy();
}

View file

@ -16,6 +16,7 @@ import org.eclipse.cdt.core.dom.ast.IASTCastExpression;
* C++ adds in additional cast-style expressions.
*
* @author jcamelon
* @noimplement
*/
public interface ICPPASTCastExpression extends IASTCastExpression {
@ -43,4 +44,10 @@ public interface ICPPASTCastExpression extends IASTCastExpression {
* <code>op_last</code> is for subinterfaces to extend.
*/
public static final int op_last = op_const_cast;
/**
* @since 5.1
*/
public ICPPASTCastExpression copy();
}

View file

@ -20,7 +20,7 @@ import org.eclipse.cdt.core.dom.ast.IScope;
* @see ICPPASTFunctionWithTryBlock
* @see ICPPASTTryBlockStatement
*
* @noimplement This interface is not intended to be implemented by clients.
* @noimplement
*/
public interface ICPPASTCatchHandler extends IASTStatement {
@ -73,4 +73,9 @@ public interface ICPPASTCatchHandler extends IASTStatement {
* @since 5.1
*/
public IScope getScope();
/**
* @since 5.1
*/
public ICPPASTCatchHandler copy();
}

View file

@ -51,6 +51,7 @@ public interface ICPPASTCompositeTypeSpecifier extends
* Base Specifiers are where a class expresses from whom it inherits.
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public static interface ICPPASTBaseSpecifier extends IASTNode, IASTNameOwner {
/**
@ -125,6 +126,11 @@ public interface ICPPASTCompositeTypeSpecifier extends
* <code>IASTName</code>
*/
public void setName(IASTName name);
/**
* @since 5.1
*/
public ICPPASTBaseSpecifier copy();
}
/**
@ -146,4 +152,9 @@ public interface ICPPASTCompositeTypeSpecifier extends
* @since 5.1
*/
public ICPPClassScope getScope();
/**
* @since 5.1
*/
public ICPPASTCompositeTypeSpecifier copy();
}

View file

@ -23,6 +23,8 @@ import org.eclipse.cdt.core.dom.ast.IASTNameOwner;
* X();
* };
* X::X : a(0) {} // a(0) is a constructor chain initializer.
*
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICPPASTConstructorChainInitializer extends IASTInitializer, IASTNameOwner {
/**
@ -73,4 +75,8 @@ public interface ICPPASTConstructorChainInitializer extends IASTInitializer, IAS
*/
public void setInitializerValue(IASTExpression expression);
/**
* @since 5.1
*/
public ICPPASTConstructorChainInitializer copy();
}

View file

@ -18,6 +18,7 @@ import org.eclipse.cdt.core.dom.ast.IASTInitializer;
* This is an initializer that is a call to the constructor for the declarator.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICPPASTConstructorInitializer extends IASTInitializer {
@ -42,4 +43,8 @@ public interface ICPPASTConstructorInitializer extends IASTInitializer {
*/
public void setExpression(IASTExpression expression);
/**
* @since 5.1
*/
public ICPPASTConstructorInitializer copy();
}

View file

@ -18,6 +18,7 @@ import org.eclipse.cdt.core.dom.ast.IASTTypeId;
* This interface represents a C++ conversion member function.
*
* @author dsteffle
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICPPASTConversionName extends IASTName {
public static final ASTNodeProperty TYPE_ID=new ASTNodeProperty(
@ -37,4 +38,9 @@ public interface ICPPASTConversionName extends IASTName {
* @param typeId
*/
public void setTypeId(IASTTypeId typeId);
/**
* @since 5.1
*/
public ICPPASTConversionName copy();
}

View file

@ -16,6 +16,7 @@ import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
* C++ adds additional modifiers and types for decl specifier sequence.
*
* @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICPPASTDeclSpecifier extends IASTDeclSpecifier {
@ -76,4 +77,9 @@ public interface ICPPASTDeclSpecifier extends IASTDeclSpecifier {
*/
public void setExplicit(boolean value);
/**
* @since 5.1
*/
public ICPPASTDeclSpecifier copy();
}

View file

@ -17,6 +17,7 @@ import org.eclipse.cdt.core.dom.ast.IASTExpression;
* This interface represents a delete expression. delete [] operand;
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICPPASTDeleteExpression extends IASTExpression {
@ -69,4 +70,10 @@ public interface ICPPASTDeleteExpression extends IASTExpression {
*/
public boolean isVectored();
/**
* @since 5.1
*/
public ICPPASTDeleteExpression copy();
}

View file

@ -16,6 +16,7 @@ import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier;
* Elaborated types in C++ include classes.
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICPPASTElaboratedTypeSpecifier extends
IASTElaboratedTypeSpecifier, ICPPASTDeclSpecifier {
@ -30,4 +31,9 @@ public interface ICPPASTElaboratedTypeSpecifier extends
*/
public static final int k_last = k_class;
/**
* @since 5.1
*/
public ICPPASTElaboratedTypeSpecifier copy();
}

View file

@ -17,6 +17,8 @@ import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
* This interface represents an explict template instantiation.
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*
*/
public interface ICPPASTExplicitTemplateInstantiation extends IASTDeclaration {
@ -42,4 +44,8 @@ public interface ICPPASTExplicitTemplateInstantiation extends IASTDeclaration {
*/
public void setDeclaration(IASTDeclaration declaration);
/**
* @since 5.1
*/
public ICPPASTExplicitTemplateInstantiation copy();
}

View file

@ -17,6 +17,7 @@ import org.eclipse.cdt.core.dom.ast.IASTFieldReference;
* specify the parse.
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICPPASTFieldReference extends IASTFieldReference {
@ -33,4 +34,9 @@ public interface ICPPASTFieldReference extends IASTFieldReference {
*/
public void setIsTemplate(boolean value);
/**
* @since 5.1
*/
public ICPPASTFieldReference copy();
}

View file

@ -14,10 +14,19 @@ import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTForStatement;
/**
*
*
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICPPASTForStatement extends IASTForStatement {
public static final ASTNodeProperty CONDITION_DECLARATION = new ASTNodeProperty( "org.eclipse.cdt.core.dom.ast.cpp.ICPPASTForStatement"); //$NON-NLS-1$
public void setConditionDeclaration( IASTDeclaration d );
public IASTDeclaration getConditionDeclaration();
/**
* @since 5.1
*/
public ICPPASTForStatement copy();
}

View file

@ -103,4 +103,9 @@ public interface ICPPASTFunctionDeclarator extends IASTStandardFunctionDeclarato
@Deprecated
public void addConstructorToChain(ICPPASTConstructorChainInitializer initializer);
/**
* @since 5.1
*/
public ICPPASTFunctionDeclarator copy();
}

View file

@ -37,4 +37,9 @@ public interface ICPPASTFunctionDefinition extends IASTFunctionDefinition {
* Adds a member initializer to this function definition.
*/
public void addMemberInitializer(ICPPASTConstructorChainInitializer initializer);
/**
* @since 5.1
*/
public ICPPASTFunctionDefinition copy();
}

View file

@ -15,6 +15,7 @@ import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
/**
* @deprecated, use {@link ICPPASTFunctionWithTryBlock}, instead.
* @noimplement This interface is not intended to be implemented by clients.
*/
@Deprecated
public interface ICPPASTFunctionTryBlockDeclarator extends
@ -41,4 +42,9 @@ public interface ICPPASTFunctionTryBlockDeclarator extends
* @return <code>ICPPASTCatchHandler</code>
*/
public ICPPASTCatchHandler[] getCatchHandlers();
/**
* @since 5.1
*/
public ICPPASTFunctionTryBlockDeclarator copy();
}

View file

@ -40,4 +40,9 @@ public interface ICPPASTFunctionWithTryBlock extends ICPPASTFunctionDefinition {
*/
public ICPPASTCatchHandler[] getCatchHandlers();
/**
* @since 5.1
*/
public ICPPASTFunctionWithTryBlock copy();
}

View file

@ -14,6 +14,11 @@ import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTIfStatement;
import org.eclipse.cdt.core.dom.ast.IScope;
/**
*
* @noimplement This interface is not intended to be implemented by clients.
*
*/
public interface ICPPASTIfStatement extends IASTIfStatement {
public IASTDeclaration getConditionDeclaration();
@ -25,4 +30,9 @@ public interface ICPPASTIfStatement extends IASTIfStatement {
* @return <code>IScope</code>
*/
public IScope getScope();
/**
* @since 5.1
*/
public ICPPASTIfStatement copy();
}

View file

@ -17,6 +17,7 @@ import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
* This interface represents a linkage specification. e.g. extern "C" { ... }
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICPPASTLinkageSpecification extends IASTDeclaration {
@ -56,4 +57,9 @@ public interface ICPPASTLinkageSpecification extends IASTDeclaration {
* <code>IASTDeclaration</code>
*/
public void addDeclaration(IASTDeclaration declaration);
/**
* @since 5.1
*/
public ICPPASTLinkageSpecification copy();
}

View file

@ -38,4 +38,10 @@ public interface ICPPASTLiteralExpression extends IASTLiteralExpression {
* <code>lk_last</code> is maintained for future subinterfaces.
*/
public static final int lk_last = lk_false;
/**
* @since 5.1
*/
public ICPPASTLiteralExpression copy();
}

View file

@ -17,6 +17,7 @@ import org.eclipse.cdt.core.dom.ast.IASTNamedTypeSpecifier;
* typename.
*
* @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICPPASTNamedTypeSpecifier extends IASTNamedTypeSpecifier,
ICPPASTDeclSpecifier {
@ -36,4 +37,9 @@ public interface ICPPASTNamedTypeSpecifier extends IASTNamedTypeSpecifier,
*/
public void setIsTypename(boolean value);
/**
* @since 5.1
*/
public ICPPASTNamedTypeSpecifier copy();
}

Some files were not shown because too many files have changed in this diff Show more