1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Improve macro reference detection

This commit is contained in:
Anton Leherbauer 2007-03-27 09:06:30 +00:00
parent d48c0f5950
commit 83c9961a18

View file

@ -193,12 +193,16 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
fMinLocation= useOffset;
// TLETODO This does not work correctly for nested macro substitutions
IASTPreprocessorMacroDefinition macroDef= ((IASTMacroExpansion)nodeLocations[0]).getMacroDefinition();
final int macroLength;
IASTNodeLocation defLocation= macroDef.getName().getFileLocation();
if (defLocation != null) {
IASTNode macroNode= node.getTranslationUnit().selectNodeForLocation(fFilePath, useOffset, defLocation.getNodeLength());
if (macroNode != null && visitMacro(macroNode, defLocation.getNodeLength())) {
return true;
}
macroLength= defLocation.getNodeLength();
} else {
macroLength= macroDef.getName().toCharArray().length;
}
IASTNode macroNode= node.getTranslationUnit().selectNodeForLocation(fFilePath, useOffset, macroLength);
if (macroNode != null && visitMacro(macroNode, macroLength)) {
return true;
}
}
}