1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 01:36:01 +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) { if (currentOffset > nodeEndOffset) {
return; return;
} }
IASTNodeLocation[] locations= node.getNodeLocations(); if (!fInsideMacroArguments) {
for (int i= 0; i < locations.length; i++) { IASTNodeLocation[] locations= node.getNodeLocations();
IASTNodeLocation nodeLocation= locations[i]; for (int i= 0; i < locations.length; i++) {
if (nodeLocation instanceof IASTMacroExpansionLocation) { IASTNodeLocation nodeLocation= locations[i];
IASTFileLocation expansionLocation= nodeLocation.asFileLocation(); if (nodeLocation instanceof IASTMacroExpansionLocation) {
int startOffset= expansionLocation.getNodeOffset(); IASTFileLocation expansionLocation= nodeLocation.asFileLocation();
int endOffset= startOffset + expansionLocation.getNodeLength(); int startOffset= expansionLocation.getNodeOffset();
if (currentOffset <= startOffset) { int endOffset= startOffset + expansionLocation.getNodeLength();
break; if (currentOffset <= startOffset) {
} break;
if (currentOffset < endOffset || }
currentOffset == endOffset && i == locations.length - 1) { if (currentOffset < endOffset ||
scribe.skipRange(startOffset, endOffset); currentOffset == endOffset && i == locations.length - 1) {
break; scribe.skipRange(startOffset, endOffset);
break;
}
} }
} }
} }