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

Bug 397496. A missing piece of the previous fix.

This commit is contained in:
Sergey Prigogin 2013-01-06 21:26:24 -08:00
parent e679870821
commit 3602ab4d96

View file

@ -3885,20 +3885,22 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
if (currentOffset > nodeEndOffset) {
return;
}
IASTNodeLocation[] locations= node.getNodeLocations();
for (int i= 0; i < locations.length; i++) {
IASTNodeLocation nodeLocation= locations[i];
if (nodeLocation instanceof IASTMacroExpansionLocation) {
IASTFileLocation expansionLocation= nodeLocation.asFileLocation();
int startOffset= expansionLocation.getNodeOffset();
int endOffset= startOffset + expansionLocation.getNodeLength();
if (currentOffset <= startOffset) {
break;
}
if (currentOffset < endOffset ||
currentOffset == endOffset && i == locations.length - 1) {
scribe.skipRange(startOffset, endOffset);
break;
if (!fInsideMacroArguments) {
IASTNodeLocation[] locations= node.getNodeLocations();
for (int i= 0; i < locations.length; i++) {
IASTNodeLocation nodeLocation= locations[i];
if (nodeLocation instanceof IASTMacroExpansionLocation) {
IASTFileLocation expansionLocation= nodeLocation.asFileLocation();
int startOffset= expansionLocation.getNodeOffset();
int endOffset= startOffset + expansionLocation.getNodeLength();
if (currentOffset <= startOffset) {
break;
}
if (currentOffset < endOffset ||
currentOffset == endOffset && i == locations.length - 1) {
scribe.skipRange(startOffset, endOffset);
break;
}
}
}
}