Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2012-08-17 17:01:33 -0400
committerSergey Prigogin2012-08-17 17:01:33 -0400
commitae8af8e02fcdf3bc41cf90483954d95183c8e415 (patch)
treed46ade8af69b93d4335a6c79b90d737f66c283b9
parentd89b672a9733d8fe40258958573673321519ef5e (diff)
downloadorg.eclipse.cdt-ae8af8e02fcdf3bc41cf90483954d95183c8e415.tar.gz
org.eclipse.cdt-ae8af8e02fcdf3bc41cf90483954d95183c8e415.tar.xz
org.eclipse.cdt-ae8af8e02fcdf3bc41cf90483954d95183c8e415.zip
Bug 327300. Parsing support for noexcept operators and noexcept
specifications in function declarators. Adjustments for CDT 8.1.x.
-rw-r--r--core/org.eclipse.cdt.core/.settings/.api_filters7
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTUnaryExpression.java1
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTFunctionDeclarator.java22
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionDeclarator.java14
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclaratorWriter.java3
7 files changed, 31 insertions, 21 deletions
diff --git a/core/org.eclipse.cdt.core/.settings/.api_filters b/core/org.eclipse.cdt.core/.settings/.api_filters
index 00ccfe7900..667f53987a 100644
--- a/core/org.eclipse.cdt.core/.settings/.api_filters
+++ b/core/org.eclipse.cdt.core/.settings/.api_filters
@@ -30,6 +30,13 @@
</message_arguments>
</filter>
</resource>
+ <resource path="parser/org/eclipse/cdt/core/dom/ast/IASTUnaryExpression.java" type="org.eclipse.cdt.core.dom.ast.IASTUnaryExpression">
+ <filter id="1211105284">
+ <message_arguments>
+ <message_argument value="op_noexcept"/>
+ </message_arguments>
+ </filter>
+ </resource>
<resource path="parser/org/eclipse/cdt/core/dom/ast/IScope.java" type="org.eclipse.cdt.core.dom.ast.IScope$ScopeLookupData">
<filter id="1211105284">
<message_arguments>
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTUnaryExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTUnaryExpression.java
index 919ac7a981..1708859462 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTUnaryExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTUnaryExpression.java
@@ -119,7 +119,6 @@ public interface IASTUnaryExpression extends IASTExpression {
/**
* For c++, only: noexcept ( expression )
- * @since 5.5
*/
public static final int op_noexcept = 17;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTFunctionDeclarator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTFunctionDeclarator.java
index d9f1542c73..4a6c53e839 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTFunctionDeclarator.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTFunctionDeclarator.java
@@ -15,8 +15,6 @@ package org.eclipse.cdt.core.dom.ast.cpp;
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
import org.eclipse.cdt.core.dom.ast.IASTStandardFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
-import org.eclipse.cdt.core.parser.Keywords;
-import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTLiteralExpression;
/**
* C++ adds a few things to function declarators.
@@ -31,18 +29,8 @@ public interface ICPPASTFunctionDeclarator extends IASTStandardFunctionDeclarato
*/
public static final IASTTypeId[] NO_EXCEPTION_SPECIFICATION = {};
- /**
- * Represents a 'noexcept' specification without an expression.
- * @since 5.5
- */
- public static final ICPPASTLiteralExpression NOEXCEPT_DEFAULT =
- new CPPASTLiteralExpression(ICPPASTLiteralExpression.lk_true, Keywords.cTRUE);
-
public static final ASTNodeProperty EXCEPTION_TYPEID = new ASTNodeProperty(
"ICPPASTFunctionDeclarator.EXCEPTION_TYPEID [IASTTypeId]"); //$NON-NLS-1$
- /** @since 5.5 */
- public static final ASTNodeProperty NOEXCEPT_EXPRESSION = new ASTNodeProperty(
- "ICPPASTFunctionDeclarator.NOEXCEPT_EXPRESSION [ICPPASTExpression]"); //$NON-NLS-1$
/** @since 5.2 */
public static final ASTNodeProperty TRAILING_RETURN_TYPE = new ASTNodeProperty(
"ICPPASTFunctionDeclarator.TRAILING_RETURN_TYPE [IASTTypeId]"); //$NON-NLS-1$
@@ -115,16 +103,18 @@ public interface ICPPASTFunctionDeclarator extends IASTStandardFunctionDeclarato
public void setEmptyExceptionSpecification();
/**
- * Returns the noexcept expression, {@link #NOEXCEPT_DEFAULT} if the noexcept specification
- * does not contain an expression, or {@code null} the noexcept specification is not present.
+ * Returns the noexcept expression, {@link
+ * org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTFunctionDeclarator#NOEXCEPT_DEFAULT}
+ * if the noexcept specification does not contain an expression, or {@code null} the noexcept
+ * specification is not present.
* See C++11 5.4.1.
- * @since 5.5
+ * @noreference This method is not intended to be referenced by clients.
*/
public ICPPASTExpression getNoexceptExpression();
/**
* Sets the noexcept expression.
- * @since 5.5
+ * @noreference This method is not intended to be referenced by clients.
*/
public void setNoexceptExpression(ICPPASTExpression expression);
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionDeclarator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionDeclarator.java
index 649fdc8879..acdd8d9fed 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionDeclarator.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionDeclarator.java
@@ -12,6 +12,7 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
+import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTName;
@@ -21,8 +22,10 @@ import org.eclipse.cdt.core.dom.ast.IASTTypeId;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDefinition;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLiteralExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTParameterDeclaration;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionScope;
+import org.eclipse.cdt.core.parser.Keywords;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
@@ -32,7 +35,16 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
*/
public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements ICPPASTFunctionDeclarator,
IASTAmbiguityParent {
- private ICPPASTParameterDeclaration[] parameters;
+ /**
+ * Represents a 'noexcept' specification without an expression.
+ */
+ public static final ICPPASTLiteralExpression NOEXCEPT_DEFAULT =
+ new CPPASTLiteralExpression(ICPPASTLiteralExpression.lk_true, Keywords.cTRUE);
+
+ public static final ASTNodeProperty NOEXCEPT_EXPRESSION = new ASTNodeProperty(
+ "ICPPASTFunctionDeclarator.NOEXCEPT_EXPRESSION [ICPPASTExpression]"); //$NON-NLS-1$
+
+ private ICPPASTParameterDeclaration[] parameters;
private IASTTypeId[] typeIds = NO_EXCEPTION_SPECIFICATION;
private ICPPASTExpression noexceptExpression;
private IASTTypeId trailingReturnType;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
index 2c960038b6..93f1881c11 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
@@ -3964,7 +3964,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
expression = expression();
endOffset = consume(IToken.tRPAREN).getEndOffset(); // )
} else {
- expression = ICPPASTFunctionDeclarator.NOEXCEPT_DEFAULT;
+ expression = CPPASTFunctionDeclarator.NOEXCEPT_DEFAULT;
}
fc.setNoexceptExpression((ICPPASTExpression) expression);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java
index 330b4c9d17..a1e5188afc 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java
@@ -168,6 +168,7 @@ import org.eclipse.cdt.internal.core.dom.parser.SizeofCalculator;
import org.eclipse.cdt.internal.core.dom.parser.Value;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTFieldReference;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTFunctionCallExpression;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTFunctionDeclarator;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTIdExpression;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTTranslationUnit;
@@ -1002,7 +1003,7 @@ public class CPPVisitor extends ASTQueries {
}
} else if (node instanceof IASTParameterDeclaration ||
- node.getPropertyInParent() == ICPPASTFunctionDeclarator.NOEXCEPT_EXPRESSION) {
+ node.getPropertyInParent() == CPPASTFunctionDeclarator.NOEXCEPT_EXPRESSION) {
IASTNode parent = node.getParent();
if (parent instanceof ICPPASTFunctionDeclarator) {
IScope result = scopeViaFunctionDtor((ICPPASTFunctionDeclarator) parent);
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclaratorWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclaratorWriter.java
index 37ed8922ed..c5e1c1c764 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclaratorWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclaratorWriter.java
@@ -32,6 +32,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTPointerToMember;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTReferenceOperator;
import org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator;
import org.eclipse.cdt.core.parser.Keywords;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTFunctionDeclarator;
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
/**
@@ -164,7 +165,7 @@ public class DeclaratorWriter extends NodeWriter {
if (noexceptExpression != null) {
scribe.printSpace();
scribe.print(Keywords.NOEXCEPT);
- if (noexceptExpression != ICPPASTFunctionDeclarator.NOEXCEPT_DEFAULT) {
+ if (noexceptExpression != CPPASTFunctionDeclarator.NOEXCEPT_DEFAULT) {
scribe.printSpace();
scribe.print('(');
noexceptExpression.accept(visitor);

Back to the top