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

View file

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

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.parser.tests.rewrite.comenthandler;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.eclipse.cdt.core.dom.ast.IASTComment; 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.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName;
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap; import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
@ -141,5 +142,8 @@ public class NodeCommentMapTest extends TestCase {
} }
//not used //not used
public boolean isBlockComment() {return false;} 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. * ASM Statement as a Declaration.
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTASMDeclaration extends IASTDeclaration { public interface IASTASMDeclaration extends IASTDeclaration {
@ -29,4 +30,10 @@ public interface IASTASMDeclaration extends IASTDeclaration {
* @param assembly * @param assembly
*/ */
public void setAssembly(String 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. * This is the declarator for an array.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTArrayDeclarator extends IASTDeclarator { public interface IASTArrayDeclarator extends IASTDeclarator {
@ -39,4 +40,9 @@ public interface IASTArrayDeclarator extends IASTDeclarator {
*/ */
public void addArrayModifier(IASTArrayModifier arrayModifier); 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. * declares a variable/type which is an array.
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTArrayModifier extends IASTNode { public interface IASTArrayModifier extends IASTNode {
@ -45,4 +46,8 @@ public interface IASTArrayModifier extends IASTNode {
*/ */
public void setConstantExpression(IASTExpression expression); 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 ] * y.z()[ t * t ]
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTArraySubscriptExpression extends IASTExpression { public interface IASTArraySubscriptExpression extends IASTExpression {
@ -63,4 +64,8 @@ public interface IASTArraySubscriptExpression extends IASTExpression {
*/ */
public void setSubscriptExpression(IASTExpression expression); 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. * This interface represents a binary expression.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTBinaryExpression extends IASTExpression { public interface IASTBinaryExpression extends IASTExpression {
@ -258,4 +259,9 @@ public interface IASTBinaryExpression extends IASTExpression {
* <code>IASTExpression</code> value * <code>IASTExpression</code> value
*/ */
public void setOperand2(IASTExpression expression); 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. * This is the break clause in a loop.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement
*/ */
public interface IASTBreakStatement extends IASTStatement { 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. * following this clause.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement
*/ */
public interface IASTCaseStatement extends IASTStatement { public interface IASTCaseStatement extends IASTStatement {
@ -40,4 +41,8 @@ public interface IASTCaseStatement extends IASTStatement {
*/ */
public void setExpression(IASTExpression expression); 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. * This interface represents a cast expression of the form (TypeId)operand.
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTCastExpression extends IASTExpression { public interface IASTCastExpression extends IASTExpression {
@ -83,4 +84,8 @@ public interface IASTCastExpression extends IASTExpression {
*/ */
public IASTTypeId getTypeId(); public IASTTypeId getTypeId();
/**
* @since 5.1
*/
public IASTCastExpression copy();
} }

View file

@ -15,6 +15,7 @@ package org.eclipse.cdt.core.dom.ast;
* declarations). * declarations).
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTCompositeTypeSpecifier extends IASTDeclSpecifier , IASTNameOwner { public interface IASTCompositeTypeSpecifier extends IASTDeclSpecifier , IASTNameOwner {
@ -96,4 +97,9 @@ public interface IASTCompositeTypeSpecifier extends IASTDeclSpecifier , IASTName
* *
*/ */
public IScope getScope(); 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. * This represents a block of statements.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTCompoundStatement extends IASTStatement { public interface IASTCompoundStatement extends IASTStatement {
@ -47,4 +48,9 @@ public interface IASTCompoundStatement extends IASTStatement {
* @return the <code>IScope</code> * @return the <code>IScope</code>
*/ */
public IScope getScope(); 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 * Conditional Expression of the format X ? Y : Z
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTConditionalExpression extends IASTExpression { public interface IASTConditionalExpression extends IASTExpression {
@ -87,4 +88,9 @@ public interface IASTConditionalExpression extends IASTExpression {
*/ */
public void setNegativeResultExpression(IASTExpression expression); 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. * This is the continue clause in a loop.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTContinueStatement extends IASTStatement { 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. * This is the base interface that represents a declaration specifier sequence.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTDeclSpecifier extends IASTNode { public interface IASTDeclSpecifier extends IASTNode {
@ -125,4 +126,9 @@ public interface IASTDeclSpecifier extends IASTNode {
*/ */
public String getRawSignature(); 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. * This is the root class of all declarations.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement
*/ */
public interface IASTDeclaration extends IASTNode { public interface IASTDeclaration extends IASTNode {
public static final IASTDeclaration[] EMPTY_DECLARATION_ARRAY = new IASTDeclaration[0]; 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. * A declaration statement that introduces a declaration.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTDeclarationStatement extends IASTStatement { public interface IASTDeclarationStatement extends IASTStatement {
@ -38,4 +39,9 @@ public interface IASTDeclarationStatement extends IASTStatement {
*/ */
public void setDeclaration(IASTDeclaration declaration); 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. * Base interface for a declarator.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTDeclarator extends IASTNode, IASTNameOwner { public interface IASTDeclarator extends IASTNode, IASTNameOwner {
@ -107,4 +108,9 @@ public interface IASTDeclarator extends IASTNode, IASTNameOwner {
*/ */
public void setInitializer(IASTInitializer initializer); 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. * one statement following this clause.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTDefaultStatement extends IASTStatement { 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. * Ye ol' do statement.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTDoStatement extends IASTStatement { public interface IASTDoStatement extends IASTStatement {
@ -62,4 +63,9 @@ public interface IASTDoStatement extends IASTStatement {
*/ */
public void setCondition(IASTExpression condition); 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. * This represents an elaborated type specifier in the C & C++ language grammar.
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTElaboratedTypeSpecifier extends IASTDeclSpecifier, IASTNameOwner { public interface IASTElaboratedTypeSpecifier extends IASTDeclSpecifier, IASTNameOwner {
@ -74,4 +75,8 @@ public interface IASTElaboratedTypeSpecifier extends IASTDeclSpecifier, IASTName
*/ */
public void setName(IASTName name); 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++. * This interface represents enumerations in C and C++.
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTEnumerationSpecifier extends IASTDeclSpecifier, IASTNameOwner { 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. * This interface represents an enumerator member of an enum specifier.
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTEnumerator extends IASTNode, IASTNameOwner { public interface IASTEnumerator extends IASTNode, IASTNameOwner {
/** /**
@ -70,6 +72,11 @@ public interface IASTEnumerationSpecifier extends IASTDeclSpecifier, IASTNameOwn
*/ */
public IASTExpression getValue(); public IASTExpression getValue();
/**
* @since 5.1
*/
public IASTEnumerator copy();
} }
/** /**
@ -114,4 +121,8 @@ public interface IASTEnumerationSpecifier extends IASTDeclSpecifier, IASTNameOwn
*/ */
public IASTName getName(); 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. * This is the root class of expressions.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTExpression extends IASTNode { public interface IASTExpression extends IASTNode {
/** /**
@ -23,4 +24,8 @@ public interface IASTExpression extends IASTNode {
public IType getExpressionType(); 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). * Expression List (Comma separated list of expressions).
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTExpressionList extends IASTExpression { public interface IASTExpressionList extends IASTExpression {
@ -39,4 +40,9 @@ public interface IASTExpressionList extends IASTExpression {
* <code>IASTExpression</code> value to be added. * <code>IASTExpression</code> value to be added.
*/ */
public void addExpression(IASTExpression expression); 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. * Expression statement.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTExpressionStatement extends IASTStatement { public interface IASTExpressionStatement extends IASTStatement {
@ -37,4 +38,9 @@ public interface IASTExpressionStatement extends IASTStatement {
* @param expression * @param expression
*/ */
public void setExpression(IASTExpression 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. * size for a bit field.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTFieldDeclarator extends IASTDeclarator { public interface IASTFieldDeclarator extends IASTDeclarator {
@ -41,4 +42,8 @@ public interface IASTFieldDeclarator extends IASTDeclarator {
*/ */
public void setBitFieldSize(IASTExpression size); 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. * expression, def is the field name.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTFieldReference extends IASTExpression, IASTNameOwner { public interface IASTFieldReference extends IASTExpression, IASTNameOwner {
@ -79,4 +80,9 @@ public interface IASTFieldReference extends IASTExpression, IASTNameOwner {
*/ */
public void setIsPointerDereference(boolean value); 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. * declaration but not both.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTForStatement extends IASTStatement { public interface IASTForStatement extends IASTStatement {
@ -111,4 +112,9 @@ public interface IASTForStatement extends IASTStatement {
* @return <code>IScope</code> * @return <code>IScope</code>
*/ */
public IScope getScope(); 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. * function name expression, x is the parameter expression.
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTFunctionCallExpression extends IASTExpression { public interface IASTFunctionCallExpression extends IASTExpression {
@ -64,4 +65,9 @@ public interface IASTFunctionCallExpression extends IASTExpression {
*/ */
public IASTExpression getParameterExpression(); 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. * This is a declarator for a function.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTFunctionDeclarator extends IASTDeclarator { 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. * This is a function definition, i.e. it has a body.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTFunctionDefinition extends IASTDeclaration { public interface IASTFunctionDefinition extends IASTDeclaration {
@ -98,4 +99,9 @@ public interface IASTFunctionDefinition extends IASTDeclaration {
* @return <code>IScope</code> representing function body. * @return <code>IScope</code> representing function body.
*/ */
public IScope getScope(); 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 * is not an IASTName, as there are not any bindings for
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTFunctionStyleMacroParameter extends IASTNode { public interface IASTFunctionStyleMacroParameter extends IASTNode {

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.core.dom.ast;
* Represents a goto statement. * Represents a goto statement.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTGotoStatement extends IASTStatement, IASTNameOwner { public interface IASTGotoStatement extends IASTStatement, IASTNameOwner {
@ -34,4 +35,9 @@ public interface IASTGotoStatement extends IASTStatement, IASTNameOwner {
*/ */
public void setName(IASTName name); 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. * This is a name used in an expression.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTIdExpression extends IASTExpression, IASTNameOwner { public interface IASTIdExpression extends IASTExpression, IASTNameOwner {
@ -37,4 +38,9 @@ public interface IASTIdExpression extends IASTExpression, IASTNameOwner {
* @param name * @param name
*/ */
public void setName(IASTName 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. * The if statement including the optional else clause.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTIfStatement extends IASTStatement { public interface IASTIfStatement extends IASTStatement {
@ -84,4 +85,8 @@ public interface IASTIfStatement extends IASTStatement {
*/ */
public void setElseClause(IASTStatement elseClause); 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. * This represents an initializer for a declarator.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTInitializer extends IASTNode { public interface IASTInitializer extends IASTNode {
@ -22,4 +23,8 @@ public interface IASTInitializer extends IASTNode {
*/ */
public final static IASTInitializer[] EMPTY_INITIALIZER_ARRAY = new IASTInitializer[0]; 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. * This is an initializer that is simply an expression.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTInitializerExpression extends IASTInitializer { public interface IASTInitializerExpression extends IASTInitializer {
@ -38,4 +39,9 @@ public interface IASTInitializerExpression extends IASTInitializer {
* <code>IASTExpression</code> * <code>IASTExpression</code>
*/ */
public void setExpression(IASTExpression expression); 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. * This is an an initializer that is a list of initializers.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTInitializerList extends IASTInitializer { public interface IASTInitializerList extends IASTInitializer {
@ -38,4 +39,9 @@ public interface IASTInitializerList extends IASTInitializer {
* <code>IASTInitializer</code> * <code>IASTInitializer</code>
*/ */
public void addInitializer(IASTInitializer initializer); 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. * Represents a label statement.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTLabelStatement extends IASTStatement, IASTNameOwner { public interface IASTLabelStatement extends IASTStatement, IASTNameOwner {
@ -42,4 +43,9 @@ public interface IASTLabelStatement extends IASTStatement, IASTNameOwner {
*/ */
public void setNestedStatement( IASTStatement s ); 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); 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 * @since 5.1
*/ */
public IASTName getLastName(); 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. * class/struct/union names in C.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTNamedTypeSpecifier extends IASTDeclSpecifier, IASTNameOwner { public interface IASTNamedTypeSpecifier extends IASTDeclSpecifier, IASTNameOwner {
@ -39,4 +40,8 @@ public interface IASTNamedTypeSpecifier extends IASTDeclSpecifier, IASTNameOwner
*/ */
public void setName(IASTName name); public void setName(IASTName name);
/**
* @since 5.1
*/
public IASTNamedTypeSpecifier copy();
} }

View file

@ -193,4 +193,23 @@ public interface IASTNode {
* @since 5.1 * @since 5.1
*/ */
public boolean isFrozen(); 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. ';' * This node represents a null statement. ';'
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTNullStatement extends IASTStatement { 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 * This class represents a parameter declaration
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTParameterDeclaration extends IASTNode { public interface IASTParameterDeclaration extends IASTNode {
/** /**
@ -67,4 +68,8 @@ public interface IASTParameterDeclaration extends IASTNode {
*/ */
public void setDeclarator(IASTDeclarator declarator); 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. * This represents the good ol' * pointer operator.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTPointer extends IASTPointerOperator { public interface IASTPointer extends IASTPointerOperator {
@ -48,4 +49,10 @@ public interface IASTPointer extends IASTPointerOperator {
*/ */
public void setVolatile(boolean value); 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 * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTPointerOperator extends IASTNode { public interface IASTPointerOperator extends IASTNode {
@ -20,4 +21,8 @@ public interface IASTPointerOperator extends IASTNode {
*/ */
public static final IASTPointerOperator[] EMPTY_ARRAY = new IASTPointerOperator[0]; 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. * Interface for problems in the ast tree.
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTProblem extends IProblem, IASTNode { 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. * declaration.
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTProblemDeclaration extends IASTDeclaration, public interface IASTProblemDeclaration extends IASTDeclaration, IASTProblemHolder {
IASTProblemHolder {
/**
* @since 5.1
*/
public IASTProblemDeclaration copy();
} }

View file

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

View file

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

View file

@ -15,7 +15,12 @@ package org.eclipse.cdt.core.dom.ast;
* statement. * statement.
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTProblemStatement extends IASTStatement, IASTProblemHolder { 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. * type-id.
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTProblemTypeId extends IASTTypeId, IASTProblemHolder { 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 * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTReturnStatement extends IASTStatement { public interface IASTReturnStatement extends IASTStatement {
@ -38,4 +39,8 @@ public interface IASTReturnStatement extends IASTStatement {
*/ */
public void setReturnValue(IASTExpression returnValue); 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. * This represents a decl specifier for a built-in type.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTSimpleDeclSpecifier extends IASTDeclSpecifier { public interface IASTSimpleDeclSpecifier extends IASTDeclSpecifier {
@ -130,4 +131,9 @@ public interface IASTSimpleDeclSpecifier extends IASTDeclSpecifier {
*/ */
public void setShort(boolean value); 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. * followed by a list of declarators.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTSimpleDeclaration extends IASTDeclaration { public interface IASTSimpleDeclaration extends IASTDeclaration {
@ -65,4 +66,8 @@ public interface IASTSimpleDeclaration extends IASTDeclaration {
*/ */
public void addDeclarator(IASTDeclarator declarator); 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. * This is a declarator for a non K&R C function.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTStandardFunctionDeclarator extends IASTFunctionDeclarator { public interface IASTStandardFunctionDeclarator extends IASTFunctionDeclarator {
@ -54,4 +55,9 @@ public interface IASTStandardFunctionDeclarator extends IASTFunctionDeclarator {
* boolean * boolean
*/ */
public void setVarArgs(boolean value); 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. * This is the root interface for statements.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement
*/ */
public interface IASTStatement extends IASTNode { public interface IASTStatement extends IASTNode {
/** /**
@ -21,4 +22,9 @@ public interface IASTStatement extends IASTNode {
*/ */
public static final IASTStatement[] EMPTY_STATEMENT_ARRAY = new IASTStatement[0]; 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. * The switch statement.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTSwitchStatement extends IASTStatement { public interface IASTSwitchStatement extends IASTStatement {
@ -64,4 +65,8 @@ public interface IASTSwitchStatement extends IASTStatement {
*/ */
public void setBody(IASTStatement body); 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 * @since 5.1
*/ */
public void freeze(); 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 * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTTypeId extends IASTNode { public interface IASTTypeId extends IASTNode {
@ -58,4 +59,9 @@ public interface IASTTypeId extends IASTNode {
* @param abstractDeclarator <code>IASTDeclarator</code> * @param abstractDeclarator <code>IASTDeclarator</code>
*/ */
public void setAbstractDeclarator(IASTDeclarator abstractDeclarator); 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 * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTTypeIdExpression extends IASTExpression { public interface IASTTypeIdExpression extends IASTExpression {
@ -75,4 +76,8 @@ public interface IASTTypeIdExpression extends IASTExpression {
*/ */
public IASTTypeId getTypeId(); 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. * This interface is used to represent a unary expression in the AST.
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTUnaryExpression extends IASTExpression { public interface IASTUnaryExpression extends IASTExpression {
@ -152,4 +153,8 @@ public interface IASTUnaryExpression extends IASTExpression {
*/ */
public void setOperand(IASTExpression expression); 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. * Ye ol' while statement.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface IASTWhileStatement extends IASTStatement { public interface IASTWhileStatement extends IASTStatement {
@ -58,4 +59,8 @@ public interface IASTWhileStatement extends IASTStatement {
*/ */
public void setBody(IASTStatement body); 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 }; * instance = { def[0] = 9 };
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICASTArrayDesignator extends ICASTDesignator { public interface ICASTArrayDesignator extends ICASTDesignator {
@ -43,4 +44,8 @@ public interface ICASTArrayDesignator extends ICASTDesignator {
*/ */
public void setSubscriptExpression(IASTExpression value); 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. * modifiers (const, restrict, etc.) as well as variable sized arrays.
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICASTArrayModifier extends IASTArrayModifier { public interface ICASTArrayModifier extends IASTArrayModifier {
@ -94,4 +95,9 @@ public interface ICASTArrayModifier extends IASTArrayModifier {
* boolean * boolean
*/ */
public void setVariableSized(boolean value); 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. * Structs and Unions in C can be qualified w/restrict keyword.
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICASTCompositeTypeSpecifier extends public interface ICASTCompositeTypeSpecifier extends
IASTCompositeTypeSpecifier, ICASTDeclSpecifier { 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) * C extension to IASTDeclSpecifier. (restrict keyword)
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICASTDeclSpecifier extends IASTDeclSpecifier { public interface ICASTDeclSpecifier extends IASTDeclSpecifier {
@ -33,4 +34,9 @@ public interface ICASTDeclSpecifier extends IASTDeclSpecifier {
*/ */
public void setRestrict(boolean value); 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 }; * .t[1] = 3 };
* *
* @author jcamelon * @author jcamelon
* * @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICASTDesignatedInitializer extends IASTInitializer { public interface ICASTDesignatedInitializer extends IASTInitializer {
@ -72,4 +72,9 @@ public interface ICASTDesignatedInitializer extends IASTInitializer {
* <code>IASTInitializer</code> * <code>IASTInitializer</code>
*/ */
public void setOperandInitializer(IASTInitializer rhs); 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. * Base interface for all C-style designators.
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICASTDesignator extends IASTNode { 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. * for the addition of the restrict keyword.
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICASTElaboratedTypeSpecifier extends public interface ICASTElaboratedTypeSpecifier extends
IASTElaboratedTypeSpecifier, ICASTDeclSpecifier { 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 }; * C Enumeration decl specifier. Allows for "restrict enum X { a, b, c };
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICASTEnumerationSpecifier extends ICASTDeclSpecifier, public interface ICASTEnumerationSpecifier extends ICASTDeclSpecifier,
IASTEnumerationSpecifier { 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. * Specific Designator that represents a field reference.
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICASTFieldDesignator extends ICASTDesignator { public interface ICASTFieldDesignator extends ICASTDesignator {
@ -41,4 +42,9 @@ public interface ICASTFieldDesignator extends ICASTDesignator {
* <code>IASTName</code> * <code>IASTName</code>
*/ */
public void setName(IASTName name); 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). * C-specific pointer. (includes restrict modifier).
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICASTPointer extends IASTPointer { public interface ICASTPointer extends IASTPointer {
@ -33,4 +34,9 @@ public interface ICASTPointer extends IASTPointer {
*/ */
void setRestrict(boolean value); 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. * This interface represents a built-in type in C.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICASTSimpleDeclSpecifier extends IASTSimpleDeclSpecifier, public interface ICASTSimpleDeclSpecifier extends IASTSimpleDeclSpecifier,
ICASTDeclSpecifier { ICASTDeclSpecifier {
@ -71,4 +72,9 @@ public interface ICASTSimpleDeclSpecifier extends IASTSimpleDeclSpecifier,
*/ */
public void setLongLong(boolean value); 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 } * C Expression of the format type-id { initializer }
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*
*/ */
public interface ICASTTypeIdInitializerExpression extends IASTExpression { public interface ICASTTypeIdInitializerExpression extends IASTExpression {
@ -67,4 +69,9 @@ public interface ICASTTypeIdInitializerExpression extends IASTExpression {
*/ */
public void setInitializer(IASTInitializer initializer); 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. * includes the abiliy to use the restrict modifier.
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICASTTypedefNameSpecifier extends IASTNamedTypeSpecifier, public interface ICASTTypedefNameSpecifier extends IASTNamedTypeSpecifier, ICASTDeclSpecifier {
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. * C++ adds a few more binary expressions over C.
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPASTBinaryExpression extends IASTBinaryExpression { public interface ICPPASTBinaryExpression extends IASTBinaryExpression {
@ -35,4 +36,9 @@ public interface ICPPASTBinaryExpression extends IASTBinaryExpression {
*/ */
@Deprecated @Deprecated
public static final int op_last = IASTBinaryExpression.op_last; 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. * C++ adds in additional cast-style expressions.
* *
* @author jcamelon * @author jcamelon
* @noimplement
*/ */
public interface ICPPASTCastExpression extends IASTCastExpression { public interface ICPPASTCastExpression extends IASTCastExpression {
@ -43,4 +44,10 @@ public interface ICPPASTCastExpression extends IASTCastExpression {
* <code>op_last</code> is for subinterfaces to extend. * <code>op_last</code> is for subinterfaces to extend.
*/ */
public static final int op_last = op_const_cast; 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 ICPPASTFunctionWithTryBlock
* @see ICPPASTTryBlockStatement * @see ICPPASTTryBlockStatement
* *
* @noimplement This interface is not intended to be implemented by clients. * @noimplement
*/ */
public interface ICPPASTCatchHandler extends IASTStatement { public interface ICPPASTCatchHandler extends IASTStatement {
@ -73,4 +73,9 @@ public interface ICPPASTCatchHandler extends IASTStatement {
* @since 5.1 * @since 5.1
*/ */
public IScope getScope(); 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. * Base Specifiers are where a class expresses from whom it inherits.
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public static interface ICPPASTBaseSpecifier extends IASTNode, IASTNameOwner { public static interface ICPPASTBaseSpecifier extends IASTNode, IASTNameOwner {
/** /**
@ -125,6 +126,11 @@ public interface ICPPASTCompositeTypeSpecifier extends
* <code>IASTName</code> * <code>IASTName</code>
*/ */
public void setName(IASTName name); public void setName(IASTName name);
/**
* @since 5.1
*/
public ICPPASTBaseSpecifier copy();
} }
/** /**
@ -146,4 +152,9 @@ public interface ICPPASTCompositeTypeSpecifier extends
* @since 5.1 * @since 5.1
*/ */
public ICPPClassScope getScope(); 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::X : a(0) {} // a(0) is a constructor chain initializer. * 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 { public interface ICPPASTConstructorChainInitializer extends IASTInitializer, IASTNameOwner {
/** /**
@ -73,4 +75,8 @@ public interface ICPPASTConstructorChainInitializer extends IASTInitializer, IAS
*/ */
public void setInitializerValue(IASTExpression expression); 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. * This is an initializer that is a call to the constructor for the declarator.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPASTConstructorInitializer extends IASTInitializer { public interface ICPPASTConstructorInitializer extends IASTInitializer {
@ -42,4 +43,8 @@ public interface ICPPASTConstructorInitializer extends IASTInitializer {
*/ */
public void setExpression(IASTExpression expression); 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. * This interface represents a C++ conversion member function.
* *
* @author dsteffle * @author dsteffle
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPASTConversionName extends IASTName { public interface ICPPASTConversionName extends IASTName {
public static final ASTNodeProperty TYPE_ID=new ASTNodeProperty( public static final ASTNodeProperty TYPE_ID=new ASTNodeProperty(
@ -37,4 +38,9 @@ public interface ICPPASTConversionName extends IASTName {
* @param typeId * @param typeId
*/ */
public void setTypeId(IASTTypeId 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. * C++ adds additional modifiers and types for decl specifier sequence.
* *
* @author Doug Schaefer * @author Doug Schaefer
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPASTDeclSpecifier extends IASTDeclSpecifier { public interface ICPPASTDeclSpecifier extends IASTDeclSpecifier {
@ -76,4 +77,9 @@ public interface ICPPASTDeclSpecifier extends IASTDeclSpecifier {
*/ */
public void setExplicit(boolean value); 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; * This interface represents a delete expression. delete [] operand;
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPASTDeleteExpression extends IASTExpression { public interface ICPPASTDeleteExpression extends IASTExpression {
@ -69,4 +70,10 @@ public interface ICPPASTDeleteExpression extends IASTExpression {
*/ */
public boolean isVectored(); 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. * Elaborated types in C++ include classes.
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPASTElaboratedTypeSpecifier extends public interface ICPPASTElaboratedTypeSpecifier extends
IASTElaboratedTypeSpecifier, ICPPASTDeclSpecifier { IASTElaboratedTypeSpecifier, ICPPASTDeclSpecifier {
@ -30,4 +31,9 @@ public interface ICPPASTElaboratedTypeSpecifier extends
*/ */
public static final int k_last = k_class; 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. * This interface represents an explict template instantiation.
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*
*/ */
public interface ICPPASTExplicitTemplateInstantiation extends IASTDeclaration { public interface ICPPASTExplicitTemplateInstantiation extends IASTDeclaration {
@ -42,4 +44,8 @@ public interface ICPPASTExplicitTemplateInstantiation extends IASTDeclaration {
*/ */
public void setDeclaration(IASTDeclaration declaration); 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. * specify the parse.
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPASTFieldReference extends IASTFieldReference { public interface ICPPASTFieldReference extends IASTFieldReference {
@ -33,4 +34,9 @@ public interface ICPPASTFieldReference extends IASTFieldReference {
*/ */
public void setIsTemplate(boolean value); 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.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTForStatement; 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 interface ICPPASTForStatement extends IASTForStatement {
public static final ASTNodeProperty CONDITION_DECLARATION = new ASTNodeProperty( "org.eclipse.cdt.core.dom.ast.cpp.ICPPASTForStatement"); //$NON-NLS-1$ 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 void setConditionDeclaration( IASTDeclaration d );
public IASTDeclaration getConditionDeclaration(); public IASTDeclaration getConditionDeclaration();
/**
* @since 5.1
*/
public ICPPASTForStatement copy();
} }

View file

@ -103,4 +103,9 @@ public interface ICPPASTFunctionDeclarator extends IASTStandardFunctionDeclarato
@Deprecated @Deprecated
public void addConstructorToChain(ICPPASTConstructorChainInitializer initializer); 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. * Adds a member initializer to this function definition.
*/ */
public void addMemberInitializer(ICPPASTConstructorChainInitializer initializer); 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. * @deprecated, use {@link ICPPASTFunctionWithTryBlock}, instead.
* @noimplement This interface is not intended to be implemented by clients.
*/ */
@Deprecated @Deprecated
public interface ICPPASTFunctionTryBlockDeclarator extends public interface ICPPASTFunctionTryBlockDeclarator extends
@ -41,4 +42,9 @@ public interface ICPPASTFunctionTryBlockDeclarator extends
* @return <code>ICPPASTCatchHandler</code> * @return <code>ICPPASTCatchHandler</code>
*/ */
public ICPPASTCatchHandler[] getCatchHandlers(); public ICPPASTCatchHandler[] getCatchHandlers();
/**
* @since 5.1
*/
public ICPPASTFunctionTryBlockDeclarator copy();
} }

View file

@ -40,4 +40,9 @@ public interface ICPPASTFunctionWithTryBlock extends ICPPASTFunctionDefinition {
*/ */
public ICPPASTCatchHandler[] getCatchHandlers(); 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.IASTIfStatement;
import org.eclipse.cdt.core.dom.ast.IScope; 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 interface ICPPASTIfStatement extends IASTIfStatement {
public IASTDeclaration getConditionDeclaration(); public IASTDeclaration getConditionDeclaration();
@ -25,4 +30,9 @@ public interface ICPPASTIfStatement extends IASTIfStatement {
* @return <code>IScope</code> * @return <code>IScope</code>
*/ */
public IScope getScope(); 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" { ... } * This interface represents a linkage specification. e.g. extern "C" { ... }
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPASTLinkageSpecification extends IASTDeclaration { public interface ICPPASTLinkageSpecification extends IASTDeclaration {
@ -56,4 +57,9 @@ public interface ICPPASTLinkageSpecification extends IASTDeclaration {
* <code>IASTDeclaration</code> * <code>IASTDeclaration</code>
*/ */
public void addDeclaration(IASTDeclaration declaration); 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. * <code>lk_last</code> is maintained for future subinterfaces.
*/ */
public static final int lk_last = lk_false; 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. * typename.
* *
* @author jcamelon * @author jcamelon
* @noimplement This interface is not intended to be implemented by clients.
*/ */
public interface ICPPASTNamedTypeSpecifier extends IASTNamedTypeSpecifier, public interface ICPPASTNamedTypeSpecifier extends IASTNamedTypeSpecifier,
ICPPASTDeclSpecifier { ICPPASTDeclSpecifier {
@ -36,4 +37,9 @@ public interface ICPPASTNamedTypeSpecifier extends IASTNamedTypeSpecifier,
*/ */
public void setIsTypename(boolean value); 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