mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 09:46:02 +02:00
Formatter bug fixes.
This commit is contained in:
parent
3452064a2f
commit
ae5c304eec
2 changed files with 24 additions and 8 deletions
|
@ -3384,15 +3384,13 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
|||
}
|
||||
int nextToken= peekNextToken();
|
||||
if (node.getPropertyInParent() != ICPPASTQualifiedName.SEGMENT_NAME || nextToken == Token.tGT) {
|
||||
if (node.getParent().getPropertyInParent() == IASTFunctionCallExpression.FUNCTION_NAME &&
|
||||
preferences.insert_space_before_opening_paren_in_method_invocation) {
|
||||
scribe.space();
|
||||
} else if (node.getParent().getPropertyInParent() != IASTFunctionCallExpression.FUNCTION_NAME &&
|
||||
preferences.insert_space_after_closing_angle_bracket_in_template_arguments) {
|
||||
// Avoid explicit space if followed by '*' or '&'.
|
||||
if (nextToken != Token.tSTAR && nextToken != Token.tAMPER) {
|
||||
if (nextToken == Token.tLPAREN) {
|
||||
if (preferences.insert_space_before_opening_paren_in_method_invocation)
|
||||
scribe.space();
|
||||
} else if (preferences.insert_space_after_closing_angle_bracket_in_template_arguments) {
|
||||
// Avoid explicit space if followed by '*' or '&'.
|
||||
if (nextToken != Token.tSTAR && nextToken != Token.tAMPER)
|
||||
scribe.space();
|
||||
}
|
||||
} else {
|
||||
scribe.printComment();
|
||||
scribe.needSpace= false;
|
||||
|
|
|
@ -1244,6 +1244,24 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
assertFormatterResult();
|
||||
}
|
||||
|
||||
//template<typename T>
|
||||
//class A {
|
||||
//};
|
||||
//
|
||||
//A<int> a = new A <int> ();
|
||||
//A<int> b = A <int> ();
|
||||
|
||||
//template<typename T>
|
||||
//class A {
|
||||
//};
|
||||
//
|
||||
//A<int> a = new A<int>();
|
||||
//A<int> b = A<int>();
|
||||
public void testTemplateConstructorCall() throws Exception {
|
||||
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, CCorePlugin.SPACE);
|
||||
assertFormatterResult();
|
||||
}
|
||||
|
||||
//#define MY_MACRO int a; \
|
||||
// int b; \
|
||||
// int c();
|
||||
|
|
Loading…
Add table
Reference in a new issue