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

Bug 353974 - Formatting C code does not work for certain uses of static_cast

This commit is contained in:
Anton Leherbauer 2011-08-05 12:44:03 +02:00
parent 2d8f61dc4f
commit 35a5ad9dbb
2 changed files with 20 additions and 1 deletions

View file

@ -2366,7 +2366,12 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
if (preferences.insert_space_after_opening_paren_in_method_invocation) {
scribe.space();
}
node.getOperand().accept(this);
Runnable tailFormatter = scribe.takeTailFormatter();
try {
node.getOperand().accept(this);
} finally {
scribe.setTailFormatter(tailFormatter);
}
scribe.printNextToken(Token.tRPAREN, preferences.insert_space_before_closing_paren_in_method_invocation);
break;
default:

View file

@ -2480,4 +2480,18 @@ public class CodeFormatterTest extends BaseUITestCase {
fOptions.putAll(DefaultCodeFormatterOptions.getAllmanSettings().getMap());
assertFormatterResult();
}
//void f() {
// int i = static_cast<int>(5+1);
// int j;
//}
//void f() {
// int i = static_cast<int>(5 + 1);
// int j;
//}
public void testStaticCastInInitializer_Bug353974() throws Exception {
assertFormatterResult();
}
}