diff options
author | Anton Leherbauer | 2009-01-29 09:16:37 +0000 |
---|---|---|
committer | Anton Leherbauer | 2009-01-29 09:16:37 +0000 |
commit | 6e17efaddef4867d55639f46c2ffbaa65bd44a86 (patch) | |
tree | b7e93321b720bb96bb33cc4c4166575eb1907b74 /core/org.eclipse.cdt.core | |
parent | 86c7af6e76554fc57f581cd33823e9237ac7c3b7 (diff) | |
download | org.eclipse.cdt-6e17efaddef4867d55639f46c2ffbaa65bd44a86.tar.gz org.eclipse.cdt-6e17efaddef4867d55639f46c2ffbaa65bd44a86.tar.xz org.eclipse.cdt-6e17efaddef4867d55639f46c2ffbaa65bd44a86.zip |
Bug 262536 - [formatter] Problems with extern "C"
Diffstat (limited to 'core/org.eclipse.cdt.core')
-rw-r--r-- | core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java index bc00a51b600..3ebfbcb083b 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java @@ -771,11 +771,7 @@ public class CodeFormatterVisitor extends CPPASTVisitor { scribe.startNewLine(); for (int i = 0; i < memberDecls.length; i++) { IASTDeclaration declaration = memberDecls[i]; - if (declaration instanceof ICPPASTVisibilityLabel) { - visit((ICPPASTVisibilityLabel)declaration); - } else { - declaration.accept(this); - } + declaration.accept(this); scribe.startNewLine(); } if (preferences.indent_body_declarations_compare_to_namespace_header) { @@ -799,26 +795,27 @@ public class CodeFormatterVisitor extends CPPASTVisitor { // member declarations IASTDeclaration[] memberDecls= node.getDeclarations(); - // TLETODO [formatter] need options for linkage specification - formatLeftCurlyBrace(line, preferences.brace_position_for_namespace_declaration); - formatOpeningBrace(preferences.brace_position_for_namespace_declaration, preferences.insert_space_before_opening_brace_in_namespace_declaration); - if (preferences.indent_body_declarations_compare_to_namespace_header) { - scribe.indent(); - } - scribe.startNewLine(); - for (int i = 0; i < memberDecls.length; i++) { - IASTDeclaration declaration = memberDecls[i]; - if (declaration instanceof ICPPASTVisibilityLabel) { - visit((ICPPASTVisibilityLabel)declaration); - } else { - declaration.accept(this); + if (memberDecls.length == 1 && peekNextToken() != Token.tLBRACE) { + scribe.space(); + memberDecls[0].accept(this); + } else { + // TLETODO [formatter] need options for linkage specification + formatLeftCurlyBrace(line, preferences.brace_position_for_namespace_declaration); + formatOpeningBrace(preferences.brace_position_for_namespace_declaration, preferences.insert_space_before_opening_brace_in_namespace_declaration); + if (preferences.indent_body_declarations_compare_to_namespace_header) { + scribe.indent(); } scribe.startNewLine(); + for (int i = 0; i < memberDecls.length; i++) { + IASTDeclaration declaration = memberDecls[i]; + declaration.accept(this); + scribe.startNewLine(); + } + if (preferences.indent_body_declarations_compare_to_namespace_header) { + scribe.unIndent(); + } + formatClosingBrace(preferences.brace_position_for_namespace_declaration); } - if (preferences.indent_body_declarations_compare_to_namespace_header) { - scribe.unIndent(); - } - formatClosingBrace(preferences.brace_position_for_namespace_declaration); return PROCESS_SKIP; } |