1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 10:46:02 +02:00

Bug 285901 - Format function does not work properly when define constant to type cast

This commit is contained in:
Anton Leherbauer 2010-01-15 11:37:35 +00:00
parent 3b8ad5a4cd
commit a75cc9c45a
2 changed files with 18 additions and 2 deletions

View file

@ -1886,8 +1886,15 @@ public class CodeFormatterVisitor extends CPPASTVisitor {
scribe.space();
}
node.getTypeId().accept(this);
scribe.printNextToken(Token.tRPAREN, preferences.insert_space_before_closing_paren_in_cast);
if (preferences.insert_space_after_closing_paren_in_cast) {
try {
if (node.getTypeId().getTrailingSyntax().getType() == IToken.tRPAREN) {
scribe.printNextToken(Token.tRPAREN, preferences.insert_space_before_closing_paren_in_cast);
if (preferences.insert_space_after_closing_paren_in_cast) {
scribe.space();
}
}
} catch (UnsupportedOperationException exc) {
} catch (ExpansionOverlapsBoundaryException exc) {
scribe.space();
}
// operand

View file

@ -1347,4 +1347,13 @@ public class CodeFormatterTest extends BaseUITestCase {
public void testWideStringLiteral_Bug292626() throws Exception {
assertFormatterResult();
}
//#define INT (int)
//int i = INT 1;
//#define INT (int)
//int i = INT 1;
public void testCastAsMacro_Bug285901() throws Exception {
assertFormatterResult();
}
}