1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 319044 DeclaratorWriter unable to write a rvalue reference (patch from Tomasz Wesolowski)

This commit is contained in:
Alena Laskavaia 2010-08-01 23:46:36 +00:00
parent 8c16f89d45
commit 69665fb352
2 changed files with 14 additions and 2 deletions

View file

@ -92,3 +92,10 @@ int b, a;
}
//!ICPPASTReferenceOperator rvalue reference
//%CPP
int && foo(int && a)
{
char && b;
}

View file

@ -48,6 +48,7 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
public class DeclaratorWriter extends NodeWriter {
private static final String AMPERSAND_SPACE = "& "; //$NON-NLS-1$
private static final String AMPERSAND__AMPERSAND_SPACE = "&& "; //$NON-NLS-1$
private static final String STAR_SPACE = "* "; //$NON-NLS-1$
private static final String PURE_VIRTUAL = " =0"; //$NON-NLS-1$
@ -197,10 +198,14 @@ public class DeclaratorWriter extends NodeWriter {
if (operator instanceof IASTPointer) {
IASTPointer pointOp = (IASTPointer) operator;
writePointer(pointOp);
}else if (operator instanceof ICPPASTReferenceOperator) {
} else if (operator instanceof ICPPASTReferenceOperator) {
if (((ICPPASTReferenceOperator) operator).isRValueReference()) {
scribe.print(AMPERSAND__AMPERSAND_SPACE);
} else {
scribe.print(AMPERSAND_SPACE);
}
}
}
private void writeArrayDeclarator(IASTArrayDeclarator arrDecl) {
IASTPointerOperator[] pointOps = arrDecl.getPointerOperators();