mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 10:46:02 +02:00
Fix invocation of macro expansion tool.
This commit is contained in:
parent
dbbd26805c
commit
831dd9ee1f
1 changed files with 18 additions and 9 deletions
|
@ -108,15 +108,24 @@ public class CMacroExpansionInput {
|
||||||
fEnclosingNode= nodeSelector.findEnclosingNode(fTextRegion.getOffset(), fTextRegion.getLength());
|
fEnclosingNode= nodeSelector.findEnclosingNode(fTextRegion.getOffset(), fTextRegion.getLength());
|
||||||
if (fEnclosingNode != null) {
|
if (fEnclosingNode != null) {
|
||||||
boolean macroOccurrence= false;
|
boolean macroOccurrence= false;
|
||||||
IASTNodeLocation[] locations= fEnclosingNode.getNodeLocations();
|
if (fEnclosingNode.getParent() instanceof IASTPreprocessorMacroExpansion) {
|
||||||
for (int i = 0; i < locations.length; i++) {
|
fEnclosingNode= fEnclosingNode.getParent();
|
||||||
IASTNodeLocation location= locations[i];
|
}
|
||||||
if (location instanceof IASTMacroExpansionLocation) {
|
if (fEnclosingNode instanceof IASTPreprocessorMacroExpansion) {
|
||||||
IASTFileLocation fileLocation= location.asFileLocation();
|
addExpansionNode(fEnclosingNode);
|
||||||
if (fileLocation != null && ast.getFilePath().equals(fileLocation.getFileName())) {
|
macroOccurrence= true;
|
||||||
if (fTextRegion.overlapsWith(fileLocation.getNodeOffset(), fileLocation.getNodeLength())) {
|
}
|
||||||
addExpansionNode(nodeSelector.findEnclosingNode(fileLocation.getNodeOffset(), fileLocation.getNodeLength()));
|
else {
|
||||||
macroOccurrence= true;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue