mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-03 14:25:37 +02:00
Bug 298593 - Formatter breaks the code when #defining a placement new
This commit is contained in:
parent
88e259d1f8
commit
a05892cd10
2 changed files with 15 additions and 14 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2009 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2006, 2010 Wind River Systems, Inc. and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -2928,18 +2928,7 @@ public class CodeFormatterVisitor extends CPPASTVisitor {
|
|||
break;
|
||||
}
|
||||
else if (currentOffset == endOffset && i == locations.length - 1) {
|
||||
if (node instanceof IASTExpressionList) {
|
||||
IASTNode parent= node.getParent();
|
||||
if (parent != null) {
|
||||
IASTFileLocation parentLocation= parent.getFileLocation();
|
||||
int parentEndOffset= parentLocation.getNodeOffset() + parentLocation.getNodeLength();
|
||||
if (parentEndOffset == endOffset) {
|
||||
scribe.skipRange(startOffset, endOffset);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
scribe.skipRange(startOffset, endOffset);
|
||||
}
|
||||
scribe.skipRange(startOffset, endOffset);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1307,7 +1307,19 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
//
|
||||
// return 0;
|
||||
//}
|
||||
public void testControlStatementsAsMacro_Bug290630() throws Exception {
|
||||
public void testControlStatementsAsMacro_Bug290630() throws Exception {
|
||||
assertFormatterResult();
|
||||
}
|
||||
|
||||
//#define new new(__FILE__, __LINE__)
|
||||
//void func() {char* a = new char[10];}
|
||||
|
||||
//#define new new(__FILE__, __LINE__)
|
||||
//void func() {
|
||||
// char* a = new char[10];
|
||||
//}
|
||||
public void testPlacementNewAsMacro_Bug298593() throws Exception {
|
||||
assertFormatterResult();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue