Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2015-12-17 22:35:40 +0000
committerGerrit Code Review @ Eclipse.org2015-12-18 00:10:51 +0000
commit393d36fc3ebcf40e2ddaa8d8e56363a092d99e2a (patch)
treecf548621d45b3e4decdab05e8d65c0039f5c39eb
parenta43976b8826cffde7cf801cf7929dab3448c662d (diff)
downloadorg.eclipse.cdt-393d36fc3ebcf40e2ddaa8d8e56363a092d99e2a.tar.gz
org.eclipse.cdt-393d36fc3ebcf40e2ddaa8d8e56363a092d99e2a.tar.xz
org.eclipse.cdt-393d36fc3ebcf40e2ddaa8d8e56363a092d99e2a.zip
Bug 475739 - Treat C++ alignment-specifiers as attribute-specifiers
Change-Id: Ib8024a048073efe65c26c871bb3acd0f3bf2f620 Signed-off-by: Nathan Ridge <zeratul976@hotmail.com>
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTAlignmentSpecifier.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTAttributeList.java29
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTAttributeSpecifier.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTDeclSpecifier.java9
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/INodeFactory.java15
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTAlignmentSpecifier.java27
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTAttributeList.java22
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPNodeFactory.java7
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/IGCCASTAttributeList.java25
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/IGCCASTAttributeSpecifier.java4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTAttributeList.java (renamed from core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ASTAttributeSpecifier.java)14
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTAttributeOwner.java29
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/GCCASTAttributeList.java (renamed from core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/GCCASTAttributeSpecifier.java)13
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/NodeFactory.java12
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CNodeFactory.java26
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAliasDeclaration.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAlignmentSpecifier.java20
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAmbiguousAlignmentSpecifier.java19
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArrayModifier.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAttributeList.java (renamed from core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAttributeSpecifier.java)15
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAttributeOwner.java27
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBaseDeclSpecifier.java49
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBreakStatement.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCaseStatement.java7
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCatchHandler.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCompositeTypeSpecifier.java4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCompoundStatement.java7
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTContinueStatement.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDeclarator.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDefaultStatement.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDoStatement.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTElaboratedTypeSpecifier.java4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTEnumerationSpecifier.java4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTExpressionStatement.java7
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTForStatement.java9
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionDefinition.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTGotoStatement.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTIfStatement.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLabelStatement.java7
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamedTypeSpecifier.java4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamespaceDefinition.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNullStatement.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTPointer.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTRangeBasedForStatement.java9
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTReferenceOperator.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTReturnStatement.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleDeclSpecifier.java4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleDeclaration.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSwitchStatement.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTryBlockStatement.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypeTransformationSpecifier.java4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUsingDeclaration.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUsingDirective.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTWhileStatement.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPNodeFactory.java16
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPASTGotoStatement.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java42
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/AttributeWriter.java31
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/NodeWriter.java4
61 files changed, 404 insertions, 263 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java
index 6a2d75b1852..6f11824f4ba 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java
@@ -11249,6 +11249,12 @@ public class AST2CPPTests extends AST2TestBase {
public void testAlignas_451082() throws Exception {
parseAndCheckBindings();
}
+
+ // struct alignas(16) Node {};
+ // enum alignas(8) E { E1, E2 };
+ public void testAlignas_475739() throws Exception {
+ parseAndCheckBindings();
+ }
// int operator "" _A(unsigned long long i) { return 1; }
// int operator "" _B(long double d) { return 1; }
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTAlignmentSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTAlignmentSpecifier.java
index 20d9b4be30c..413cb87caec 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTAlignmentSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTAlignmentSpecifier.java
@@ -13,7 +13,7 @@ package org.eclipse.cdt.core.dom.ast;
/**
* Represents an alignment specifier.
*
- * Grammatically, this is a decl-specifier.
+ * Grammatically, this is a decl-specifier in C and an attribute-specifier in C++.
*
* Possible forms are:
* C++:
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTAttributeList.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTAttributeList.java
new file mode 100644
index 00000000000..0a8a6512b01
--- /dev/null
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTAttributeList.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Nathan Ridge.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.core.dom.ast;
+
+/**
+ * An attribute-specifier of the form [[ attribute-list ]] or __attribute__(( attribute-list )).
+
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @since 5.12
+ */
+public interface IASTAttributeList extends IASTAttributeSpecifier {
+ /**
+ * Returns the attributes in the list.
+ */
+ @Override
+ public abstract IASTAttribute[] getAttributes();
+
+ /**
+ * Adds an attribute to the list.
+ */
+ @Override
+ public abstract void addAttribute(IASTAttribute attribute);
+}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTAttributeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTAttributeSpecifier.java
index 623054051b6..09763c96b4e 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTAttributeSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTAttributeSpecifier.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 Institute for Software, HSR Hochschule fuer Technik
+ * Copyright (c) 2014, 2015 Institute for Software, HSR Hochschule fuer Technik and others
* Rapperswil, University of applied sciences and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -26,12 +26,16 @@ public interface IASTAttributeSpecifier extends IASTNode {
/**
* Returns the attributes of the specifier.
+ * @deprecated Use IASTAttributeList.getAttributes() instead.
*/
+ @Deprecated
public abstract IASTAttribute[] getAttributes();
/**
* Adds an attribute to the specifier.
+ * @deprecated Use IASTAttributeList.addAttribute() instead.
*/
+ @Deprecated
public abstract void addAttribute(IASTAttribute attribute);
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTDeclSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTDeclSpecifier.java
index 49e59dbb477..6a3061f60cf 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTDeclSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTDeclSpecifier.java
@@ -30,7 +30,10 @@ public interface IASTDeclSpecifier extends IASTNode {
/** @since 5.2 */
public static final int sc_mutable = 6;
- /** @since 5.10 */
+ /**
+ * @since 5.10
+ */
+ @Deprecated
public static final ASTNodeProperty ALIGNMENT_SPECIFIER = new ASTNodeProperty(
"IASTDeclSpecifier.ALIGNMENT_SPECIFIER - Alignment specifier"); //$NON-NLS-1$
@@ -53,8 +56,10 @@ public interface IASTDeclSpecifier extends IASTNode {
/**
* Get any alignment-specifiers in this decl-specifier sequence.
+ * @deprecated Alignment specifiers are now stored in the attribute specifier sequence.
* @since 5.10
*/
+ @Deprecated
public IASTAlignmentSpecifier[] getAlignmentSpecifiers();
/**
@@ -97,8 +102,10 @@ public interface IASTDeclSpecifier extends IASTNode {
/**
* Not allowed on frozen ast.
+ * @deprecated Alignment specifiers are now stored in the attribute specifier sequence.
* @since 5.10
*/
+ @Deprecated
public void setAlignmentSpecifiers(IASTAlignmentSpecifier[] alignmentSpecifiers);
/**
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/INodeFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/INodeFactory.java
index e41a6a58a6e..ed03f6dbeb4 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/INodeFactory.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/INodeFactory.java
@@ -15,7 +15,7 @@
package org.eclipse.cdt.core.dom.ast;
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
-import org.eclipse.cdt.core.dom.ast.gnu.IGCCASTAttributeSpecifier;
+import org.eclipse.cdt.core.dom.ast.gnu.IGCCASTAttributeList;
import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTCompoundStatementExpression;
import org.eclipse.cdt.core.parser.IScanner;
import org.eclipse.cdt.core.parser.IToken;
@@ -122,8 +122,17 @@ public interface INodeFactory {
public IASTFunctionDefinition newFunctionDefinition(IASTDeclSpecifier declSpecifier,
IASTFunctionDeclarator declarator, IASTStatement bodyStatement);
- /** @since 5.7 */
- public IGCCASTAttributeSpecifier newGCCAttributeSpecifier();
+ /**
+ * @deprecated Use newGCCAttributeList() instead.
+ * @since 5.7
+ */
+ @Deprecated
+ public org.eclipse.cdt.core.dom.ast.gnu.IGCCASTAttributeSpecifier newGCCAttributeSpecifier();
+
+ /**
+ * @since 5.12
+ */
+ public IGCCASTAttributeList newGCCAttributeList();
public IGNUASTCompoundStatementExpression newGNUCompoundStatementExpression(IASTCompoundStatement compoundStatement);
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTAlignmentSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTAlignmentSpecifier.java
new file mode 100644
index 00000000000..6cb62cde790
--- /dev/null
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTAlignmentSpecifier.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Nathan Ridge.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.core.dom.ast.cpp;
+
+import org.eclipse.cdt.core.dom.ast.IASTAlignmentSpecifier;
+import org.eclipse.cdt.core.dom.parser.cpp.ICPPASTAttributeSpecifier;
+
+/**
+ * A C++ alignment-specifier.
+ *
+ * In the C++ grammar, an alignment-specifier is an attribute-specifier.
+ *
+ * @since 5.12
+ */
+public interface ICPPASTAlignmentSpecifier extends IASTAlignmentSpecifier, ICPPASTAttributeSpecifier {
+ @Override
+ public ICPPASTAlignmentSpecifier copy();
+
+ @Override
+ public ICPPASTAlignmentSpecifier copy(CopyStyle style);
+
+}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTAttributeList.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTAttributeList.java
new file mode 100644
index 00000000000..f2b33bb8a1c
--- /dev/null
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTAttributeList.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Nathan Ridge.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.core.dom.ast.cpp;
+
+import org.eclipse.cdt.core.dom.ast.IASTAttributeList;
+import org.eclipse.cdt.core.dom.parser.cpp.ICPPASTAttributeSpecifier;
+
+/**
+ * Represents a C++11 (ISO/IEC 14882:2011 7.6.1 [dcl.attr.grammar]) attribute specifier
+ * of the form [[ attribute-list ]].
+ *
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @since 5.12
+ */
+public interface ICPPASTAttributeList extends ICPPASTAttributeSpecifier, IASTAttributeList {
+}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPNodeFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPNodeFactory.java
index aeebf2d9b3f..e408e3f39ed 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPNodeFactory.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPNodeFactory.java
@@ -78,9 +78,16 @@ public interface ICPPNodeFactory extends INodeFactory {
public ICPPASTAttribute newAttribute(char[] name, char[] scope, IASTToken argumentClause, boolean packExpansion);
/**
+ * @deprecated Use newAttributeList() instead.
* @since 5.7
*/
+ @Deprecated
public ICPPASTAttributeSpecifier newAttributeSpecifier();
+
+ /**
+ * @since 5.12
+ */
+ public ICPPASTAttributeList newAttributeList();
@Deprecated
public ICPPASTBaseSpecifier newBaseSpecifier(IASTName name, int visibility, boolean isVirtual);
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/IGCCASTAttributeList.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/IGCCASTAttributeList.java
new file mode 100644
index 00000000000..e7c1bfb489c
--- /dev/null
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/IGCCASTAttributeList.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Nathan Ridge.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.core.dom.ast.gnu;
+
+import org.eclipse.cdt.core.dom.ast.IASTAttributeList;
+import org.eclipse.cdt.core.dom.ast.IASTAttributeSpecifier;
+import org.eclipse.cdt.core.parser.util.InstanceOfPredicate;
+
+/**
+ * Represents a GCC attribute specifier, introduced by __attribute__.
+ *
+ * @since 5.12
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+@SuppressWarnings("deprecation")
+public interface IGCCASTAttributeList extends IASTAttributeList, IGCCASTAttributeSpecifier {
+ public static InstanceOfPredicate<IASTAttributeSpecifier> TYPE_FILTER =
+ new InstanceOfPredicate<>(IGCCASTAttributeList.class);
+}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/IGCCASTAttributeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/IGCCASTAttributeSpecifier.java
index bc4d51c5cae..e0e7cc9e1db 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/IGCCASTAttributeSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/IGCCASTAttributeSpecifier.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 Institute for Software, HSR Hochschule fuer Technik
+ * Copyright (c) 2014, 2015 Institute for Software, HSR Hochschule fuer Technik and others
* Rapperswil, University of applied sciences and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -17,10 +17,12 @@ import org.eclipse.cdt.core.parser.util.InstanceOfPredicate;
/**
* Represents a GCC attribute specifier, introduced by __attribute__.
*
+ * @deprecated Use IGCCASTAttributeList instead.
* @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients.
* @since 5.7
*/
+@Deprecated
public interface IGCCASTAttributeSpecifier extends IASTAttributeSpecifier {
public static InstanceOfPredicate<IASTAttributeSpecifier> TYPE_FILTER =
new InstanceOfPredicate<>(IGCCASTAttributeSpecifier.class);
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ASTAttributeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTAttributeList.java
index d5d35044424..64e56e216c8 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ASTAttributeSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTAttributeList.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 Institute for Software, HSR Hochschule fuer Technik
+ * Copyright (c) 2014, 2015 Institute for Software, HSR Hochschule fuer Technik and others
* Rapperswil, University of applied sciences.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -9,21 +9,21 @@
* Contributors:
* Thomas Corbat (IFS) - Initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.internal.core.dom.parser.cpp;
+package org.eclipse.cdt.internal.core.dom.parser;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTAttribute;
+import org.eclipse.cdt.core.dom.ast.IASTAttributeList;
import org.eclipse.cdt.core.dom.ast.IASTAttributeSpecifier;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
-import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
/**
- * Represents an attribute specifier, containing attributes.
+ * Represents an attribute list, containing attributes.
*/
-public abstract class ASTAttributeSpecifier extends ASTNode implements IASTAttributeSpecifier {
+public abstract class ASTAttributeList extends ASTNode implements IASTAttributeList {
protected IASTAttribute[] attributes = IASTAttribute.EMPTY_ATTRIBUTE_ARRAY;
- public ASTAttributeSpecifier() {
+ public ASTAttributeList() {
super();
}
@@ -65,7 +65,7 @@ public abstract class ASTAttributeSpecifier extends ASTNode implements IASTAttri
return true;
}
- protected <T extends ASTAttributeSpecifier> T copy(T copy, CopyStyle style) {
+ protected <T extends ASTAttributeList> T copy(T copy, CopyStyle style) {
copy.attributes = ArrayUtil.trim(attributes, true);
for (int i = 0; i < copy.attributes.length; i++) {
IASTAttribute attributeCopy = copy.attributes[i].copy(style);
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTAttributeOwner.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTAttributeOwner.java
index cb35f7fcbcd..b196c9862f3 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTAttributeOwner.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTAttributeOwner.java
@@ -12,10 +12,13 @@
package org.eclipse.cdt.internal.core.dom.parser;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
+import org.eclipse.cdt.core.dom.ast.IASTAlignmentSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTAttribute;
+import org.eclipse.cdt.core.dom.ast.IASTAttributeList;
import org.eclipse.cdt.core.dom.ast.IASTAttributeOwner;
import org.eclipse.cdt.core.dom.ast.IASTAttributeSpecifier;
-import org.eclipse.cdt.core.dom.ast.gnu.IGCCASTAttributeSpecifier;
+import org.eclipse.cdt.core.dom.ast.IASTNode;
+import org.eclipse.cdt.core.dom.ast.gnu.IGCCASTAttributeList;
import org.eclipse.cdt.core.dom.parser.cpp.ICPPASTAttributeSpecifier;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
@@ -29,7 +32,10 @@ public abstract class ASTAttributeOwner extends ASTNode implements IASTAttribute
public IASTAttribute[] getAttributes() {
IASTAttribute[] attributes = IASTAttribute.EMPTY_ATTRIBUTE_ARRAY;
for (IASTAttributeSpecifier attributeSpecifier : getAttributeSpecifiers()) {
- attributes = ArrayUtil.addAll(attributes, attributeSpecifier.getAttributes());
+ if (attributeSpecifier instanceof IASTAttributeList) {
+ attributes = ArrayUtil.addAll(attributes,
+ ((IASTAttributeList) attributeSpecifier).getAttributes());
+ }
}
return attributes;
}
@@ -78,7 +84,7 @@ public abstract class ASTAttributeOwner extends ASTNode implements IASTAttribute
protected boolean acceptByGCCAttributeSpecifiers(ASTVisitor action) {
for (IASTAttributeSpecifier attributeSpecifier : attributeSpecifiers) {
- if (!(attributeSpecifier instanceof IGCCASTAttributeSpecifier))
+ if (!(attributeSpecifier instanceof IGCCASTAttributeList))
continue;
if (!attributeSpecifier.accept(action))
return false;
@@ -95,4 +101,21 @@ public abstract class ASTAttributeOwner extends ASTNode implements IASTAttribute
}
return true;
}
+
+ /*
+ * Having this here allows CPPASTAttributeOwner to implement IASTAmbiguityParent
+ * without needing to access the field attributeSpecifiers.
+ */
+ protected void replace(IASTNode child, IASTNode other) {
+ if (child instanceof IASTAlignmentSpecifier && other instanceof IASTAlignmentSpecifier) {
+ for (int i = 0; i < attributeSpecifiers.length; ++i) {
+ if (attributeSpecifiers[i] == child) {
+ attributeSpecifiers[i] = (IASTAttributeSpecifier) other;
+ other.setParent(child.getParent());
+ other.setPropertyInParent(child.getPropertyInParent());
+ return;
+ }
+ }
+ }
+ }
} \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java
index f83f999683b..cadc42c0b71 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java
@@ -27,6 +27,7 @@ import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTASMDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTAlignmentSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTAttribute;
+import org.eclipse.cdt.core.dom.ast.IASTAttributeList;
import org.eclipse.cdt.core.dom.ast.IASTAttributeOwner;
import org.eclipse.cdt.core.dom.ast.IASTAttributeSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
@@ -2384,11 +2385,11 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
* @throws BacktrackException
* @throws EndOfFileException
*/
- protected IASTAttributeSpecifier __attribute__() throws BacktrackException, EndOfFileException {
+ protected IASTAttributeList __attribute__() throws BacktrackException, EndOfFileException {
if (LT(1) != IGCCToken.t__attribute__)
return null;
- IASTAttributeSpecifier result = nodeFactory.newGCCAttributeSpecifier();
+ IASTAttributeList result = nodeFactory.newGCCAttributeList();
consume();
if (LT(1) == IToken.tLPAREN) {
consume();
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/GCCASTAttributeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/GCCASTAttributeList.java
index 9f46809900d..043c5ac6efe 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/GCCASTAttributeSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/GCCASTAttributeList.java
@@ -11,20 +11,19 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser;
-import org.eclipse.cdt.core.dom.ast.gnu.IGCCASTAttributeSpecifier;
-import org.eclipse.cdt.internal.core.dom.parser.cpp.ASTAttributeSpecifier;
+import org.eclipse.cdt.core.dom.ast.gnu.IGCCASTAttributeList;
/**
- * Represents a GCC attribute specifier, containing attributes.
+ * Represents a GCC attribute list, containing attributes.
*/
-public class GCCASTAttributeSpecifier extends ASTAttributeSpecifier implements IGCCASTAttributeSpecifier {
+public class GCCASTAttributeList extends ASTAttributeList implements IGCCASTAttributeList {
@Override
- public GCCASTAttributeSpecifier copy(CopyStyle style) {
- return copy(new GCCASTAttributeSpecifier(), style);
+ public GCCASTAttributeList copy(CopyStyle style) {
+ return copy(new GCCASTAttributeList(), style);
}
@Override
- public GCCASTAttributeSpecifier copy() {
+ public GCCASTAttributeList copy() {
return copy(CopyStyle.withoutLocations);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/NodeFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/NodeFactory.java
index 753f50b3eb1..92267cff872 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/NodeFactory.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/NodeFactory.java
@@ -12,6 +12,7 @@ package org.eclipse.cdt.internal.core.dom.parser;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.INodeFactory;
+import org.eclipse.cdt.core.dom.ast.gnu.IGCCASTAttributeList;
/**
* Abstract base class for node factories.
@@ -34,4 +35,15 @@ public abstract class NodeFactory implements INodeFactory {
ASTNode e= (ASTNode) endNode;
a.setLength(e.getOffset() + e.getLength() - a.getOffset());
}
+
+ @Deprecated
+ @Override
+ public org.eclipse.cdt.core.dom.ast.gnu.IGCCASTAttributeSpecifier newGCCAttributeSpecifier() {
+ return new GCCASTAttributeList();
+ }
+
+ @Override
+ public IGCCASTAttributeList newGCCAttributeList() {
+ return new GCCASTAttributeList();
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CNodeFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CNodeFactory.java
index 681a1f30e98..b425b3f1714 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CNodeFactory.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CNodeFactory.java
@@ -81,14 +81,12 @@ import org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.c.ICASTTypeIdInitializerExpression;
import org.eclipse.cdt.core.dom.ast.c.ICASTTypedefNameSpecifier;
import org.eclipse.cdt.core.dom.ast.c.ICNodeFactory;
-import org.eclipse.cdt.core.dom.ast.gnu.IGCCASTAttributeSpecifier;
import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTCompoundStatementExpression;
import org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.gnu.c.IGCCASTArrayRangeDesignator;
import org.eclipse.cdt.core.parser.IScanner;
import org.eclipse.cdt.internal.core.dom.parser.ASTToken;
import org.eclipse.cdt.internal.core.dom.parser.ASTTokenList;
-import org.eclipse.cdt.internal.core.dom.parser.GCCASTAttributeSpecifier;
import org.eclipse.cdt.internal.core.dom.parser.NodeFactory;
import org.eclipse.cdt.internal.core.parser.scanner.CPreprocessor;
@@ -300,11 +298,6 @@ public class CNodeFactory extends NodeFactory implements ICNodeFactory {
}
@Override
- public IGCCASTAttributeSpecifier newGCCAttributeSpecifier() {
- return new GCCASTAttributeSpecifier();
- }
-
- @Override
public IGNUASTCompoundStatementExpression newGNUCompoundStatementExpression(IASTCompoundStatement compoundStatement) {
return new CASTCompoundStatementExpression(compoundStatement);
}
@@ -489,21 +482,4 @@ public class CNodeFactory extends NodeFactory implements ICNodeFactory {
public IASTWhileStatement newWhileStatement(IASTExpression condition, IASTStatement body) {
return new CASTWhileStatement(condition, body);
}
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+} \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAliasDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAliasDeclaration.java
index bc401ecd847..0ee03c134cc 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAliasDeclaration.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAliasDeclaration.java
@@ -15,9 +15,8 @@ import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTAliasDeclaration;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTypeId;
-import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
-public class CPPASTAliasDeclaration extends ASTAttributeOwner implements ICPPASTAliasDeclaration {
+public class CPPASTAliasDeclaration extends CPPASTAttributeOwner implements ICPPASTAliasDeclaration {
private IASTName aliasName;
private ICPPASTTypeId mappingTypeId;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAlignmentSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAlignmentSpecifier.java
index 81fc46e0bc1..a2b0ed91c0a 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAlignmentSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAlignmentSpecifier.java
@@ -11,14 +11,15 @@
package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
-import org.eclipse.cdt.core.dom.ast.IASTAlignmentSpecifier;
+import org.eclipse.cdt.core.dom.ast.IASTAttribute;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTAlignmentSpecifier;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
-public class CPPASTAlignmentSpecifier extends ASTNode implements IASTAlignmentSpecifier,
+public class CPPASTAlignmentSpecifier extends ASTNode implements ICPPASTAlignmentSpecifier,
IASTAmbiguityParent {
// Precisely one of these is null.
private IASTExpression fExpression;
@@ -47,12 +48,12 @@ public class CPPASTAlignmentSpecifier extends ASTNode implements IASTAlignmentSp
}
@Override
- public IASTAlignmentSpecifier copy() {
+ public ICPPASTAlignmentSpecifier copy() {
return copy(CopyStyle.withoutLocations);
}
@Override
- public IASTAlignmentSpecifier copy(CopyStyle style) {
+ public ICPPASTAlignmentSpecifier copy(CopyStyle style) {
CPPASTAlignmentSpecifier copy;
if (fExpression != null) {
copy = new CPPASTAlignmentSpecifier(fExpression.copy(style));
@@ -82,4 +83,15 @@ public class CPPASTAlignmentSpecifier extends ASTNode implements IASTAlignmentSp
other.setPropertyInParent(child.getPropertyInParent());
}
}
+
+ @Deprecated
+ @Override
+ public IASTAttribute[] getAttributes() {
+ return null;
+ }
+
+ @Deprecated
+ @Override
+ public void addAttribute(IASTAttribute attribute) {
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAmbiguousAlignmentSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAmbiguousAlignmentSpecifier.java
index 47f2ff54ce6..63b0eb955fc 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAmbiguousAlignmentSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAmbiguousAlignmentSpecifier.java
@@ -11,12 +11,14 @@
package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.IASTAlignmentSpecifier;
+import org.eclipse.cdt.core.dom.ast.IASTAttribute;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTAlignmentSpecifier;
import org.eclipse.cdt.internal.core.dom.parser.ASTAmbiguousNode;
-public class CPPASTAmbiguousAlignmentSpecifier extends ASTAmbiguousNode implements IASTAlignmentSpecifier {
+public class CPPASTAmbiguousAlignmentSpecifier extends ASTAmbiguousNode implements ICPPASTAlignmentSpecifier {
IASTAlignmentSpecifier fExpression;
IASTAlignmentSpecifier fTypeId;
@@ -36,12 +38,12 @@ public class CPPASTAmbiguousAlignmentSpecifier extends ASTAmbiguousNode implemen
}
@Override
- public IASTAlignmentSpecifier copy() {
+ public ICPPASTAlignmentSpecifier copy() {
throw new UnsupportedOperationException();
}
@Override
- public IASTAlignmentSpecifier copy(CopyStyle style) {
+ public ICPPASTAlignmentSpecifier copy(CopyStyle style) {
throw new UnsupportedOperationException();
}
@@ -49,4 +51,15 @@ public class CPPASTAmbiguousAlignmentSpecifier extends ASTAmbiguousNode implemen
public IASTNode[] getNodes() {
return new IASTNode[] { fExpression, fTypeId };
}
+
+ @Deprecated
+ @Override
+ public IASTAttribute[] getAttributes() {
+ return null;
+ }
+
+ @Deprecated
+ @Override
+ public void addAttribute(IASTAttribute attribute) {
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArrayModifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArrayModifier.java
index 814794c8a30..355409cff80 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArrayModifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArrayModifier.java
@@ -16,13 +16,11 @@ import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTNode;
-import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
-import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
/**
* @author jcamelon
*/
-public class CPPASTArrayModifier extends ASTAttributeOwner implements IASTArrayModifier, IASTAmbiguityParent {
+public class CPPASTArrayModifier extends CPPASTAttributeOwner implements IASTArrayModifier {
private IASTExpression exp;
public CPPASTArrayModifier() {
@@ -85,6 +83,8 @@ public class CPPASTArrayModifier extends ASTAttributeOwner implements IASTArrayM
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
exp = (IASTExpression) other;
+ return;
}
+ super.replace(child, other);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAttributeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAttributeList.java
index 46e72351721..09295ff945a 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAttributeSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAttributeList.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 Institute for Software, HSR Hochschule fuer Technik
+ * Copyright (c) 2014, 2015 Institute for Software, HSR Hochschule fuer Technik and others
* Rapperswil, University of applied sciences.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -11,19 +11,20 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
-import org.eclipse.cdt.core.dom.parser.cpp.ICPPASTAttributeSpecifier;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTAttributeList;
+import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeList;
/**
- * Represents a C++ attribute specifier, containing attributes.
+ * Represents a C++ attribute list, containing attributes.
*/
-public class CPPASTAttributeSpecifier extends ASTAttributeSpecifier implements ICPPASTAttributeSpecifier {
+public class CPPASTAttributeList extends ASTAttributeList implements ICPPASTAttributeList {
@Override
- public CPPASTAttributeSpecifier copy(CopyStyle style) {
- return copy(new CPPASTAttributeSpecifier(), style);
+ public CPPASTAttributeList copy(CopyStyle style) {
+ return copy(new CPPASTAttributeList(), style);
}
@Override
- public CPPASTAttributeSpecifier copy() {
+ public CPPASTAttributeList copy() {
return copy(CopyStyle.withoutLocations);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAttributeOwner.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAttributeOwner.java
new file mode 100644
index 00000000000..798e33aa73a
--- /dev/null
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTAttributeOwner.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Nathan Ridge.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.internal.core.dom.parser.cpp;
+
+import org.eclipse.cdt.core.dom.ast.IASTNode;
+import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
+
+import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
+
+/**
+ * C++ attribute owners.
+ *
+ * These implement IASTAmbiguityParent because in C++ an attribute-specifier
+ * can be an alignment-specifier, and an alignment-specifier can be an
+ * ambiguous node.
+ */
+public abstract class CPPASTAttributeOwner extends ASTAttributeOwner implements IASTAmbiguityParent {
+ @Override
+ public void replace(IASTNode child, IASTNode other) {
+ super.replace(child, other);
+ }
+} \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBaseDeclSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBaseDeclSpecifier.java
index e311d9f27c9..5bcbc248b50 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBaseDeclSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBaseDeclSpecifier.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2014 IBM Corporation and others.
+ * Copyright (c) 2004, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,19 +11,14 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
-import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTAlignmentSpecifier;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
-import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
-import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
import org.eclipse.cdt.internal.core.model.ASTStringUtil;
/**
* Base for all c++ declaration specifiers.
*/
-public abstract class CPPASTBaseDeclSpecifier extends ASTAttributeOwner
- implements ICPPASTDeclSpecifier, IASTAmbiguityParent {
+public abstract class CPPASTBaseDeclSpecifier extends CPPASTAttributeOwner implements ICPPASTDeclSpecifier {
private boolean explicit;
private boolean friend;
private boolean inline;
@@ -34,8 +29,6 @@ public abstract class CPPASTBaseDeclSpecifier extends ASTAttributeOwner
private boolean isVolatile;
private int sc;
private boolean virtual;
- private IASTAlignmentSpecifier[] alignmentSpecifiers =
- IASTAlignmentSpecifier.EMPTY_ALIGNMENT_SPECIFIER_ARRAY;
@Override
public boolean isFriend() {
@@ -147,19 +140,15 @@ public abstract class CPPASTBaseDeclSpecifier extends ASTAttributeOwner
this.explicit = value;
}
+ @Deprecated
@Override
public IASTAlignmentSpecifier[] getAlignmentSpecifiers() {
- return alignmentSpecifiers;
+ return null;
}
+ @Deprecated
@Override
public void setAlignmentSpecifiers(IASTAlignmentSpecifier[] alignmentSpecifiers) {
- assertNotFrozen();
- for (IASTAlignmentSpecifier specifier : alignmentSpecifiers) {
- specifier.setParent(this);
- specifier.setPropertyInParent(ALIGNMENT_SPECIFIER);
- }
- this.alignmentSpecifiers = alignmentSpecifiers;
}
protected <T extends CPPASTBaseDeclSpecifier> T copy(T copy, CopyStyle style) {
@@ -174,11 +163,6 @@ public abstract class CPPASTBaseDeclSpecifier extends ASTAttributeOwner
target.isVolatile = isVolatile;
target.sc = sc;
target.virtual = virtual;
- target.alignmentSpecifiers = new IASTAlignmentSpecifier[alignmentSpecifiers.length];
- for (int i = 0; i < alignmentSpecifiers.length; ++i) {
- target.alignmentSpecifiers[i] = alignmentSpecifiers[i].copy(style);
- target.alignmentSpecifiers[i].setParent(target);
- }
return super.copy(copy, style);
}
@@ -189,27 +173,4 @@ public abstract class CPPASTBaseDeclSpecifier extends ASTAttributeOwner
public String toString() {
return ASTStringUtil.getSignatureString(this, null);
}
-
- protected boolean visitAlignmentSpecifiers(ASTVisitor visitor) {
- for (IASTAlignmentSpecifier specifier : alignmentSpecifiers) {
- if (!specifier.accept(visitor)) {
- return false;
- }
- }
- return true;
- }
-
- @Override
- public void replace(IASTNode child, IASTNode other) {
- if (child instanceof IASTAlignmentSpecifier && other instanceof IASTAlignmentSpecifier) {
- for (int i = 0; i < alignmentSpecifiers.length; ++i) {
- if (alignmentSpecifiers[i] == child) {
- alignmentSpecifiers[i] = (IASTAlignmentSpecifier) other;
- other.setParent(child.getParent());
- other.setPropertyInParent(child.getPropertyInParent());
- return;
- }
- }
- }
- }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBreakStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBreakStatement.java
index c99060b0d10..61f84556c88 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBreakStatement.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBreakStatement.java
@@ -13,12 +13,11 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTBreakStatement;
-import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
/**
* @author jcamelon
*/
-public class CPPASTBreakStatement extends ASTAttributeOwner implements IASTBreakStatement {
+public class CPPASTBreakStatement extends CPPASTAttributeOwner implements IASTBreakStatement {
@Override
public boolean accept(ASTVisitor action) {
if (action.shouldVisitStatements) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCaseStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCaseStatement.java
index f91bb853519..7a3e52f27bd 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCaseStatement.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCaseStatement.java
@@ -15,14 +15,11 @@ import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTCaseStatement;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTNode;
-import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
-import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
/**
* @author jcamelon
*/
-public class CPPASTCaseStatement extends ASTAttributeOwner
- implements IASTCaseStatement, IASTAmbiguityParent {
+public class CPPASTCaseStatement extends CPPASTAttributeOwner implements IASTCaseStatement {
private IASTExpression expression;
public CPPASTCaseStatement() {
@@ -88,6 +85,8 @@ public class CPPASTCaseStatement extends ASTAttributeOwner
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
expression = (IASTExpression) other;
+ return;
}
+ super.replace(child, other);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCatchHandler.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCatchHandler.java
index c472a6ab164..089efaa4e90 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCatchHandler.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCatchHandler.java
@@ -19,15 +19,12 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTStatement;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler;
-import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
-import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.DestructorCallCollector;
/**
* @author jcamelon
*/
-public class CPPASTCatchHandler extends ASTAttributeOwner
- implements ICPPASTCatchHandler, IASTAmbiguityParent {
+public class CPPASTCatchHandler extends CPPASTAttributeOwner implements ICPPASTCatchHandler {
private boolean fIsCatchAll;
private IASTStatement fBody;
private IASTDeclaration fDeclaration;
@@ -139,12 +136,15 @@ public class CPPASTCatchHandler extends ASTAttributeOwner
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
fBody = (IASTStatement) other;
+ return;
}
if (fDeclaration == child) {
other.setParent(child.getParent());
other.setPropertyInParent(child.getPropertyInParent());
fDeclaration = (IASTDeclaration) other;
+ return;
}
+ super.replace(child, other);
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCompositeTypeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCompositeTypeSpecifier.java
index ae5aeb0f94e..1dd3b9b7a20 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCompositeTypeSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCompositeTypeSpecifier.java
@@ -182,10 +182,6 @@ public class CPPASTCompositeTypeSpecifier extends CPPASTBaseDeclSpecifier
if (!acceptByAttributeSpecifiers(action))
return false;
- if (!visitAlignmentSpecifiers(action)) {
- return false;
- }
-
if (fName != null && !fName.accept(action))
return false;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCompoundStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCompoundStatement.java
index a27438a1c6e..0e0c620f32d 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCompoundStatement.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCompoundStatement.java
@@ -19,15 +19,12 @@ import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompoundStatement;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
-import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
-import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.DestructorCallCollector;
/**
* @author jcamelon
*/
-public class CPPASTCompoundStatement extends ASTAttributeOwner
- implements ICPPASTCompoundStatement, IASTAmbiguityParent {
+public class CPPASTCompoundStatement extends CPPASTAttributeOwner implements ICPPASTCompoundStatement {
private IASTStatement[] statements = new IASTStatement[2];
private ICPPScope scope;
private IASTImplicitDestructorName[] fImplicitDestructorNames;
@@ -118,7 +115,9 @@ public class CPPASTCompoundStatement extends ASTAttributeOwner
other.setParent(statements[i].getParent());
other.setPropertyInParent(statements[i].getPropertyInParent());
statements[i] = (IASTStatement) other;
+ return;
}
}
+ super.replace(child, other);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTContinueStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTContinueStatement.java
index b12b367a79a..6be87e15ac2 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTContinueStatement.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTContinueStatement.java
@@ -13,12 +13,11 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTContinueStatement;
-import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
/**
* @author jcamelon
*/
-public class CPPASTContinueStatement extends ASTAttributeOwner implements IASTContinueStatement {
+public class CPPASTContinueStatement extends CPPASTAttributeOwner implements IASTContinueStatement {
@Override
public boolean accept(ASTVisitor action) {
if (action.shouldVisitStatements) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDeclarator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDeclarator.java
index 26d224a6c42..c476c1e6b23 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDeclarator.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDeclarator.java
@@ -34,18 +34,16 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLinkageSpecification;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
-import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
-import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
/**
* C++ specific declarator.
*/
-public class CPPASTDeclarator extends ASTAttributeOwner implements ICPPASTDeclarator, IASTImplicitNameOwner,
- IASTAmbiguityParent {
+public class CPPASTDeclarator extends CPPASTAttributeOwner implements ICPPASTDeclarator,
+ IASTImplicitNameOwner {
private IASTInitializer initializer;
private IASTName name;
private IASTImplicitName[] implicitNames;
@@ -301,6 +299,8 @@ public class CPPASTDeclarator extends ASTAttributeOwner implements ICPPASTDeclar
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
nested= (IASTDeclarator) other;
+ return;
}
+ super.replace(child, other);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDefaultStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDefaultStatement.java
index 577ab6bdd17..551acd6e9f3 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDefaultStatement.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDefaultStatement.java
@@ -13,12 +13,11 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTDefaultStatement;
-import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
/**
* @author jcamelon
*/
-public class CPPASTDefaultStatement extends ASTAttributeOwner implements IASTDefaultStatement {
+public class CPPASTDefaultStatement extends CPPASTAttributeOwner implements IASTDefaultStatement {
@Override
public boolean accept(ASTVisitor action) {
if (action.shouldVisitStatements) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDoStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDoStatement.java
index 41a448ebbf5..edd31767d10 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDoStatement.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTDoStatement.java
@@ -16,14 +16,11 @@ import org.eclipse.cdt.core.dom.ast.IASTDoStatement;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTStatement;
-import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
-import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
/**
* @author jcamelon
*/
-public class CPPASTDoStatement extends ASTAttributeOwner
- implements IASTDoStatement, IASTAmbiguityParent {
+public class CPPASTDoStatement extends CPPASTAttributeOwner implements IASTDoStatement {
private IASTStatement body;
private IASTExpression condition;
@@ -108,11 +105,14 @@ public class CPPASTDoStatement extends ASTAttributeOwner
other.setPropertyInParent(body.getPropertyInParent());
other.setParent(body.getParent());
body = (IASTStatement) other;
+ return;
}
if (child == condition) {
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
condition = (IASTExpression) other;
+ return;
}
+ super.replace(child, other);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTElaboratedTypeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTElaboratedTypeSpecifier.java
index 3b0c55c4f66..1af08592879 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTElaboratedTypeSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTElaboratedTypeSpecifier.java
@@ -90,10 +90,6 @@ public class CPPASTElaboratedTypeSpecifier extends CPPASTBaseDeclSpecifier
if (!acceptByAttributeSpecifiers(action))
return false;
- if (!visitAlignmentSpecifiers(action)) {
- return false;
- }
-
if (name != null) if (!name.accept(action)) return false;
if (action.shouldVisitDeclSpecifiers) {
switch (action.leave(this)) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTEnumerationSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTEnumerationSpecifier.java
index 7279b8c03c0..2793df0597e 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTEnumerationSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTEnumerationSpecifier.java
@@ -135,10 +135,6 @@ public class CPPASTEnumerationSpecifier extends CPPASTBaseDeclSpecifier
if (!acceptByAttributeSpecifiers(action))
return false;
- if (!visitAlignmentSpecifiers(action)) {
- return false;
- }
-
for (IASTEnumerator e : getEnumerators()) {
if (!e.accept(action))
return false;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTExpressionStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTExpressionStatement.java
index aadb3f23747..0850f4bec38 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTExpressionStatement.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTExpressionStatement.java
@@ -15,14 +15,11 @@ import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement;
import org.eclipse.cdt.core.dom.ast.IASTNode;
-import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
-import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
/**
* @author jcamelon
*/
-public class CPPASTExpressionStatement extends ASTAttributeOwner
- implements IASTExpressionStatement, IASTAmbiguityParent {
+public class CPPASTExpressionStatement extends CPPASTAttributeOwner implements IASTExpressionStatement {
private IASTExpression expression;
public CPPASTExpressionStatement() {
@@ -88,6 +85,8 @@ public class CPPASTExpressionStatement extends ASTAttributeOwner
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
expression = (IASTExpression) other;
+ return;
}
+ super.replace(child, other);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTForStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTForStatement.java
index 22b7dbe2ccb..0a0c2c07888 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTForStatement.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTForStatement.java
@@ -22,14 +22,12 @@ import org.eclipse.cdt.core.dom.ast.IASTStatement;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTForStatement;
import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
-import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.DestructorCallCollector;
/**
* For statement in C++
*/
-public class CPPASTForStatement extends ASTAttributeOwner
- implements ICPPASTForStatement, IASTAmbiguityParent {
+public class CPPASTForStatement extends CPPASTAttributeOwner implements ICPPASTForStatement {
private IScope fScope;
private IASTStatement fInit;
@@ -173,21 +171,26 @@ public class CPPASTForStatement extends ASTAttributeOwner
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
fBody = (IASTStatement) other;
+ return;
} else if (child == fCondition || child == fCondDeclaration) {
if (other instanceof IASTExpression) {
setConditionExpression((IASTExpression) other);
} else if (other instanceof IASTDeclaration) {
setConditionDeclaration((IASTDeclaration) other);
}
+ return;
} else if (child == fIterationExpression) {
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
fIterationExpression = (IASTExpression) other;
+ return;
} else if (child == fInit) {
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
fInit = (IASTStatement) other;
+ return;
}
+ super.replace(child, other);
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionDefinition.java
index 42e713a2ff3..3bedfec7f90 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionDefinition.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionDefinition.java
@@ -34,17 +34,15 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
-import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
-import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
/**
* Models a function definition without a try-block. If used for a constructor definition
* it may contain member initializers.
*/
-public class CPPASTFunctionDefinition extends ASTAttributeOwner
- implements ICPPASTFunctionDefinition, IASTAmbiguityParent, IASTImplicitNameOwner {
+public class CPPASTFunctionDefinition extends CPPASTAttributeOwner
+ implements ICPPASTFunctionDefinition, IASTImplicitNameOwner {
private IASTDeclSpecifier declSpecifier;
private IASTFunctionDeclarator declarator;
private IASTStatement bodyStatement;
@@ -245,7 +243,9 @@ public class CPPASTFunctionDefinition extends ASTAttributeOwner
other.setPropertyInParent(bodyStatement.getPropertyInParent());
other.setParent(bodyStatement.getParent());
bodyStatement = (IASTStatement) other;
+ return;
}
+ super.replace(child, other);
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTGotoStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTGotoStatement.java
index 6390c16088c..d2a4183f87c 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTGotoStatement.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTGotoStatement.java
@@ -14,12 +14,11 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTGotoStatement;
import org.eclipse.cdt.core.dom.ast.IASTName;
-import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
/**
* @author jcamelon
*/
-public class CPPASTGotoStatement extends ASTAttributeOwner implements IASTGotoStatement {
+public class CPPASTGotoStatement extends CPPASTAttributeOwner implements IASTGotoStatement {
private IASTName name;
public CPPASTGotoStatement() {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTIfStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTIfStatement.java
index be2a9b84d69..0e305129a97 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTIfStatement.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTIfStatement.java
@@ -20,13 +20,11 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTStatement;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTIfStatement;
-import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
-import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
/**
* If statement in C++
*/
-public class CPPASTIfStatement extends ASTAttributeOwner implements ICPPASTIfStatement, IASTAmbiguityParent {
+public class CPPASTIfStatement extends CPPASTAttributeOwner implements ICPPASTIfStatement {
private IASTExpression condition;
private IASTStatement thenClause;
private IASTStatement elseClause;
@@ -177,17 +175,21 @@ public class CPPASTIfStatement extends ASTAttributeOwner implements ICPPASTIfSta
other.setParent(child.getParent());
other.setPropertyInParent(child.getPropertyInParent());
thenClause = (IASTStatement) other;
+ return;
} else if (elseClause == child) {
other.setParent(child.getParent());
other.setPropertyInParent(child.getPropertyInParent());
elseClause = (IASTStatement) other;
+ return;
} else if (condition == child || condDecl == child) {
if (other instanceof IASTExpression) {
setConditionExpression((IASTExpression) other);
} else if (other instanceof IASTDeclaration) {
setConditionDeclaration((IASTDeclaration) other);
}
+ return;
}
+ super.replace(child, other);
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLabelStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLabelStatement.java
index 44fa46242d3..85f021cbc05 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLabelStatement.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLabelStatement.java
@@ -16,14 +16,11 @@ import org.eclipse.cdt.core.dom.ast.IASTLabelStatement;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTStatement;
-import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
-import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
/**
* @author jcamelon
*/
-public class CPPASTLabelStatement extends ASTAttributeOwner
- implements IASTLabelStatement, IASTAmbiguityParent {
+public class CPPASTLabelStatement extends CPPASTAttributeOwner implements IASTLabelStatement {
private IASTName name;
private IASTStatement nestedStatement;
@@ -114,6 +111,8 @@ public class CPPASTLabelStatement extends ASTAttributeOwner
other.setParent(this);
other.setPropertyInParent(child.getPropertyInParent());
setNestedStatement((IASTStatement) other);
+ return;
}
+ super.replace(child, other);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamedTypeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamedTypeSpecifier.java
index 898ee71ea3f..ff6fb8ed232 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamedTypeSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamedTypeSpecifier.java
@@ -90,10 +90,6 @@ public class CPPASTNamedTypeSpecifier extends CPPASTBaseDeclSpecifier
}
}
- if (!visitAlignmentSpecifiers(action)) {
- return false;
- }
-
if (name != null && !name.accept(action))
return false;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamespaceDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamespaceDefinition.java
index 9351d974472..7e11f4daf04 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamespaceDefinition.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamespaceDefinition.java
@@ -20,15 +20,12 @@ import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
-import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
-import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
/**
* Definition of a namespace.
*/
-public class CPPASTNamespaceDefinition extends ASTAttributeOwner
- implements ICPPASTNamespaceDefinition, IASTAmbiguityParent {
+public class CPPASTNamespaceDefinition extends CPPASTAttributeOwner implements ICPPASTNamespaceDefinition {
private IASTName fName;
private IASTDeclaration[] fAllDeclarations;
private IASTDeclaration[] fActiveDeclarations;
@@ -162,8 +159,9 @@ public class CPPASTNamespaceDefinition extends ASTAttributeOwner
other.setPropertyInParent(child.getPropertyInParent());
fAllDeclarations[i] = (IASTDeclaration) other;
fActiveDeclarations= null;
- break;
+ return;
}
}
+ super.replace(child, other);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNullStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNullStatement.java
index 609dc66b24c..e07b5d498f0 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNullStatement.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNullStatement.java
@@ -13,12 +13,11 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTNullStatement;
-import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
/**
* @author jcamelon
*/
-public class CPPASTNullStatement extends ASTAttributeOwner implements IASTNullStatement {
+public class CPPASTNullStatement extends CPPASTAttributeOwner implements IASTNullStatement {
@Override
public boolean accept(ASTVisitor action) {
if (action.shouldVisitStatements) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTPointer.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTPointer.java
index 1cfe697c443..23b203657bd 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTPointer.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTPointer.java
@@ -14,12 +14,11 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTPointer;
-import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
/**
* A pointer operator of a declarator
*/
-public class CPPASTPointer extends ASTAttributeOwner implements IASTPointer {
+public class CPPASTPointer extends CPPASTAttributeOwner implements IASTPointer {
private boolean isConst;
private boolean isVolatile;
private boolean isRestrict;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTRangeBasedForStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTRangeBasedForStatement.java
index bb55e2756c6..03267bde525 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTRangeBasedForStatement.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTRangeBasedForStatement.java
@@ -27,9 +27,7 @@ import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTRangeBasedForStatement;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
-import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
-import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.DestructorCallCollector;
@@ -38,8 +36,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
/**
* Range based 'for' loop in C++.
*/
-public class CPPASTRangeBasedForStatement extends ASTAttributeOwner
- implements ICPPASTRangeBasedForStatement, IASTAmbiguityParent {
+public class CPPASTRangeBasedForStatement extends CPPASTAttributeOwner implements ICPPASTRangeBasedForStatement {
private IScope fScope;
private IASTDeclaration fDeclaration;
private IASTInitializerClause fInitClause;
@@ -223,10 +220,14 @@ public class CPPASTRangeBasedForStatement extends ASTAttributeOwner
public void replace(IASTNode child, IASTNode other) {
if (child == fDeclaration) {
setDeclaration((IASTDeclaration) other);
+ return;
} else if (child == fInitClause) {
setInitializerClause((IASTInitializerClause) other);
+ return;
} else if (child == fBody) {
setBody((IASTStatement) other);
+ return;
}
+ super.replace(child, other);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTReferenceOperator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTReferenceOperator.java
index 41a5a85abc8..4261e1d8452 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTReferenceOperator.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTReferenceOperator.java
@@ -14,12 +14,11 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTReferenceOperator;
-import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
/**
* Reference operator for declarators.
*/
-public class CPPASTReferenceOperator extends ASTAttributeOwner implements ICPPASTReferenceOperator {
+public class CPPASTReferenceOperator extends CPPASTAttributeOwner implements ICPPASTReferenceOperator {
private final boolean fIsRValue;
public CPPASTReferenceOperator(boolean isRValueReference) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTReturnStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTReturnStatement.java
index d6f69743a83..1853c5e9846 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTReturnStatement.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTReturnStatement.java
@@ -17,10 +17,8 @@ import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTInitializerClause;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTReturnStatement;
-import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
-import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
-public class CPPASTReturnStatement extends ASTAttributeOwner implements IASTReturnStatement, IASTAmbiguityParent {
+public class CPPASTReturnStatement extends CPPASTAttributeOwner implements IASTReturnStatement {
private IASTInitializerClause retValue;
public CPPASTReturnStatement() {
@@ -99,6 +97,8 @@ public class CPPASTReturnStatement extends ASTAttributeOwner implements IASTRetu
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
retValue = (IASTInitializerClause) other;
+ return;
}
+ super.replace(child, other);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleDeclSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleDeclSpecifier.java
index 6a440ccbeac..c13c61d6518 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleDeclSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleDeclSpecifier.java
@@ -222,10 +222,6 @@ public class CPPASTSimpleDeclSpecifier extends CPPASTBaseDeclSpecifier
if (!acceptByAttributeSpecifiers(action))
return false;
- if (!visitAlignmentSpecifiers(action)) {
- return false;
- }
-
if (action.shouldVisitDeclSpecifiers) {
switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleDeclaration.java
index f7accec5e2a..d7b3b4824cb 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleDeclaration.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleDeclaration.java
@@ -18,14 +18,11 @@ import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
-import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
-import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
/**
* @author jcamelon
*/
-public class CPPASTSimpleDeclaration extends ASTAttributeOwner
- implements IASTSimpleDeclaration, IASTAmbiguityParent {
+public class CPPASTSimpleDeclaration extends CPPASTAttributeOwner implements IASTSimpleDeclaration {
private IASTDeclarator[] declarators;
private int declaratorsPos = -1;
private IASTDeclSpecifier declSpecifier;
@@ -124,8 +121,9 @@ public class CPPASTSimpleDeclaration extends ASTAttributeOwner
declarators[i] = (IASTDeclarator) other;
other.setParent(child.getParent());
other.setPropertyInParent(child.getPropertyInParent());
- break;
+ return;
}
}
+ super.replace(child, other);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSwitchStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSwitchStatement.java
index 8cbfa7d9c81..6f8bf75eb9e 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSwitchStatement.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSwitchStatement.java
@@ -19,14 +19,11 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTStatement;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSwitchStatement;
-import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
-import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
/**
* Switch statement in C++.
*/
-public class CPPASTSwitchStatement extends ASTAttributeOwner
- implements ICPPASTSwitchStatement, IASTAmbiguityParent {
+public class CPPASTSwitchStatement extends CPPASTAttributeOwner implements ICPPASTSwitchStatement {
private IScope scope;
private IASTExpression controllerExpression;
private IASTDeclaration controllerDeclaration;
@@ -123,13 +120,16 @@ public class CPPASTSwitchStatement extends ASTAttributeOwner
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
body = (IASTStatement) other;
+ return;
} else if (controllerDeclaration == child || controllerExpression == child) {
if (other instanceof IASTExpression) {
setControllerExpression((IASTExpression) other);
} else if (other instanceof IASTDeclaration) {
setControllerDeclaration((IASTDeclaration) other);
}
+ return;
}
+ super.replace(child, other);
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTryBlockStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTryBlockStatement.java
index 52161253110..d602301c8a1 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTryBlockStatement.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTryBlockStatement.java
@@ -18,13 +18,11 @@ import org.eclipse.cdt.core.dom.ast.IASTStatement;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTryBlockStatement;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
-import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
-import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
/**
* @author jcamelon
*/
-public class CPPASTTryBlockStatement extends ASTAttributeOwner implements ICPPASTTryBlockStatement, IASTAmbiguityParent {
+public class CPPASTTryBlockStatement extends CPPASTAttributeOwner implements ICPPASTTryBlockStatement {
private ICPPASTCatchHandler[] catchHandlers;
private int catchHandlersPos= -1;
private IASTStatement tryBody;
@@ -119,6 +117,8 @@ public class CPPASTTryBlockStatement extends ASTAttributeOwner implements ICPPAS
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
tryBody = (IASTStatement) other;
+ return;
}
+ super.replace(child, other);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypeTransformationSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypeTransformationSpecifier.java
index 74a9def5ff7..57c52c766e7 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypeTransformationSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypeTransformationSpecifier.java
@@ -61,10 +61,6 @@ public class CPPASTTypeTransformationSpecifier extends CPPASTBaseDeclSpecifier i
}
}
- if (!visitAlignmentSpecifiers(action)) {
- return false;
- }
-
if (!fOperand.accept(action))
return false;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUsingDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUsingDeclaration.java
index 766fecd6e46..192855c6e7b 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUsingDeclaration.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUsingDeclaration.java
@@ -22,10 +22,9 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.ICPPASTCompletionContext;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDeclaration;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
-import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
-public class CPPASTUsingDeclaration extends ASTAttributeOwner
+public class CPPASTUsingDeclaration extends CPPASTAttributeOwner
implements ICPPASTUsingDeclaration, ICPPASTCompletionContext {
private boolean typeName;
private IASTName name;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUsingDirective.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUsingDirective.java
index e9e2af5e526..80fd73d1d10 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUsingDirective.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUsingDirective.java
@@ -22,10 +22,9 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.ICPPASTCompletionContext;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDirective;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
-import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
-public class CPPASTUsingDirective extends ASTAttributeOwner
+public class CPPASTUsingDirective extends CPPASTAttributeOwner
implements ICPPASTUsingDirective, ICPPASTCompletionContext {
private IASTName name;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTWhileStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTWhileStatement.java
index b36354efe4a..f8170425a38 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTWhileStatement.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTWhileStatement.java
@@ -19,14 +19,11 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTStatement;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTWhileStatement;
-import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
-import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
/**
* While statement in C++.
*/
-public class CPPASTWhileStatement extends ASTAttributeOwner
- implements ICPPASTWhileStatement, IASTAmbiguityParent {
+public class CPPASTWhileStatement extends CPPASTAttributeOwner implements ICPPASTWhileStatement {
private IASTExpression condition;
private IASTDeclaration condition2;
private IASTStatement body;
@@ -136,6 +133,7 @@ public class CPPASTWhileStatement extends ASTAttributeOwner
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
body = (IASTStatement) other;
+ return;
}
if (child == condition || child == condition2) {
if (other instanceof IASTExpression) {
@@ -143,7 +141,9 @@ public class CPPASTWhileStatement extends ASTAttributeOwner
} else if (other instanceof IASTDeclaration) {
setConditionDeclaration((IASTDeclaration) other);
}
+ return;
}
+ super.replace(child, other);
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPNodeFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPNodeFactory.java
index 21e432ae0f9..ed8d623858e 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPNodeFactory.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPNodeFactory.java
@@ -59,6 +59,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTArrayDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTArrayDesignator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTArraySubscriptExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTAttribute;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTAttributeList;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTBinaryExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCapture;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCastExpression;
@@ -129,14 +130,12 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisibilityLabel;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTWhileStatement;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNodeFactory;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUnaryTypeTransformation;
-import org.eclipse.cdt.core.dom.ast.gnu.IGCCASTAttributeSpecifier;
import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTCompoundStatementExpression;
import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPASTArrayRangeDesignator;
import org.eclipse.cdt.core.dom.parser.cpp.ICPPASTAttributeSpecifier;
import org.eclipse.cdt.core.parser.IScanner;
import org.eclipse.cdt.internal.core.dom.parser.ASTToken;
import org.eclipse.cdt.internal.core.dom.parser.ASTTokenList;
-import org.eclipse.cdt.internal.core.dom.parser.GCCASTAttributeSpecifier;
import org.eclipse.cdt.internal.core.dom.parser.NodeFactory;
import org.eclipse.cdt.internal.core.parser.scanner.CPreprocessor;
@@ -211,9 +210,15 @@ public class CPPNodeFactory extends NodeFactory implements ICPPNodeFactory {
return new CPPASTAttribute(name, scope, argumentClause, packExpansion);
}
+ @Deprecated
@Override
public ICPPASTAttributeSpecifier newAttributeSpecifier() {
- return new CPPASTAttributeSpecifier();
+ return new CPPASTAttributeList();
+ }
+
+ @Override
+ public ICPPASTAttributeList newAttributeList() {
+ return new CPPASTAttributeList();
}
@Override
@@ -470,11 +475,6 @@ public class CPPNodeFactory extends NodeFactory implements ICPPNodeFactory {
}
@Override
- public IGCCASTAttributeSpecifier newGCCAttributeSpecifier() {
- return new GCCASTAttributeSpecifier();
- }
-
- @Override
public IGNUASTCompoundStatementExpression newGNUCompoundStatementExpression(IASTCompoundStatement compoundStatement) {
return new CPPASTCompoundStatementExpression(compoundStatement);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPASTGotoStatement.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPASTGotoStatement.java
index f2af1111b41..64f66e1fe1c 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPASTGotoStatement.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPASTGotoStatement.java
@@ -14,7 +14,6 @@ import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTGotoStatement;
-import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
/**
* GNU C++ goto statement.
@@ -27,7 +26,7 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
*
* @since 5.8
*/
-public class GNUCPPASTGotoStatement extends ASTAttributeOwner implements IGNUASTGotoStatement {
+public class GNUCPPASTGotoStatement extends CPPASTAttributeOwner implements IGNUASTGotoStatement {
private IASTExpression expression;
public GNUCPPASTGotoStatement() {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
index fef41cd82b4..88bfba0f6d2 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
@@ -73,10 +73,12 @@ import org.eclipse.cdt.core.dom.ast.IASTWhileStatement;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTAliasDeclaration;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTAlignmentSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTAmbiguousTemplateArgument;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTArrayDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTArrayDesignator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTAttribute;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTAttributeList;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCapture;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCastExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler;
@@ -147,7 +149,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPNodeFactory;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUnaryTypeTransformation;
import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPASTArrayRangeDesignator;
import org.eclipse.cdt.core.dom.parser.IExtensionToken;
-import org.eclipse.cdt.core.dom.parser.cpp.ICPPASTAttributeSpecifier;
import org.eclipse.cdt.core.dom.parser.cpp.ICPPParserExtensionConfiguration;
import org.eclipse.cdt.core.index.IIndex;
import org.eclipse.cdt.core.parser.EndOfFileException;
@@ -2577,23 +2578,28 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
BacktrackException {
List<IASTAttributeSpecifier> specifiers = null;
- while (LTcatchEOF(1) == IToken.tLBRACKET && LTcatchEOF(2) == IToken.tLBRACKET) {
+ while ((LTcatchEOF(1) == IToken.tLBRACKET && LTcatchEOF(2) == IToken.tLBRACKET) ||
+ LTcatchEOF(1) == IToken.t_alignas) {
if (specifiers == null)
specifiers = new ArrayList<>();
- int offset = consumeOrEOC(IToken.tLBRACKET).getOffset();
- consumeOrEOC(IToken.tLBRACKET);
- ICPPASTAttributeSpecifier attributeSpecifier = getNodeFactory().newAttributeSpecifier();
- while (LT(1) != IToken.tRBRACKET) {
- if (LT(1) == IToken.tCOMMA)
- consume();
- ICPPASTAttribute attribute = singleAttribute();
- attributeSpecifier.addAttribute(attribute);
-
+ if (LTcatchEOF(1) == IToken.t_alignas) {
+ specifiers.add((ICPPASTAlignmentSpecifier) alignmentSpecifier());
+ } else {
+ int offset = consumeOrEOC(IToken.tLBRACKET).getOffset();
+ consumeOrEOC(IToken.tLBRACKET);
+ ICPPASTAttributeList attributeList = getNodeFactory().newAttributeList();
+ while (LT(1) != IToken.tRBRACKET) {
+ if (LT(1) == IToken.tCOMMA)
+ consume();
+ ICPPASTAttribute attribute = singleAttribute();
+ attributeList.addAttribute(attribute);
+
+ }
+ consumeOrEOC(IToken.tRBRACKET);
+ int endOffset = consumeOrEOC(IToken.tRBRACKET).getEndOffset();
+ setRange(attributeList, offset, endOffset);
+ specifiers.add(attributeList);
}
- consumeOrEOC(IToken.tRBRACKET);
- int endOffset = consumeOrEOC(IToken.tRBRACKET).getEndOffset();
- setRange(attributeSpecifier, offset, endOffset);
- specifiers.add(attributeSpecifier);
}
return specifiers;
}
@@ -2970,7 +2976,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
ICPPASTDeclSpecifier result= null;
ICPPASTDeclSpecifier altResult= null;
List<IASTAttributeSpecifier> attributes = null;
- IASTAlignmentSpecifier[] alignmentSpecifiers = IASTAlignmentSpecifier.EMPTY_ALIGNMENT_SPECIFIER_ARRAY;
try {
IASTName identifier= null;
IASTExpression typeofExpression= null;
@@ -3259,10 +3264,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
encounteredTypename= true;
break;
- case IToken.t_alignas:
- alignmentSpecifiers = ArrayUtil.append(alignmentSpecifiers, alignmentSpecifier());
- break;
-
case IGCCToken.t__attribute__: // if __attribute__ is after the declSpec
if (!supportAttributeSpecifiers)
throwBacktrack(LA(1));
@@ -3362,7 +3363,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
result= buildSimpleDeclSpec(storageClass, simpleType, options, isLong, typeofExpression, offset, endOffset);
}
addAttributeSpecifiers(attributes, result);
- result.setAlignmentSpecifiers(ArrayUtil.trim(alignmentSpecifiers));
} catch (BacktrackException e) {
if (returnToken != null) {
backup(returnToken);
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/AttributeWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/AttributeWriter.java
index e94a4455c0e..ef1078ad754 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/AttributeWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/AttributeWriter.java
@@ -11,14 +11,16 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
+import org.eclipse.cdt.core.dom.ast.IASTAlignmentSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTAttribute;
import org.eclipse.cdt.core.dom.ast.IASTAttributeSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTToken;
import org.eclipse.cdt.core.dom.ast.IASTTokenList;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTAttribute;
-import org.eclipse.cdt.core.dom.ast.gnu.IGCCASTAttributeSpecifier;
-import org.eclipse.cdt.core.dom.parser.cpp.ICPPASTAttributeSpecifier;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTAttributeList;
+import org.eclipse.cdt.core.dom.ast.gnu.IGCCASTAttributeList;
import org.eclipse.cdt.core.parser.GCCKeywords;
+import org.eclipse.cdt.core.parser.Keywords;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTAttribute;
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
@@ -36,14 +38,27 @@ public class AttributeWriter extends NodeWriter {
}
public void writeAttributeSpecifier(IASTAttributeSpecifier attribute) {
- if (attribute instanceof ICPPASTAttributeSpecifier) {
- writeAttributeSpecifier((ICPPASTAttributeSpecifier) attribute);
- } else if (attribute instanceof IGCCASTAttributeSpecifier) {
- writeGCCAttributeSpecifier((IGCCASTAttributeSpecifier) attribute);
+ if (attribute instanceof ICPPASTAttributeList) {
+ writeAttributeSpecifier((ICPPASTAttributeList) attribute);
+ } else if (attribute instanceof IGCCASTAttributeList) {
+ writeGCCAttributeSpecifier((IGCCASTAttributeList) attribute);
+ } else if (attribute instanceof IASTAlignmentSpecifier) {
+ writeAlignmentSpecifier((IASTAlignmentSpecifier) attribute);
}
}
+
+ private void writeAlignmentSpecifier(IASTAlignmentSpecifier specifier) {
+ scribe.print(Keywords.ALIGNAS);
+ scribe.print(OPENING_PARENTHESIS);
+ if (specifier.getExpression() != null) {
+ specifier.getExpression().accept(visitor);
+ } else if (specifier.getTypeId() != null) {
+ specifier.getTypeId().accept(visitor);
+ }
+ scribe.print(CLOSING_PARENTHESIS);
+ }
- private void writeGCCAttributeSpecifier(IGCCASTAttributeSpecifier specifier) {
+ private void writeGCCAttributeSpecifier(IGCCASTAttributeList specifier) {
scribe.print(GCCKeywords.__ATTRIBUTE__);
scribe.print(OPENING_PARENTHESIS);
scribe.print(OPENING_PARENTHESIS);
@@ -60,7 +75,7 @@ public class AttributeWriter extends NodeWriter {
scribe.print(CLOSING_PARENTHESIS);
}
- private void writeAttributeSpecifier(ICPPASTAttributeSpecifier specifier) {
+ private void writeAttributeSpecifier(ICPPASTAttributeList specifier) {
scribe.print(OPENING_SQUARE_BRACKET);
scribe.print(OPENING_SQUARE_BRACKET);
IASTAttribute[] innerAttributes = specifier.getAttributes();
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/NodeWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/NodeWriter.java
index c57b9f68fa5..da6fc848977 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/NodeWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/NodeWriter.java
@@ -20,7 +20,7 @@ import org.eclipse.cdt.core.dom.ast.IASTAttributeOwner;
import org.eclipse.cdt.core.dom.ast.IASTAttributeSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTComment;
import org.eclipse.cdt.core.dom.ast.IASTNode;
-import org.eclipse.cdt.core.dom.ast.gnu.IGCCASTAttributeSpecifier;
+import org.eclipse.cdt.core.dom.ast.gnu.IGCCASTAttributeList;
import org.eclipse.cdt.core.dom.parser.cpp.ICPPASTAttributeSpecifier;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
@@ -127,7 +127,7 @@ public class NodeWriter {
protected void writeGCCAttributes(IASTAttributeOwner attributeOwner, EnumSet<SpaceLocation> spaceLocations) {
IASTAttributeSpecifier[] specifiers = attributeOwner.getAttributeSpecifiers();
- IASTAttributeSpecifier[] gnuSpecifiers = ArrayUtil.filter(specifiers, IGCCASTAttributeSpecifier.TYPE_FILTER);
+ IASTAttributeSpecifier[] gnuSpecifiers = ArrayUtil.filter(specifiers, IGCCASTAttributeList.TYPE_FILTER);
writeAttributes(gnuSpecifiers, spaceLocations);
}

Back to the top