1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00

Fix invocation of macro expansion tool.

This commit is contained in:
Markus Schorn 2008-03-14 15:54:05 +00:00
parent dbbd26805c
commit 831dd9ee1f

View file

@ -108,15 +108,24 @@ public class CMacroExpansionInput {
fEnclosingNode= nodeSelector.findEnclosingNode(fTextRegion.getOffset(), fTextRegion.getLength());
if (fEnclosingNode != null) {
boolean macroOccurrence= false;
IASTNodeLocation[] locations= fEnclosingNode.getNodeLocations();
for (int i = 0; i < locations.length; i++) {
IASTNodeLocation location= locations[i];
if (location instanceof IASTMacroExpansionLocation) {
IASTFileLocation fileLocation= location.asFileLocation();
if (fileLocation != null && ast.getFilePath().equals(fileLocation.getFileName())) {
if (fTextRegion.overlapsWith(fileLocation.getNodeOffset(), fileLocation.getNodeLength())) {
addExpansionNode(nodeSelector.findEnclosingNode(fileLocation.getNodeOffset(), fileLocation.getNodeLength()));
macroOccurrence= true;
if (fEnclosingNode.getParent() instanceof IASTPreprocessorMacroExpansion) {
fEnclosingNode= fEnclosingNode.getParent();
}
if (fEnclosingNode instanceof IASTPreprocessorMacroExpansion) {
addExpansionNode(fEnclosingNode);
macroOccurrence= true;
}
else {
IASTNodeLocation[] locations= fEnclosingNode.getNodeLocations();
for (int i = 0; i < locations.length; i++) {
IASTNodeLocation location= locations[i];
if (location instanceof IASTMacroExpansionLocation) {
IASTFileLocation fileLocation= location.asFileLocation();
if (fileLocation != null && ast.getFilePath().equals(fileLocation.getFileName())) {
if (fTextRegion.overlapsWith(fileLocation.getNodeOffset(), fileLocation.getNodeLength())) {
addExpansionNode(nodeSelector.findEnclosingNode(fileLocation.getNodeOffset(), fileLocation.getNodeLength()));
macroOccurrence= true;
}
}
}
}