1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-06 17:26:01 +02:00

Bug 527179: ExpressionWriter removes nested noexcept expressions

Change-Id: I7c032e9327756704690760f3207c73f1645deb19
Signed-off-by: Hansruedi Patzen <hansruedi.patzen@hsr.ch>
This commit is contained in:
Hansruedi Patzen 2017-11-13 10:13:22 +01:00 committed by Thomas Corbat
parent 1bf0dff19f
commit b721d6a424
2 changed files with 32 additions and 2 deletions

View file

@ -145,4 +145,29 @@ struct S
virtual void memFun() final
{
}
};
};
//!Noexcept without expression specifiers
//%CPP
void foo() noexcept
{
}
//!Noexcept with expression specifiers
//%CPP
void foo() noexcept (1 + 1)
{
}
//!Nested noexcept specifiers
//%CPP
void foo() noexcept (noexcept (1 + 1))
{
}
//!Multiple nested noexcept specifiers
//%CPP
void foo() noexcept (noexcept (1 + 1) && noexcept (2 + 3))
{
}

View file

@ -71,6 +71,7 @@ public class ExpressionWriter extends NodeWriter{
private static final String OPEN_BRACKET_OP = "("; //$NON-NLS-1$
private static final String SIZEOF_OP = "sizeof "; //$NON-NLS-1$
private static final String SIZEOF_PARAMETER_PACK_OP = "sizeof..."; //$NON-NLS-1$
private static final String NOEXCEPT_OP = "noexcept ("; //$NON-NLS-1$
private static final String NOT_OP = "!"; //$NON-NLS-1$
private static final String TILDE_OP = "~"; //$NON-NLS-1$
private static final String AMPERSAND_OP = "&"; //$NON-NLS-1$
@ -253,6 +254,7 @@ public class ExpressionWriter extends NodeWriter{
case IASTUnaryExpression.op_bracketedPrimary:
case ICPPASTUnaryExpression.op_throw:
case ICPPASTUnaryExpression.op_typeid:
case ICPPASTUnaryExpression.op_noexcept:
case IASTUnaryExpression.op_alignOf:
case IASTUnaryExpression.op_labelReference:
return true;
@ -269,6 +271,7 @@ public class ExpressionWriter extends NodeWriter{
case IASTUnaryExpression.op_postFixIncr:
case IASTUnaryExpression.op_bracketedPrimary:
case ICPPASTUnaryExpression.op_typeid:
case ICPPASTUnaryExpression.op_noexcept:
case IASTUnaryExpression.op_alignOf:
return true;
@ -306,6 +309,8 @@ public class ExpressionWriter extends NodeWriter{
return THROW;
case ICPPASTUnaryExpression.op_typeid:
return TYPEID_OP;
case ICPPASTUnaryExpression.op_noexcept:
return NOEXCEPT_OP;
case IASTUnaryExpression.op_alignOf:
return ALIGNOF_OP;
case IASTUnaryExpression.op_labelReference:
@ -324,7 +329,7 @@ public class ExpressionWriter extends NodeWriter{
case IASTUnaryExpression.op_postFixIncr:
return INCREMENT_OP;
case ICPPASTUnaryExpression.op_typeid:
return CLOSING_BRACKET_OP;
case ICPPASTUnaryExpression.op_noexcept:
case IASTUnaryExpression.op_bracketedPrimary:
case IASTUnaryExpression.op_alignOf:
return CLOSING_BRACKET_OP;