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:
parent
8c16f89d45
commit
69665fb352
2 changed files with 14 additions and 2 deletions
|
@ -92,3 +92,10 @@ int b, a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//!ICPPASTReferenceOperator rvalue reference
|
||||||
|
//%CPP
|
||||||
|
int && foo(int && a)
|
||||||
|
{
|
||||||
|
char && b;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@ import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
|
||||||
public class DeclaratorWriter extends NodeWriter {
|
public class DeclaratorWriter extends NodeWriter {
|
||||||
|
|
||||||
private static final String AMPERSAND_SPACE = "& "; //$NON-NLS-1$
|
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 STAR_SPACE = "* "; //$NON-NLS-1$
|
||||||
private static final String PURE_VIRTUAL = " =0"; //$NON-NLS-1$
|
private static final String PURE_VIRTUAL = " =0"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@ -197,8 +198,12 @@ public class DeclaratorWriter extends NodeWriter {
|
||||||
if (operator instanceof IASTPointer) {
|
if (operator instanceof IASTPointer) {
|
||||||
IASTPointer pointOp = (IASTPointer) operator;
|
IASTPointer pointOp = (IASTPointer) operator;
|
||||||
writePointer(pointOp);
|
writePointer(pointOp);
|
||||||
}else if (operator instanceof ICPPASTReferenceOperator) {
|
} else if (operator instanceof ICPPASTReferenceOperator) {
|
||||||
scribe.print(AMPERSAND_SPACE);
|
if (((ICPPASTReferenceOperator) operator).isRValueReference()) {
|
||||||
|
scribe.print(AMPERSAND__AMPERSAND_SPACE);
|
||||||
|
} else {
|
||||||
|
scribe.print(AMPERSAND_SPACE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue