mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 01:36:01 +02:00
Bug 303084 - [formatter] Formatting placement new as macro yields syntax error
This commit is contained in:
parent
88ba647612
commit
b9fcfb7d29
1 changed files with 12 additions and 6 deletions
|
@ -1836,11 +1836,17 @@ public class CodeFormatterVisitor extends CPPASTVisitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formats given expression as a function call, ie. enclosed in parenthesis.
|
* Formats given expressions as a function call, ie. enclosed in parenthesis.
|
||||||
*
|
*
|
||||||
* @param argumentExpr the argument expression, may be <code>null</code>
|
* @param args the argument expressions, may be <code>null</code>
|
||||||
*/
|
*/
|
||||||
private void formatFunctionCallArguments(IASTInitializerClause[] args) {
|
private void formatFunctionCallArguments(IASTInitializerClause[] args) {
|
||||||
|
// check for macro
|
||||||
|
if (peekNextToken() != Token.tLPAREN) {
|
||||||
|
if (args == null || args.length == 0 || enclosedInMacroExpansion(args[0])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
final List<IASTInitializerClause> expressions;
|
final List<IASTInitializerClause> expressions;
|
||||||
if (args != null) {
|
if (args != null) {
|
||||||
expressions= Arrays.asList(args);
|
expressions= Arrays.asList(args);
|
||||||
|
@ -2318,10 +2324,10 @@ public class CodeFormatterVisitor extends CPPASTVisitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
private int visit(ICPPASTSimpleTypeConstructorExpression node) {
|
private int visit(ICPPASTSimpleTypeConstructorExpression node) {
|
||||||
// tletodo The first part of the expression can consist of multiple tokens
|
IASTDeclSpecifier declSpec = node.getDeclSpecifier();
|
||||||
scribe.printNextToken(peekNextToken());
|
declSpec.accept(this);
|
||||||
final IASTExpression operand= node.getInitialValue();
|
IASTInitializer initializer = node.getInitializer();
|
||||||
formatParenthesizedExpression(operand);
|
initializer.accept(this);
|
||||||
return PROCESS_SKIP;
|
return PROCESS_SKIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue