mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Bug 533319: ASTRewrite parameter pack wrong pointer operators position
Change-Id: I4798afa95d66aeed04b155ccd62a2b133f579296 Signed-off-by: Hansruedi Patzen <hansruedi.patzen@hsr.ch>
This commit is contained in:
parent
a10fc3eafe
commit
54287859f0
2 changed files with 55 additions and 9 deletions
|
@ -178,3 +178,49 @@ constexpr long double operator ""_deg(long double deg)
|
|||
{
|
||||
return deg * 3.141592 / 180;
|
||||
}
|
||||
|
||||
//!Memberfunction with varargs parameter without pointer ops
|
||||
//%CPP
|
||||
struct Foo
|
||||
{
|
||||
template<typename... ARGS>
|
||||
void bar(ARGS... args)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
//!Memberfunction with varargs parameter with pointer ops
|
||||
//%CPP
|
||||
struct Foo
|
||||
{
|
||||
template<typename... ARGS>
|
||||
void bar(ARGS&&... args)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
//!Template function with varargs parameter without pointer ops
|
||||
//%CPP
|
||||
template<typename... ARGS>
|
||||
void foo(ARGS... args)
|
||||
{
|
||||
}
|
||||
|
||||
//!Template function with varargs parameter with pointer ops
|
||||
//%CPP
|
||||
template<typename... ARGS>
|
||||
void foo(ARGS&&... args)
|
||||
{
|
||||
}
|
||||
|
||||
//!Function with varargs parameter without pointer ops
|
||||
//%CPP
|
||||
void foo(int arg, ...)
|
||||
{
|
||||
}
|
||||
|
||||
//!Function with varargs parameter with pointer ops
|
||||
//%CPP
|
||||
void foo(int&& arg, ...)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -66,8 +66,6 @@ public class DeclaratorWriter extends NodeWriter {
|
|||
writeFieldDeclarator((IASTFieldDeclarator) declarator);
|
||||
} else if (declarator instanceof ICASTKnRFunctionDeclarator) {
|
||||
writeCKnRFunctionDeclarator((ICASTKnRFunctionDeclarator) declarator);
|
||||
} else if (declarator instanceof ICPPASTDeclarator) {
|
||||
writeCPPDeclarator((ICPPASTDeclarator) declarator);
|
||||
} else {
|
||||
writeDefaultDeclarator(declarator);
|
||||
}
|
||||
|
@ -79,6 +77,7 @@ public class DeclaratorWriter extends NodeWriter {
|
|||
protected void writeDefaultDeclarator(IASTDeclarator declarator) {
|
||||
IASTPointerOperator[] pointOps = declarator.getPointerOperators();
|
||||
writePointerOperators(declarator, pointOps);
|
||||
writeParameterPack(declarator);
|
||||
IASTName name = declarator.getName();
|
||||
name.accept(visitor);
|
||||
writeNestedDeclarator(declarator);
|
||||
|
@ -97,6 +96,14 @@ public class DeclaratorWriter extends NodeWriter {
|
|||
}
|
||||
}
|
||||
|
||||
private void writeParameterPack(IASTDeclarator declarator) {
|
||||
if (declarator instanceof ICPPASTDeclarator) {
|
||||
if (((ICPPASTDeclarator) declarator).declaresParameterPack()) {
|
||||
scribe.print(VAR_ARGS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void writeFunctionDeclarator(IASTStandardFunctionDeclarator funcDec) {
|
||||
IASTPointerOperator[] pointOps = funcDec.getPointerOperators();
|
||||
writePointerOperators(funcDec, pointOps);
|
||||
|
@ -330,11 +337,4 @@ public class DeclaratorWriter extends NodeWriter {
|
|||
protected void writeKnRParameterNames(ICASTKnRFunctionDeclarator knrFunct, IASTName[] parameterNames) {
|
||||
writeNodeList(parameterNames);
|
||||
}
|
||||
|
||||
protected void writeCPPDeclarator(ICPPASTDeclarator declarator) {
|
||||
if (declarator.declaresParameterPack()) {
|
||||
scribe.print(VAR_ARGS);
|
||||
}
|
||||
writeDefaultDeclarator(declarator);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue