mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
Bug 329165 - Formatter corrupts code
This commit is contained in:
parent
8f01b54586
commit
63365064b7
2 changed files with 27 additions and 2 deletions
|
@ -1063,15 +1063,19 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
|||
private int visit(ICPPASTFunctionDeclarator node) {
|
||||
visit((IASTStandardFunctionDeclarator)node);
|
||||
|
||||
skipConstVolatileRestrict();
|
||||
|
||||
boolean needSpace = skipConstVolatileRestrict();
|
||||
|
||||
final IASTTypeId[] exceptionSpecification= node.getExceptionSpecification();
|
||||
if (exceptionSpecification != null) {
|
||||
if (peekNextToken() == Token.t_throw) {
|
||||
formatExceptionSpecification(exceptionSpecification);
|
||||
needSpace = false;
|
||||
}
|
||||
}
|
||||
// skip the rest (=0)
|
||||
if (needSpace && scribe.printComment()) {
|
||||
scribe.space();
|
||||
}
|
||||
skipNode(node);
|
||||
return PROCESS_SKIP;
|
||||
}
|
||||
|
@ -1512,6 +1516,8 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
|||
} finally {
|
||||
endOfNode(declaration);
|
||||
}
|
||||
} else {
|
||||
skipNode(declaration);
|
||||
}
|
||||
if (preferences.indent_body_declarations_compare_to_access_specifier) {
|
||||
scribe.unIndent();
|
||||
|
|
|
@ -1382,6 +1382,25 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
assertFormatterResult();
|
||||
}
|
||||
|
||||
////#define throws /* */
|
||||
//struct Foo {
|
||||
// void foo() const throws {
|
||||
// }
|
||||
// void bar() const throws {
|
||||
// }
|
||||
//};
|
||||
|
||||
////#define throws /* */
|
||||
//struct Foo {
|
||||
// void foo() const throws {
|
||||
// }
|
||||
// void bar() const throws {
|
||||
// }
|
||||
//};
|
||||
public void testCodeCorruptionWithIllegalKeyword_Bug329165() throws Exception {
|
||||
assertFormatterResult();
|
||||
}
|
||||
|
||||
//void extend_terminal_bond_to_label(vector<atom_t> &atom, const vector<letters_t> &letters, int n_letters, const vector<bond_t> &bond, int n_bond, const vector<label_t> &label, int n_label, double avg, double maxh, double max_dist_double_bond);
|
||||
|
||||
//void extend_terminal_bond_to_label(vector<atom_t> &atom,
|
||||
|
|
Loading…
Add table
Reference in a new issue