mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Bug 475739 - Treat C++ alignment-specifiers as attribute-specifiers
Change-Id: Ib8024a048073efe65c26c871bb3acd0f3bf2f620 Signed-off-by: Nathan Ridge <zeratul976@hotmail.com>
This commit is contained in:
parent
a43976b882
commit
393d36fc3e
61 changed files with 404 additions and 263 deletions
|
@ -11249,6 +11249,12 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
public void testAlignas_451082() throws Exception {
|
public void testAlignas_451082() throws Exception {
|
||||||
parseAndCheckBindings();
|
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 "" _A(unsigned long long i) { return 1; }
|
||||||
// int operator "" _B(long double d) { return 1; }
|
// int operator "" _B(long double d) { return 1; }
|
||||||
|
|
|
@ -13,7 +13,7 @@ package org.eclipse.cdt.core.dom.ast;
|
||||||
/**
|
/**
|
||||||
* Represents an alignment specifier.
|
* 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:
|
* Possible forms are:
|
||||||
* C++:
|
* C++:
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
|
@ -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
|
* Rapperswil, University of applied sciences and others
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
@ -26,12 +26,16 @@ public interface IASTAttributeSpecifier extends IASTNode {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the attributes of the specifier.
|
* Returns the attributes of the specifier.
|
||||||
|
* @deprecated Use IASTAttributeList.getAttributes() instead.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public abstract IASTAttribute[] getAttributes();
|
public abstract IASTAttribute[] getAttributes();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an attribute to the specifier.
|
* Adds an attribute to the specifier.
|
||||||
|
* @deprecated Use IASTAttributeList.addAttribute() instead.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public abstract void addAttribute(IASTAttribute attribute);
|
public abstract void addAttribute(IASTAttribute attribute);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -30,7 +30,10 @@ public interface IASTDeclSpecifier extends IASTNode {
|
||||||
/** @since 5.2 */
|
/** @since 5.2 */
|
||||||
public static final int sc_mutable = 6;
|
public static final int sc_mutable = 6;
|
||||||
|
|
||||||
/** @since 5.10 */
|
/**
|
||||||
|
* @since 5.10
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public static final ASTNodeProperty ALIGNMENT_SPECIFIER = new ASTNodeProperty(
|
public static final ASTNodeProperty ALIGNMENT_SPECIFIER = new ASTNodeProperty(
|
||||||
"IASTDeclSpecifier.ALIGNMENT_SPECIFIER - Alignment specifier"); //$NON-NLS-1$
|
"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.
|
* Get any alignment-specifiers in this decl-specifier sequence.
|
||||||
|
* @deprecated Alignment specifiers are now stored in the attribute specifier sequence.
|
||||||
* @since 5.10
|
* @since 5.10
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public IASTAlignmentSpecifier[] getAlignmentSpecifiers();
|
public IASTAlignmentSpecifier[] getAlignmentSpecifiers();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -97,8 +102,10 @@ public interface IASTDeclSpecifier extends IASTNode {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Not allowed on frozen ast.
|
* Not allowed on frozen ast.
|
||||||
|
* @deprecated Alignment specifiers are now stored in the attribute specifier sequence.
|
||||||
* @since 5.10
|
* @since 5.10
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public void setAlignmentSpecifiers(IASTAlignmentSpecifier[] alignmentSpecifiers);
|
public void setAlignmentSpecifiers(IASTAlignmentSpecifier[] alignmentSpecifiers);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
package org.eclipse.cdt.core.dom.ast;
|
package org.eclipse.cdt.core.dom.ast;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
|
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.dom.ast.gnu.IGNUASTCompoundStatementExpression;
|
||||||
import org.eclipse.cdt.core.parser.IScanner;
|
import org.eclipse.cdt.core.parser.IScanner;
|
||||||
import org.eclipse.cdt.core.parser.IToken;
|
import org.eclipse.cdt.core.parser.IToken;
|
||||||
|
@ -122,8 +122,17 @@ public interface INodeFactory {
|
||||||
public IASTFunctionDefinition newFunctionDefinition(IASTDeclSpecifier declSpecifier,
|
public IASTFunctionDefinition newFunctionDefinition(IASTDeclSpecifier declSpecifier,
|
||||||
IASTFunctionDeclarator declarator, IASTStatement bodyStatement);
|
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);
|
public IGNUASTCompoundStatementExpression newGNUCompoundStatementExpression(IASTCompoundStatement compoundStatement);
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
|
}
|
|
@ -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 {
|
||||||
|
}
|
|
@ -78,9 +78,16 @@ public interface ICPPNodeFactory extends INodeFactory {
|
||||||
public ICPPASTAttribute newAttribute(char[] name, char[] scope, IASTToken argumentClause, boolean packExpansion);
|
public ICPPASTAttribute newAttribute(char[] name, char[] scope, IASTToken argumentClause, boolean packExpansion);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @deprecated Use newAttributeList() instead.
|
||||||
* @since 5.7
|
* @since 5.7
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public ICPPASTAttributeSpecifier newAttributeSpecifier();
|
public ICPPASTAttributeSpecifier newAttributeSpecifier();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 5.12
|
||||||
|
*/
|
||||||
|
public ICPPASTAttributeList newAttributeList();
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public ICPPASTBaseSpecifier newBaseSpecifier(IASTName name, int visibility, boolean isVirtual);
|
public ICPPASTBaseSpecifier newBaseSpecifier(IASTName name, int visibility, boolean isVirtual);
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
|
@ -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
|
* Rapperswil, University of applied sciences and others
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
@ -17,10 +17,12 @@ import org.eclipse.cdt.core.parser.util.InstanceOfPredicate;
|
||||||
/**
|
/**
|
||||||
* Represents a GCC attribute specifier, introduced by __attribute__.
|
* Represents a GCC attribute specifier, introduced by __attribute__.
|
||||||
*
|
*
|
||||||
|
* @deprecated Use IGCCASTAttributeList instead.
|
||||||
* @noextend This interface is not intended to be extended by clients.
|
* @noextend This interface is not intended to be extended by clients.
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
* @since 5.7
|
* @since 5.7
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public interface IGCCASTAttributeSpecifier extends IASTAttributeSpecifier {
|
public interface IGCCASTAttributeSpecifier extends IASTAttributeSpecifier {
|
||||||
public static InstanceOfPredicate<IASTAttributeSpecifier> TYPE_FILTER =
|
public static InstanceOfPredicate<IASTAttributeSpecifier> TYPE_FILTER =
|
||||||
new InstanceOfPredicate<>(IGCCASTAttributeSpecifier.class);
|
new InstanceOfPredicate<>(IGCCASTAttributeSpecifier.class);
|
||||||
|
|
|
@ -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.
|
* Rapperswil, University of applied sciences.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
@ -9,21 +9,21 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Thomas Corbat (IFS) - Initial API and implementation
|
* 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.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTAttribute;
|
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.dom.ast.IASTAttributeSpecifier;
|
||||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
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;
|
protected IASTAttribute[] attributes = IASTAttribute.EMPTY_ATTRIBUTE_ARRAY;
|
||||||
|
|
||||||
public ASTAttributeSpecifier() {
|
public ASTAttributeList() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ public abstract class ASTAttributeSpecifier extends ASTNode implements IASTAttri
|
||||||
return true;
|
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);
|
copy.attributes = ArrayUtil.trim(attributes, true);
|
||||||
for (int i = 0; i < copy.attributes.length; i++) {
|
for (int i = 0; i < copy.attributes.length; i++) {
|
||||||
IASTAttribute attributeCopy = copy.attributes[i].copy(style);
|
IASTAttribute attributeCopy = copy.attributes[i].copy(style);
|
|
@ -12,10 +12,13 @@
|
||||||
package org.eclipse.cdt.internal.core.dom.parser;
|
package org.eclipse.cdt.internal.core.dom.parser;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
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.IASTAttribute;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTAttributeList;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTAttributeOwner;
|
import org.eclipse.cdt.core.dom.ast.IASTAttributeOwner;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTAttributeSpecifier;
|
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.dom.parser.cpp.ICPPASTAttributeSpecifier;
|
||||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||||
|
|
||||||
|
@ -29,7 +32,10 @@ public abstract class ASTAttributeOwner extends ASTNode implements IASTAttribute
|
||||||
public IASTAttribute[] getAttributes() {
|
public IASTAttribute[] getAttributes() {
|
||||||
IASTAttribute[] attributes = IASTAttribute.EMPTY_ATTRIBUTE_ARRAY;
|
IASTAttribute[] attributes = IASTAttribute.EMPTY_ATTRIBUTE_ARRAY;
|
||||||
for (IASTAttributeSpecifier attributeSpecifier : getAttributeSpecifiers()) {
|
for (IASTAttributeSpecifier attributeSpecifier : getAttributeSpecifiers()) {
|
||||||
attributes = ArrayUtil.addAll(attributes, attributeSpecifier.getAttributes());
|
if (attributeSpecifier instanceof IASTAttributeList) {
|
||||||
|
attributes = ArrayUtil.addAll(attributes,
|
||||||
|
((IASTAttributeList) attributeSpecifier).getAttributes());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return attributes;
|
return attributes;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +84,7 @@ public abstract class ASTAttributeOwner extends ASTNode implements IASTAttribute
|
||||||
|
|
||||||
protected boolean acceptByGCCAttributeSpecifiers(ASTVisitor action) {
|
protected boolean acceptByGCCAttributeSpecifiers(ASTVisitor action) {
|
||||||
for (IASTAttributeSpecifier attributeSpecifier : attributeSpecifiers) {
|
for (IASTAttributeSpecifier attributeSpecifier : attributeSpecifiers) {
|
||||||
if (!(attributeSpecifier instanceof IGCCASTAttributeSpecifier))
|
if (!(attributeSpecifier instanceof IGCCASTAttributeList))
|
||||||
continue;
|
continue;
|
||||||
if (!attributeSpecifier.accept(action))
|
if (!attributeSpecifier.accept(action))
|
||||||
return false;
|
return false;
|
||||||
|
@ -95,4 +101,21 @@ public abstract class ASTAttributeOwner extends ASTNode implements IASTAttribute
|
||||||
}
|
}
|
||||||
return true;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -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.IASTASMDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTAlignmentSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTAlignmentSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTAttribute;
|
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.IASTAttributeOwner;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTAttributeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTAttributeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
|
||||||
|
@ -2384,11 +2385,11 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
* @throws BacktrackException
|
* @throws BacktrackException
|
||||||
* @throws EndOfFileException
|
* @throws EndOfFileException
|
||||||
*/
|
*/
|
||||||
protected IASTAttributeSpecifier __attribute__() throws BacktrackException, EndOfFileException {
|
protected IASTAttributeList __attribute__() throws BacktrackException, EndOfFileException {
|
||||||
if (LT(1) != IGCCToken.t__attribute__)
|
if (LT(1) != IGCCToken.t__attribute__)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
IASTAttributeSpecifier result = nodeFactory.newGCCAttributeSpecifier();
|
IASTAttributeList result = nodeFactory.newGCCAttributeList();
|
||||||
consume();
|
consume();
|
||||||
if (LT(1) == IToken.tLPAREN) {
|
if (LT(1) == IToken.tLPAREN) {
|
||||||
consume();
|
consume();
|
||||||
|
|
|
@ -11,20 +11,19 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser;
|
package org.eclipse.cdt.internal.core.dom.parser;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.gnu.IGCCASTAttributeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.gnu.IGCCASTAttributeList;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ASTAttributeSpecifier;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
@Override
|
||||||
public GCCASTAttributeSpecifier copy(CopyStyle style) {
|
public GCCASTAttributeList copy(CopyStyle style) {
|
||||||
return copy(new GCCASTAttributeSpecifier(), style);
|
return copy(new GCCASTAttributeList(), style);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GCCASTAttributeSpecifier copy() {
|
public GCCASTAttributeList copy() {
|
||||||
return copy(CopyStyle.withoutLocations);
|
return copy(CopyStyle.withoutLocations);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.INodeFactory;
|
import org.eclipse.cdt.core.dom.ast.INodeFactory;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.gnu.IGCCASTAttributeList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract base class for node factories.
|
* Abstract base class for node factories.
|
||||||
|
@ -34,4 +35,15 @@ public abstract class NodeFactory implements INodeFactory {
|
||||||
ASTNode e= (ASTNode) endNode;
|
ASTNode e= (ASTNode) endNode;
|
||||||
a.setLength(e.getOffset() + e.getLength() - a.getOffset());
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.ICASTTypeIdInitializerExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTTypedefNameSpecifier;
|
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.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.IGNUASTCompoundStatementExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator;
|
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.dom.ast.gnu.c.IGCCASTArrayRangeDesignator;
|
||||||
import org.eclipse.cdt.core.parser.IScanner;
|
import org.eclipse.cdt.core.parser.IScanner;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTToken;
|
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.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.dom.parser.NodeFactory;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner.CPreprocessor;
|
import org.eclipse.cdt.internal.core.parser.scanner.CPreprocessor;
|
||||||
|
|
||||||
|
@ -299,11 +297,6 @@ public class CNodeFactory extends NodeFactory implements ICNodeFactory {
|
||||||
return new CASTFunctionDefinition(declSpecifier, declarator, bodyStatement);
|
return new CASTFunctionDefinition(declSpecifier, declarator, bodyStatement);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public IGCCASTAttributeSpecifier newGCCAttributeSpecifier() {
|
|
||||||
return new GCCASTAttributeSpecifier();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IGNUASTCompoundStatementExpression newGNUCompoundStatementExpression(IASTCompoundStatement compoundStatement) {
|
public IGNUASTCompoundStatementExpression newGNUCompoundStatementExpression(IASTCompoundStatement compoundStatement) {
|
||||||
return new CASTCompoundStatementExpression(compoundStatement);
|
return new CASTCompoundStatementExpression(compoundStatement);
|
||||||
|
@ -489,21 +482,4 @@ public class CNodeFactory extends NodeFactory implements ICNodeFactory {
|
||||||
public IASTWhileStatement newWhileStatement(IASTExpression condition, IASTStatement body) {
|
public IASTWhileStatement newWhileStatement(IASTExpression condition, IASTStatement body) {
|
||||||
return new CASTWhileStatement(condition, body);
|
return new CASTWhileStatement(condition, body);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTAliasDeclaration;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTAliasDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTypeId;
|
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 IASTName aliasName;
|
||||||
private ICPPASTTypeId mappingTypeId;
|
private ICPPASTTypeId mappingTypeId;
|
||||||
|
|
||||||
|
|
|
@ -11,14 +11,15 @@
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
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.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
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.ASTNode;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||||
|
|
||||||
public class CPPASTAlignmentSpecifier extends ASTNode implements IASTAlignmentSpecifier,
|
public class CPPASTAlignmentSpecifier extends ASTNode implements ICPPASTAlignmentSpecifier,
|
||||||
IASTAmbiguityParent {
|
IASTAmbiguityParent {
|
||||||
// Precisely one of these is null.
|
// Precisely one of these is null.
|
||||||
private IASTExpression fExpression;
|
private IASTExpression fExpression;
|
||||||
|
@ -47,12 +48,12 @@ public class CPPASTAlignmentSpecifier extends ASTNode implements IASTAlignmentSp
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IASTAlignmentSpecifier copy() {
|
public ICPPASTAlignmentSpecifier copy() {
|
||||||
return copy(CopyStyle.withoutLocations);
|
return copy(CopyStyle.withoutLocations);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IASTAlignmentSpecifier copy(CopyStyle style) {
|
public ICPPASTAlignmentSpecifier copy(CopyStyle style) {
|
||||||
CPPASTAlignmentSpecifier copy;
|
CPPASTAlignmentSpecifier copy;
|
||||||
if (fExpression != null) {
|
if (fExpression != null) {
|
||||||
copy = new CPPASTAlignmentSpecifier(fExpression.copy(style));
|
copy = new CPPASTAlignmentSpecifier(fExpression.copy(style));
|
||||||
|
@ -82,4 +83,15 @@ public class CPPASTAlignmentSpecifier extends ASTNode implements IASTAlignmentSp
|
||||||
other.setPropertyInParent(child.getPropertyInParent());
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
@Override
|
||||||
|
public IASTAttribute[] getAttributes() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
@Override
|
||||||
|
public void addAttribute(IASTAttribute attribute) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,12 +11,14 @@
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTAlignmentSpecifier;
|
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.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
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;
|
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 fExpression;
|
||||||
IASTAlignmentSpecifier fTypeId;
|
IASTAlignmentSpecifier fTypeId;
|
||||||
|
|
||||||
|
@ -36,12 +38,12 @@ public class CPPASTAmbiguousAlignmentSpecifier extends ASTAmbiguousNode implemen
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IASTAlignmentSpecifier copy() {
|
public ICPPASTAlignmentSpecifier copy() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IASTAlignmentSpecifier copy(CopyStyle style) {
|
public ICPPASTAlignmentSpecifier copy(CopyStyle style) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,4 +51,15 @@ public class CPPASTAmbiguousAlignmentSpecifier extends ASTAmbiguousNode implemen
|
||||||
public IASTNode[] getNodes() {
|
public IASTNode[] getNodes() {
|
||||||
return new IASTNode[] { fExpression, fTypeId };
|
return new IASTNode[] { fExpression, fTypeId };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
@Override
|
||||||
|
public IASTAttribute[] getAttributes() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
@Override
|
||||||
|
public void addAttribute(IASTAttribute attribute) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.IASTArrayModifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
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
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CPPASTArrayModifier extends ASTAttributeOwner implements IASTArrayModifier, IASTAmbiguityParent {
|
public class CPPASTArrayModifier extends CPPASTAttributeOwner implements IASTArrayModifier {
|
||||||
private IASTExpression exp;
|
private IASTExpression exp;
|
||||||
|
|
||||||
public CPPASTArrayModifier() {
|
public CPPASTArrayModifier() {
|
||||||
|
@ -85,6 +83,8 @@ public class CPPASTArrayModifier extends ASTAttributeOwner implements IASTArrayM
|
||||||
other.setPropertyInParent(child.getPropertyInParent());
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setParent(child.getParent());
|
other.setParent(child.getParent());
|
||||||
exp = (IASTExpression) other;
|
exp = (IASTExpression) other;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
super.replace(child, other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.
|
* Rapperswil, University of applied sciences.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
@ -11,19 +11,20 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
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
|
@Override
|
||||||
public CPPASTAttributeSpecifier copy(CopyStyle style) {
|
public CPPASTAttributeList copy(CopyStyle style) {
|
||||||
return copy(new CPPASTAttributeSpecifier(), style);
|
return copy(new CPPASTAttributeList(), style);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CPPASTAttributeSpecifier copy() {
|
public CPPASTAttributeList copy() {
|
||||||
return copy(CopyStyle.withoutLocations);
|
return copy(CopyStyle.withoutLocations);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -11,19 +11,14 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
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.IASTAlignmentSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
|
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;
|
import org.eclipse.cdt.internal.core.model.ASTStringUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base for all c++ declaration specifiers.
|
* Base for all c++ declaration specifiers.
|
||||||
*/
|
*/
|
||||||
public abstract class CPPASTBaseDeclSpecifier extends ASTAttributeOwner
|
public abstract class CPPASTBaseDeclSpecifier extends CPPASTAttributeOwner implements ICPPASTDeclSpecifier {
|
||||||
implements ICPPASTDeclSpecifier, IASTAmbiguityParent {
|
|
||||||
private boolean explicit;
|
private boolean explicit;
|
||||||
private boolean friend;
|
private boolean friend;
|
||||||
private boolean inline;
|
private boolean inline;
|
||||||
|
@ -34,8 +29,6 @@ public abstract class CPPASTBaseDeclSpecifier extends ASTAttributeOwner
|
||||||
private boolean isVolatile;
|
private boolean isVolatile;
|
||||||
private int sc;
|
private int sc;
|
||||||
private boolean virtual;
|
private boolean virtual;
|
||||||
private IASTAlignmentSpecifier[] alignmentSpecifiers =
|
|
||||||
IASTAlignmentSpecifier.EMPTY_ALIGNMENT_SPECIFIER_ARRAY;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFriend() {
|
public boolean isFriend() {
|
||||||
|
@ -147,19 +140,15 @@ public abstract class CPPASTBaseDeclSpecifier extends ASTAttributeOwner
|
||||||
this.explicit = value;
|
this.explicit = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
public IASTAlignmentSpecifier[] getAlignmentSpecifiers() {
|
public IASTAlignmentSpecifier[] getAlignmentSpecifiers() {
|
||||||
return alignmentSpecifiers;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
public void setAlignmentSpecifiers(IASTAlignmentSpecifier[] alignmentSpecifiers) {
|
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) {
|
protected <T extends CPPASTBaseDeclSpecifier> T copy(T copy, CopyStyle style) {
|
||||||
|
@ -174,11 +163,6 @@ public abstract class CPPASTBaseDeclSpecifier extends ASTAttributeOwner
|
||||||
target.isVolatile = isVolatile;
|
target.isVolatile = isVolatile;
|
||||||
target.sc = sc;
|
target.sc = sc;
|
||||||
target.virtual = virtual;
|
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);
|
return super.copy(copy, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,27 +173,4 @@ public abstract class CPPASTBaseDeclSpecifier extends ASTAttributeOwner
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return ASTStringUtil.getSignatureString(this, null);
|
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTBreakStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTBreakStatement;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CPPASTBreakStatement extends ASTAttributeOwner implements IASTBreakStatement {
|
public class CPPASTBreakStatement extends CPPASTAttributeOwner implements IASTBreakStatement {
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(ASTVisitor action) {
|
public boolean accept(ASTVisitor action) {
|
||||||
if (action.shouldVisitStatements) {
|
if (action.shouldVisitStatements) {
|
||||||
|
|
|
@ -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.IASTCaseStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
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
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CPPASTCaseStatement extends ASTAttributeOwner
|
public class CPPASTCaseStatement extends CPPASTAttributeOwner implements IASTCaseStatement {
|
||||||
implements IASTCaseStatement, IASTAmbiguityParent {
|
|
||||||
private IASTExpression expression;
|
private IASTExpression expression;
|
||||||
|
|
||||||
public CPPASTCaseStatement() {
|
public CPPASTCaseStatement() {
|
||||||
|
@ -88,6 +85,8 @@ public class CPPASTCaseStatement extends ASTAttributeOwner
|
||||||
other.setPropertyInParent(child.getPropertyInParent());
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setParent(child.getParent());
|
other.setParent(child.getParent());
|
||||||
expression = (IASTExpression) other;
|
expression = (IASTExpression) other;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
super.replace(child, other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.IASTStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler;
|
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;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.DestructorCallCollector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CPPASTCatchHandler extends ASTAttributeOwner
|
public class CPPASTCatchHandler extends CPPASTAttributeOwner implements ICPPASTCatchHandler {
|
||||||
implements ICPPASTCatchHandler, IASTAmbiguityParent {
|
|
||||||
private boolean fIsCatchAll;
|
private boolean fIsCatchAll;
|
||||||
private IASTStatement fBody;
|
private IASTStatement fBody;
|
||||||
private IASTDeclaration fDeclaration;
|
private IASTDeclaration fDeclaration;
|
||||||
|
@ -139,12 +136,15 @@ public class CPPASTCatchHandler extends ASTAttributeOwner
|
||||||
other.setPropertyInParent(child.getPropertyInParent());
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setParent(child.getParent());
|
other.setParent(child.getParent());
|
||||||
fBody = (IASTStatement) other;
|
fBody = (IASTStatement) other;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (fDeclaration == child) {
|
if (fDeclaration == child) {
|
||||||
other.setParent(child.getParent());
|
other.setParent(child.getParent());
|
||||||
other.setPropertyInParent(child.getPropertyInParent());
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
fDeclaration = (IASTDeclaration) other;
|
fDeclaration = (IASTDeclaration) other;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
super.replace(child, other);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -182,10 +182,6 @@ public class CPPASTCompositeTypeSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
if (!acceptByAttributeSpecifiers(action))
|
if (!acceptByAttributeSpecifiers(action))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!visitAlignmentSpecifiers(action)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fName != null && !fName.accept(action))
|
if (fName != null && !fName.accept(action))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -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.ICPPASTCompoundStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope;
|
||||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
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;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.DestructorCallCollector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CPPASTCompoundStatement extends ASTAttributeOwner
|
public class CPPASTCompoundStatement extends CPPASTAttributeOwner implements ICPPASTCompoundStatement {
|
||||||
implements ICPPASTCompoundStatement, IASTAmbiguityParent {
|
|
||||||
private IASTStatement[] statements = new IASTStatement[2];
|
private IASTStatement[] statements = new IASTStatement[2];
|
||||||
private ICPPScope scope;
|
private ICPPScope scope;
|
||||||
private IASTImplicitDestructorName[] fImplicitDestructorNames;
|
private IASTImplicitDestructorName[] fImplicitDestructorNames;
|
||||||
|
@ -118,7 +115,9 @@ public class CPPASTCompoundStatement extends ASTAttributeOwner
|
||||||
other.setParent(statements[i].getParent());
|
other.setParent(statements[i].getParent());
|
||||||
other.setPropertyInParent(statements[i].getPropertyInParent());
|
other.setPropertyInParent(statements[i].getPropertyInParent());
|
||||||
statements[i] = (IASTStatement) other;
|
statements[i] = (IASTStatement) other;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
super.replace(child, other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTContinueStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTContinueStatement;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CPPASTContinueStatement extends ASTAttributeOwner implements IASTContinueStatement {
|
public class CPPASTContinueStatement extends CPPASTAttributeOwner implements IASTContinueStatement {
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(ASTVisitor action) {
|
public boolean accept(ASTVisitor action) {
|
||||||
if (action.shouldVisitStatements) {
|
if (action.shouldVisitStatements) {
|
||||||
|
|
|
@ -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.ICPPASTQualifiedName;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
|
||||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
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.ASTNode;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
|
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.CPPSemantics;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* C++ specific declarator.
|
* C++ specific declarator.
|
||||||
*/
|
*/
|
||||||
public class CPPASTDeclarator extends ASTAttributeOwner implements ICPPASTDeclarator, IASTImplicitNameOwner,
|
public class CPPASTDeclarator extends CPPASTAttributeOwner implements ICPPASTDeclarator,
|
||||||
IASTAmbiguityParent {
|
IASTImplicitNameOwner {
|
||||||
private IASTInitializer initializer;
|
private IASTInitializer initializer;
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
private IASTImplicitName[] implicitNames;
|
private IASTImplicitName[] implicitNames;
|
||||||
|
@ -301,6 +299,8 @@ public class CPPASTDeclarator extends ASTAttributeOwner implements ICPPASTDeclar
|
||||||
other.setPropertyInParent(child.getPropertyInParent());
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setParent(child.getParent());
|
other.setParent(child.getParent());
|
||||||
nested= (IASTDeclarator) other;
|
nested= (IASTDeclarator) other;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
super.replace(child, other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDefaultStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTDefaultStatement;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CPPASTDefaultStatement extends ASTAttributeOwner implements IASTDefaultStatement {
|
public class CPPASTDefaultStatement extends CPPASTAttributeOwner implements IASTDefaultStatement {
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(ASTVisitor action) {
|
public boolean accept(ASTVisitor action) {
|
||||||
if (action.shouldVisitStatements) {
|
if (action.shouldVisitStatements) {
|
||||||
|
|
|
@ -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.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
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
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CPPASTDoStatement extends ASTAttributeOwner
|
public class CPPASTDoStatement extends CPPASTAttributeOwner implements IASTDoStatement {
|
||||||
implements IASTDoStatement, IASTAmbiguityParent {
|
|
||||||
private IASTStatement body;
|
private IASTStatement body;
|
||||||
private IASTExpression condition;
|
private IASTExpression condition;
|
||||||
|
|
||||||
|
@ -108,11 +105,14 @@ public class CPPASTDoStatement extends ASTAttributeOwner
|
||||||
other.setPropertyInParent(body.getPropertyInParent());
|
other.setPropertyInParent(body.getPropertyInParent());
|
||||||
other.setParent(body.getParent());
|
other.setParent(body.getParent());
|
||||||
body = (IASTStatement) other;
|
body = (IASTStatement) other;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (child == condition) {
|
if (child == condition) {
|
||||||
other.setPropertyInParent(child.getPropertyInParent());
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setParent(child.getParent());
|
other.setParent(child.getParent());
|
||||||
condition = (IASTExpression) other;
|
condition = (IASTExpression) other;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
super.replace(child, other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,10 +90,6 @@ public class CPPASTElaboratedTypeSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
if (!acceptByAttributeSpecifiers(action))
|
if (!acceptByAttributeSpecifiers(action))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!visitAlignmentSpecifiers(action)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name != null) if (!name.accept(action)) return false;
|
if (name != null) if (!name.accept(action)) return false;
|
||||||
if (action.shouldVisitDeclSpecifiers) {
|
if (action.shouldVisitDeclSpecifiers) {
|
||||||
switch (action.leave(this)) {
|
switch (action.leave(this)) {
|
||||||
|
|
|
@ -135,10 +135,6 @@ public class CPPASTEnumerationSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
if (!acceptByAttributeSpecifiers(action))
|
if (!acceptByAttributeSpecifiers(action))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!visitAlignmentSpecifiers(action)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (IASTEnumerator e : getEnumerators()) {
|
for (IASTEnumerator e : getEnumerators()) {
|
||||||
if (!e.accept(action))
|
if (!e.accept(action))
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -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.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
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
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CPPASTExpressionStatement extends ASTAttributeOwner
|
public class CPPASTExpressionStatement extends CPPASTAttributeOwner implements IASTExpressionStatement {
|
||||||
implements IASTExpressionStatement, IASTAmbiguityParent {
|
|
||||||
private IASTExpression expression;
|
private IASTExpression expression;
|
||||||
|
|
||||||
public CPPASTExpressionStatement() {
|
public CPPASTExpressionStatement() {
|
||||||
|
@ -88,6 +85,8 @@ public class CPPASTExpressionStatement extends ASTAttributeOwner
|
||||||
other.setPropertyInParent(child.getPropertyInParent());
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setParent(child.getParent());
|
other.setParent(child.getParent());
|
||||||
expression = (IASTExpression) other;
|
expression = (IASTExpression) other;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
super.replace(child, other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTForStatement;
|
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.ASTAttributeOwner;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.DestructorCallCollector;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.DestructorCallCollector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For statement in C++
|
* For statement in C++
|
||||||
*/
|
*/
|
||||||
public class CPPASTForStatement extends ASTAttributeOwner
|
public class CPPASTForStatement extends CPPASTAttributeOwner implements ICPPASTForStatement {
|
||||||
implements ICPPASTForStatement, IASTAmbiguityParent {
|
|
||||||
private IScope fScope;
|
private IScope fScope;
|
||||||
|
|
||||||
private IASTStatement fInit;
|
private IASTStatement fInit;
|
||||||
|
@ -173,21 +171,26 @@ public class CPPASTForStatement extends ASTAttributeOwner
|
||||||
other.setPropertyInParent(child.getPropertyInParent());
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setParent(child.getParent());
|
other.setParent(child.getParent());
|
||||||
fBody = (IASTStatement) other;
|
fBody = (IASTStatement) other;
|
||||||
|
return;
|
||||||
} else if (child == fCondition || child == fCondDeclaration) {
|
} else if (child == fCondition || child == fCondDeclaration) {
|
||||||
if (other instanceof IASTExpression) {
|
if (other instanceof IASTExpression) {
|
||||||
setConditionExpression((IASTExpression) other);
|
setConditionExpression((IASTExpression) other);
|
||||||
} else if (other instanceof IASTDeclaration) {
|
} else if (other instanceof IASTDeclaration) {
|
||||||
setConditionDeclaration((IASTDeclaration) other);
|
setConditionDeclaration((IASTDeclaration) other);
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
} else if (child == fIterationExpression) {
|
} else if (child == fIterationExpression) {
|
||||||
other.setPropertyInParent(child.getPropertyInParent());
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setParent(child.getParent());
|
other.setParent(child.getParent());
|
||||||
fIterationExpression = (IASTExpression) other;
|
fIterationExpression = (IASTExpression) other;
|
||||||
|
return;
|
||||||
} else if (child == fInit) {
|
} else if (child == fInit) {
|
||||||
other.setPropertyInParent(child.getPropertyInParent());
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setParent(child.getParent());
|
other.setParent(child.getParent());
|
||||||
fInit = (IASTStatement) other;
|
fInit = (IASTStatement) other;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
super.replace(child, other);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -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.ICPPClassType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
||||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
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.ASTNode;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
|
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
|
* Models a function definition without a try-block. If used for a constructor definition
|
||||||
* it may contain member initializers.
|
* it may contain member initializers.
|
||||||
*/
|
*/
|
||||||
public class CPPASTFunctionDefinition extends ASTAttributeOwner
|
public class CPPASTFunctionDefinition extends CPPASTAttributeOwner
|
||||||
implements ICPPASTFunctionDefinition, IASTAmbiguityParent, IASTImplicitNameOwner {
|
implements ICPPASTFunctionDefinition, IASTImplicitNameOwner {
|
||||||
private IASTDeclSpecifier declSpecifier;
|
private IASTDeclSpecifier declSpecifier;
|
||||||
private IASTFunctionDeclarator declarator;
|
private IASTFunctionDeclarator declarator;
|
||||||
private IASTStatement bodyStatement;
|
private IASTStatement bodyStatement;
|
||||||
|
@ -245,7 +243,9 @@ public class CPPASTFunctionDefinition extends ASTAttributeOwner
|
||||||
other.setPropertyInParent(bodyStatement.getPropertyInParent());
|
other.setPropertyInParent(bodyStatement.getPropertyInParent());
|
||||||
other.setParent(bodyStatement.getParent());
|
other.setParent(bodyStatement.getParent());
|
||||||
bodyStatement = (IASTStatement) other;
|
bodyStatement = (IASTStatement) other;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
super.replace(child, other);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -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.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTGotoStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTGotoStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CPPASTGotoStatement extends ASTAttributeOwner implements IASTGotoStatement {
|
public class CPPASTGotoStatement extends CPPASTAttributeOwner implements IASTGotoStatement {
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
|
|
||||||
public CPPASTGotoStatement() {
|
public CPPASTGotoStatement() {
|
||||||
|
|
|
@ -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.IASTStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTIfStatement;
|
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++
|
* If statement in C++
|
||||||
*/
|
*/
|
||||||
public class CPPASTIfStatement extends ASTAttributeOwner implements ICPPASTIfStatement, IASTAmbiguityParent {
|
public class CPPASTIfStatement extends CPPASTAttributeOwner implements ICPPASTIfStatement {
|
||||||
private IASTExpression condition;
|
private IASTExpression condition;
|
||||||
private IASTStatement thenClause;
|
private IASTStatement thenClause;
|
||||||
private IASTStatement elseClause;
|
private IASTStatement elseClause;
|
||||||
|
@ -177,17 +175,21 @@ public class CPPASTIfStatement extends ASTAttributeOwner implements ICPPASTIfSta
|
||||||
other.setParent(child.getParent());
|
other.setParent(child.getParent());
|
||||||
other.setPropertyInParent(child.getPropertyInParent());
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
thenClause = (IASTStatement) other;
|
thenClause = (IASTStatement) other;
|
||||||
|
return;
|
||||||
} else if (elseClause == child) {
|
} else if (elseClause == child) {
|
||||||
other.setParent(child.getParent());
|
other.setParent(child.getParent());
|
||||||
other.setPropertyInParent(child.getPropertyInParent());
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
elseClause = (IASTStatement) other;
|
elseClause = (IASTStatement) other;
|
||||||
|
return;
|
||||||
} else if (condition == child || condDecl == child) {
|
} else if (condition == child || condDecl == child) {
|
||||||
if (other instanceof IASTExpression) {
|
if (other instanceof IASTExpression) {
|
||||||
setConditionExpression((IASTExpression) other);
|
setConditionExpression((IASTExpression) other);
|
||||||
} else if (other instanceof IASTDeclaration) {
|
} else if (other instanceof IASTDeclaration) {
|
||||||
setConditionDeclaration((IASTDeclaration) other);
|
setConditionDeclaration((IASTDeclaration) other);
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
super.replace(child, other);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -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.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
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
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CPPASTLabelStatement extends ASTAttributeOwner
|
public class CPPASTLabelStatement extends CPPASTAttributeOwner implements IASTLabelStatement {
|
||||||
implements IASTLabelStatement, IASTAmbiguityParent {
|
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
private IASTStatement nestedStatement;
|
private IASTStatement nestedStatement;
|
||||||
|
|
||||||
|
@ -114,6 +111,8 @@ public class CPPASTLabelStatement extends ASTAttributeOwner
|
||||||
other.setParent(this);
|
other.setParent(this);
|
||||||
other.setPropertyInParent(child.getPropertyInParent());
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
setNestedStatement((IASTStatement) other);
|
setNestedStatement((IASTStatement) other);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
super.replace(child, other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,10 +90,6 @@ public class CPPASTNamedTypeSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!visitAlignmentSpecifiers(action)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name != null && !name.accept(action))
|
if (name != null && !name.accept(action))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -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.ICPPASTNamespaceDefinition;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
|
||||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
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.ASTQueries;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Definition of a namespace.
|
* Definition of a namespace.
|
||||||
*/
|
*/
|
||||||
public class CPPASTNamespaceDefinition extends ASTAttributeOwner
|
public class CPPASTNamespaceDefinition extends CPPASTAttributeOwner implements ICPPASTNamespaceDefinition {
|
||||||
implements ICPPASTNamespaceDefinition, IASTAmbiguityParent {
|
|
||||||
private IASTName fName;
|
private IASTName fName;
|
||||||
private IASTDeclaration[] fAllDeclarations;
|
private IASTDeclaration[] fAllDeclarations;
|
||||||
private IASTDeclaration[] fActiveDeclarations;
|
private IASTDeclaration[] fActiveDeclarations;
|
||||||
|
@ -162,8 +159,9 @@ public class CPPASTNamespaceDefinition extends ASTAttributeOwner
|
||||||
other.setPropertyInParent(child.getPropertyInParent());
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
fAllDeclarations[i] = (IASTDeclaration) other;
|
fAllDeclarations[i] = (IASTDeclaration) other;
|
||||||
fActiveDeclarations= null;
|
fActiveDeclarations= null;
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
super.replace(child, other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNullStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTNullStatement;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CPPASTNullStatement extends ASTAttributeOwner implements IASTNullStatement {
|
public class CPPASTNullStatement extends CPPASTAttributeOwner implements IASTNullStatement {
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(ASTVisitor action) {
|
public boolean accept(ASTVisitor action) {
|
||||||
if (action.shouldVisitStatements) {
|
if (action.shouldVisitStatements) {
|
||||||
|
|
|
@ -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.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTPointer;
|
import org.eclipse.cdt.core.dom.ast.IASTPointer;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A pointer operator of a declarator
|
* 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 isConst;
|
||||||
private boolean isVolatile;
|
private boolean isVolatile;
|
||||||
private boolean isRestrict;
|
private boolean isRestrict;
|
||||||
|
|
|
@ -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.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTRangeBasedForStatement;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTRangeBasedForStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
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.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.CPPSemantics;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.DestructorCallCollector;
|
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++.
|
* Range based 'for' loop in C++.
|
||||||
*/
|
*/
|
||||||
public class CPPASTRangeBasedForStatement extends ASTAttributeOwner
|
public class CPPASTRangeBasedForStatement extends CPPASTAttributeOwner implements ICPPASTRangeBasedForStatement {
|
||||||
implements ICPPASTRangeBasedForStatement, IASTAmbiguityParent {
|
|
||||||
private IScope fScope;
|
private IScope fScope;
|
||||||
private IASTDeclaration fDeclaration;
|
private IASTDeclaration fDeclaration;
|
||||||
private IASTInitializerClause fInitClause;
|
private IASTInitializerClause fInitClause;
|
||||||
|
@ -223,10 +220,14 @@ public class CPPASTRangeBasedForStatement extends ASTAttributeOwner
|
||||||
public void replace(IASTNode child, IASTNode other) {
|
public void replace(IASTNode child, IASTNode other) {
|
||||||
if (child == fDeclaration) {
|
if (child == fDeclaration) {
|
||||||
setDeclaration((IASTDeclaration) other);
|
setDeclaration((IASTDeclaration) other);
|
||||||
|
return;
|
||||||
} else if (child == fInitClause) {
|
} else if (child == fInitClause) {
|
||||||
setInitializerClause((IASTInitializerClause) other);
|
setInitializerClause((IASTInitializerClause) other);
|
||||||
|
return;
|
||||||
} else if (child == fBody) {
|
} else if (child == fBody) {
|
||||||
setBody((IASTStatement) other);
|
setBody((IASTStatement) other);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
super.replace(child, other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTReferenceOperator;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTReferenceOperator;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reference operator for declarators.
|
* Reference operator for declarators.
|
||||||
*/
|
*/
|
||||||
public class CPPASTReferenceOperator extends ASTAttributeOwner implements ICPPASTReferenceOperator {
|
public class CPPASTReferenceOperator extends CPPASTAttributeOwner implements ICPPASTReferenceOperator {
|
||||||
private final boolean fIsRValue;
|
private final boolean fIsRValue;
|
||||||
|
|
||||||
public CPPASTReferenceOperator(boolean isRValueReference) {
|
public CPPASTReferenceOperator(boolean isRValueReference) {
|
||||||
|
|
|
@ -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.IASTInitializerClause;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTReturnStatement;
|
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;
|
private IASTInitializerClause retValue;
|
||||||
|
|
||||||
public CPPASTReturnStatement() {
|
public CPPASTReturnStatement() {
|
||||||
|
@ -99,6 +97,8 @@ public class CPPASTReturnStatement extends ASTAttributeOwner implements IASTRetu
|
||||||
other.setPropertyInParent(child.getPropertyInParent());
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setParent(child.getParent());
|
other.setParent(child.getParent());
|
||||||
retValue = (IASTInitializerClause) other;
|
retValue = (IASTInitializerClause) other;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
super.replace(child, other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,10 +222,6 @@ public class CPPASTSimpleDeclSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
if (!acceptByAttributeSpecifiers(action))
|
if (!acceptByAttributeSpecifiers(action))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!visitAlignmentSpecifiers(action)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (action.shouldVisitDeclSpecifiers) {
|
if (action.shouldVisitDeclSpecifiers) {
|
||||||
switch (action.leave(this)) {
|
switch (action.leave(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT: return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
|
|
|
@ -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.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
||||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
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
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CPPASTSimpleDeclaration extends ASTAttributeOwner
|
public class CPPASTSimpleDeclaration extends CPPASTAttributeOwner implements IASTSimpleDeclaration {
|
||||||
implements IASTSimpleDeclaration, IASTAmbiguityParent {
|
|
||||||
private IASTDeclarator[] declarators;
|
private IASTDeclarator[] declarators;
|
||||||
private int declaratorsPos = -1;
|
private int declaratorsPos = -1;
|
||||||
private IASTDeclSpecifier declSpecifier;
|
private IASTDeclSpecifier declSpecifier;
|
||||||
|
@ -124,8 +121,9 @@ public class CPPASTSimpleDeclaration extends ASTAttributeOwner
|
||||||
declarators[i] = (IASTDeclarator) other;
|
declarators[i] = (IASTDeclarator) other;
|
||||||
other.setParent(child.getParent());
|
other.setParent(child.getParent());
|
||||||
other.setPropertyInParent(child.getPropertyInParent());
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
super.replace(child, other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.IASTStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSwitchStatement;
|
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++.
|
* Switch statement in C++.
|
||||||
*/
|
*/
|
||||||
public class CPPASTSwitchStatement extends ASTAttributeOwner
|
public class CPPASTSwitchStatement extends CPPASTAttributeOwner implements ICPPASTSwitchStatement {
|
||||||
implements ICPPASTSwitchStatement, IASTAmbiguityParent {
|
|
||||||
private IScope scope;
|
private IScope scope;
|
||||||
private IASTExpression controllerExpression;
|
private IASTExpression controllerExpression;
|
||||||
private IASTDeclaration controllerDeclaration;
|
private IASTDeclaration controllerDeclaration;
|
||||||
|
@ -123,13 +120,16 @@ public class CPPASTSwitchStatement extends ASTAttributeOwner
|
||||||
other.setPropertyInParent(child.getPropertyInParent());
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setParent(child.getParent());
|
other.setParent(child.getParent());
|
||||||
body = (IASTStatement) other;
|
body = (IASTStatement) other;
|
||||||
|
return;
|
||||||
} else if (controllerDeclaration == child || controllerExpression == child) {
|
} else if (controllerDeclaration == child || controllerExpression == child) {
|
||||||
if (other instanceof IASTExpression) {
|
if (other instanceof IASTExpression) {
|
||||||
setControllerExpression((IASTExpression) other);
|
setControllerExpression((IASTExpression) other);
|
||||||
} else if (other instanceof IASTDeclaration) {
|
} else if (other instanceof IASTDeclaration) {
|
||||||
setControllerDeclaration((IASTDeclaration) other);
|
setControllerDeclaration((IASTDeclaration) other);
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
super.replace(child, other);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -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.ICPPASTCatchHandler;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTryBlockStatement;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTryBlockStatement;
|
||||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
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
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CPPASTTryBlockStatement extends ASTAttributeOwner implements ICPPASTTryBlockStatement, IASTAmbiguityParent {
|
public class CPPASTTryBlockStatement extends CPPASTAttributeOwner implements ICPPASTTryBlockStatement {
|
||||||
private ICPPASTCatchHandler[] catchHandlers;
|
private ICPPASTCatchHandler[] catchHandlers;
|
||||||
private int catchHandlersPos= -1;
|
private int catchHandlersPos= -1;
|
||||||
private IASTStatement tryBody;
|
private IASTStatement tryBody;
|
||||||
|
@ -119,6 +117,8 @@ public class CPPASTTryBlockStatement extends ASTAttributeOwner implements ICPPAS
|
||||||
other.setPropertyInParent(child.getPropertyInParent());
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setParent(child.getParent());
|
other.setParent(child.getParent());
|
||||||
tryBody = (IASTStatement) other;
|
tryBody = (IASTStatement) other;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
super.replace(child, other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,10 +61,6 @@ public class CPPASTTypeTransformationSpecifier extends CPPASTBaseDeclSpecifier i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!visitAlignmentSpecifiers(action)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fOperand.accept(action))
|
if (!fOperand.accept(action))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -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.ICPPASTCompletionContext;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDeclaration;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
|
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;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
|
||||||
|
|
||||||
public class CPPASTUsingDeclaration extends ASTAttributeOwner
|
public class CPPASTUsingDeclaration extends CPPASTAttributeOwner
|
||||||
implements ICPPASTUsingDeclaration, ICPPASTCompletionContext {
|
implements ICPPASTUsingDeclaration, ICPPASTCompletionContext {
|
||||||
private boolean typeName;
|
private boolean typeName;
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
|
|
|
@ -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.ICPPASTCompletionContext;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDirective;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDirective;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
|
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;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
|
||||||
|
|
||||||
public class CPPASTUsingDirective extends ASTAttributeOwner
|
public class CPPASTUsingDirective extends CPPASTAttributeOwner
|
||||||
implements ICPPASTUsingDirective, ICPPASTCompletionContext {
|
implements ICPPASTUsingDirective, ICPPASTCompletionContext {
|
||||||
private IASTName name;
|
private IASTName name;
|
||||||
|
|
||||||
|
|
|
@ -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.IASTStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTWhileStatement;
|
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++.
|
* While statement in C++.
|
||||||
*/
|
*/
|
||||||
public class CPPASTWhileStatement extends ASTAttributeOwner
|
public class CPPASTWhileStatement extends CPPASTAttributeOwner implements ICPPASTWhileStatement {
|
||||||
implements ICPPASTWhileStatement, IASTAmbiguityParent {
|
|
||||||
private IASTExpression condition;
|
private IASTExpression condition;
|
||||||
private IASTDeclaration condition2;
|
private IASTDeclaration condition2;
|
||||||
private IASTStatement body;
|
private IASTStatement body;
|
||||||
|
@ -136,6 +133,7 @@ public class CPPASTWhileStatement extends ASTAttributeOwner
|
||||||
other.setPropertyInParent(child.getPropertyInParent());
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setParent(child.getParent());
|
other.setParent(child.getParent());
|
||||||
body = (IASTStatement) other;
|
body = (IASTStatement) other;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (child == condition || child == condition2) {
|
if (child == condition || child == condition2) {
|
||||||
if (other instanceof IASTExpression) {
|
if (other instanceof IASTExpression) {
|
||||||
|
@ -143,7 +141,9 @@ public class CPPASTWhileStatement extends ASTAttributeOwner
|
||||||
} else if (other instanceof IASTDeclaration) {
|
} else if (other instanceof IASTDeclaration) {
|
||||||
setConditionDeclaration((IASTDeclaration) other);
|
setConditionDeclaration((IASTDeclaration) other);
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
super.replace(child, other);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -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.ICPPASTArrayDesignator;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTArraySubscriptExpression;
|
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.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.ICPPASTBinaryExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCapture;
|
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.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.ICPPASTWhileStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNodeFactory;
|
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.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.IGNUASTCompoundStatementExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPASTArrayRangeDesignator;
|
import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPASTArrayRangeDesignator;
|
||||||
import org.eclipse.cdt.core.dom.parser.cpp.ICPPASTAttributeSpecifier;
|
import org.eclipse.cdt.core.dom.parser.cpp.ICPPASTAttributeSpecifier;
|
||||||
import org.eclipse.cdt.core.parser.IScanner;
|
import org.eclipse.cdt.core.parser.IScanner;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTToken;
|
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.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.dom.parser.NodeFactory;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner.CPreprocessor;
|
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);
|
return new CPPASTAttribute(name, scope, argumentClause, packExpansion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
public ICPPASTAttributeSpecifier newAttributeSpecifier() {
|
public ICPPASTAttributeSpecifier newAttributeSpecifier() {
|
||||||
return new CPPASTAttributeSpecifier();
|
return new CPPASTAttributeList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ICPPASTAttributeList newAttributeList() {
|
||||||
|
return new CPPASTAttributeList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -469,11 +474,6 @@ public class CPPNodeFactory extends NodeFactory implements ICPPNodeFactory {
|
||||||
return new CPPASTFunctionWithTryBlock(declSpecifier, declarator, bodyStatement);
|
return new CPPASTFunctionWithTryBlock(declSpecifier, declarator, bodyStatement);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public IGCCASTAttributeSpecifier newGCCAttributeSpecifier() {
|
|
||||||
return new GCCASTAttributeSpecifier();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IGNUASTCompoundStatementExpression newGNUCompoundStatementExpression(IASTCompoundStatement compoundStatement) {
|
public IGNUASTCompoundStatementExpression newGNUCompoundStatementExpression(IASTCompoundStatement compoundStatement) {
|
||||||
return new CPPASTCompoundStatementExpression(compoundStatement);
|
return new CPPASTCompoundStatementExpression(compoundStatement);
|
||||||
|
|
|
@ -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.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTGotoStatement;
|
import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTGotoStatement;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GNU C++ goto statement.
|
* GNU C++ goto statement.
|
||||||
|
@ -27,7 +26,7 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTAttributeOwner;
|
||||||
*
|
*
|
||||||
* @since 5.8
|
* @since 5.8
|
||||||
*/
|
*/
|
||||||
public class GNUCPPASTGotoStatement extends ASTAttributeOwner implements IGNUASTGotoStatement {
|
public class GNUCPPASTGotoStatement extends CPPASTAttributeOwner implements IGNUASTGotoStatement {
|
||||||
private IASTExpression expression;
|
private IASTExpression expression;
|
||||||
|
|
||||||
public GNUCPPASTGotoStatement() {
|
public GNUCPPASTGotoStatement() {
|
||||||
|
|
|
@ -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.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
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.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.ICPPASTAmbiguousTemplateArgument;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTArrayDeclarator;
|
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.ICPPASTArrayDesignator;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTAttribute;
|
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.ICPPASTCapture;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCastExpression;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCastExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler;
|
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.cpp.ICPPUnaryTypeTransformation;
|
||||||
import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPASTArrayRangeDesignator;
|
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.IExtensionToken;
|
||||||
import org.eclipse.cdt.core.dom.parser.cpp.ICPPASTAttributeSpecifier;
|
|
||||||
import org.eclipse.cdt.core.dom.parser.cpp.ICPPParserExtensionConfiguration;
|
import org.eclipse.cdt.core.dom.parser.cpp.ICPPParserExtensionConfiguration;
|
||||||
import org.eclipse.cdt.core.index.IIndex;
|
import org.eclipse.cdt.core.index.IIndex;
|
||||||
import org.eclipse.cdt.core.parser.EndOfFileException;
|
import org.eclipse.cdt.core.parser.EndOfFileException;
|
||||||
|
@ -2577,23 +2578,28 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
BacktrackException {
|
BacktrackException {
|
||||||
List<IASTAttributeSpecifier> specifiers = null;
|
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)
|
if (specifiers == null)
|
||||||
specifiers = new ArrayList<>();
|
specifiers = new ArrayList<>();
|
||||||
int offset = consumeOrEOC(IToken.tLBRACKET).getOffset();
|
if (LTcatchEOF(1) == IToken.t_alignas) {
|
||||||
consumeOrEOC(IToken.tLBRACKET);
|
specifiers.add((ICPPASTAlignmentSpecifier) alignmentSpecifier());
|
||||||
ICPPASTAttributeSpecifier attributeSpecifier = getNodeFactory().newAttributeSpecifier();
|
} else {
|
||||||
while (LT(1) != IToken.tRBRACKET) {
|
int offset = consumeOrEOC(IToken.tLBRACKET).getOffset();
|
||||||
if (LT(1) == IToken.tCOMMA)
|
consumeOrEOC(IToken.tLBRACKET);
|
||||||
consume();
|
ICPPASTAttributeList attributeList = getNodeFactory().newAttributeList();
|
||||||
ICPPASTAttribute attribute = singleAttribute();
|
while (LT(1) != IToken.tRBRACKET) {
|
||||||
attributeSpecifier.addAttribute(attribute);
|
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;
|
return specifiers;
|
||||||
}
|
}
|
||||||
|
@ -2970,7 +2976,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
ICPPASTDeclSpecifier result= null;
|
ICPPASTDeclSpecifier result= null;
|
||||||
ICPPASTDeclSpecifier altResult= null;
|
ICPPASTDeclSpecifier altResult= null;
|
||||||
List<IASTAttributeSpecifier> attributes = null;
|
List<IASTAttributeSpecifier> attributes = null;
|
||||||
IASTAlignmentSpecifier[] alignmentSpecifiers = IASTAlignmentSpecifier.EMPTY_ALIGNMENT_SPECIFIER_ARRAY;
|
|
||||||
try {
|
try {
|
||||||
IASTName identifier= null;
|
IASTName identifier= null;
|
||||||
IASTExpression typeofExpression= null;
|
IASTExpression typeofExpression= null;
|
||||||
|
@ -3259,10 +3264,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
encounteredTypename= true;
|
encounteredTypename= true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IToken.t_alignas:
|
|
||||||
alignmentSpecifiers = ArrayUtil.append(alignmentSpecifiers, alignmentSpecifier());
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IGCCToken.t__attribute__: // if __attribute__ is after the declSpec
|
case IGCCToken.t__attribute__: // if __attribute__ is after the declSpec
|
||||||
if (!supportAttributeSpecifiers)
|
if (!supportAttributeSpecifiers)
|
||||||
throwBacktrack(LA(1));
|
throwBacktrack(LA(1));
|
||||||
|
@ -3362,7 +3363,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
result= buildSimpleDeclSpec(storageClass, simpleType, options, isLong, typeofExpression, offset, endOffset);
|
result= buildSimpleDeclSpec(storageClass, simpleType, options, isLong, typeofExpression, offset, endOffset);
|
||||||
}
|
}
|
||||||
addAttributeSpecifiers(attributes, result);
|
addAttributeSpecifiers(attributes, result);
|
||||||
result.setAlignmentSpecifiers(ArrayUtil.trim(alignmentSpecifiers));
|
|
||||||
} catch (BacktrackException e) {
|
} catch (BacktrackException e) {
|
||||||
if (returnToken != null) {
|
if (returnToken != null) {
|
||||||
backup(returnToken);
|
backup(returnToken);
|
||||||
|
|
|
@ -11,14 +11,16 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.rewrite.astwriter;
|
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.IASTAttribute;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTAttributeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTAttributeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTToken;
|
import org.eclipse.cdt.core.dom.ast.IASTToken;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTokenList;
|
import org.eclipse.cdt.core.dom.ast.IASTTokenList;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTAttribute;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTAttribute;
|
||||||
import org.eclipse.cdt.core.dom.ast.gnu.IGCCASTAttributeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTAttributeList;
|
||||||
import org.eclipse.cdt.core.dom.parser.cpp.ICPPASTAttributeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.gnu.IGCCASTAttributeList;
|
||||||
import org.eclipse.cdt.core.parser.GCCKeywords;
|
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.parser.cpp.CPPASTAttribute;
|
||||||
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
||||||
|
|
||||||
|
@ -36,14 +38,27 @@ public class AttributeWriter extends NodeWriter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeAttributeSpecifier(IASTAttributeSpecifier attribute) {
|
public void writeAttributeSpecifier(IASTAttributeSpecifier attribute) {
|
||||||
if (attribute instanceof ICPPASTAttributeSpecifier) {
|
if (attribute instanceof ICPPASTAttributeList) {
|
||||||
writeAttributeSpecifier((ICPPASTAttributeSpecifier) attribute);
|
writeAttributeSpecifier((ICPPASTAttributeList) attribute);
|
||||||
} else if (attribute instanceof IGCCASTAttributeSpecifier) {
|
} else if (attribute instanceof IGCCASTAttributeList) {
|
||||||
writeGCCAttributeSpecifier((IGCCASTAttributeSpecifier) attribute);
|
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(GCCKeywords.__ATTRIBUTE__);
|
||||||
scribe.print(OPENING_PARENTHESIS);
|
scribe.print(OPENING_PARENTHESIS);
|
||||||
scribe.print(OPENING_PARENTHESIS);
|
scribe.print(OPENING_PARENTHESIS);
|
||||||
|
@ -60,7 +75,7 @@ public class AttributeWriter extends NodeWriter {
|
||||||
scribe.print(CLOSING_PARENTHESIS);
|
scribe.print(CLOSING_PARENTHESIS);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeAttributeSpecifier(ICPPASTAttributeSpecifier specifier) {
|
private void writeAttributeSpecifier(ICPPASTAttributeList specifier) {
|
||||||
scribe.print(OPENING_SQUARE_BRACKET);
|
scribe.print(OPENING_SQUARE_BRACKET);
|
||||||
scribe.print(OPENING_SQUARE_BRACKET);
|
scribe.print(OPENING_SQUARE_BRACKET);
|
||||||
IASTAttribute[] innerAttributes = specifier.getAttributes();
|
IASTAttribute[] innerAttributes = specifier.getAttributes();
|
||||||
|
|
|
@ -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.IASTAttributeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTComment;
|
import org.eclipse.cdt.core.dom.ast.IASTComment;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.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.dom.parser.cpp.ICPPASTAttributeSpecifier;
|
||||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||||
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
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) {
|
protected void writeGCCAttributes(IASTAttributeOwner attributeOwner, EnumSet<SpaceLocation> spaceLocations) {
|
||||||
IASTAttributeSpecifier[] specifiers = attributeOwner.getAttributeSpecifiers();
|
IASTAttributeSpecifier[] specifiers = attributeOwner.getAttributeSpecifiers();
|
||||||
IASTAttributeSpecifier[] gnuSpecifiers = ArrayUtil.filter(specifiers, IGCCASTAttributeSpecifier.TYPE_FILTER);
|
IASTAttributeSpecifier[] gnuSpecifiers = ArrayUtil.filter(specifiers, IGCCASTAttributeList.TYPE_FILTER);
|
||||||
writeAttributes(gnuSpecifiers, spaceLocations);
|
writeAttributes(gnuSpecifiers, spaceLocations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue