mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 10:16:03 +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;
|
fMinLocation= useOffset;
|
||||||
// TLETODO This does not work correctly for nested macro substitutions
|
// TLETODO This does not work correctly for nested macro substitutions
|
||||||
IASTPreprocessorMacroDefinition macroDef= ((IASTMacroExpansion)nodeLocations[0]).getMacroDefinition();
|
IASTPreprocessorMacroDefinition macroDef= ((IASTMacroExpansion)nodeLocations[0]).getMacroDefinition();
|
||||||
|
final int macroLength;
|
||||||
IASTNodeLocation defLocation= macroDef.getName().getFileLocation();
|
IASTNodeLocation defLocation= macroDef.getName().getFileLocation();
|
||||||
if (defLocation != null) {
|
if (defLocation != null) {
|
||||||
IASTNode macroNode= node.getTranslationUnit().selectNodeForLocation(fFilePath, useOffset, defLocation.getNodeLength());
|
macroLength= defLocation.getNodeLength();
|
||||||
if (macroNode != null && visitMacro(macroNode, defLocation.getNodeLength())) {
|
} else {
|
||||||
return true;
|
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