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:
parent
d48c0f5950
commit
83c9961a18
1 changed files with 8 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue