1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Fixes navigation from the macro-expansion tool to the macro-definition.

This commit is contained in:
Markus Schorn 2008-01-30 12:48:27 +00:00
parent 3c1338a8db
commit 199906029b

View file

@ -134,9 +134,11 @@ public class MultiMacroExpansionExplorer extends MacroExpansionExplorer {
private void addLocations(IASTPreprocessorMacroDefinition[] defs, private void addLocations(IASTPreprocessorMacroDefinition[] defs,
final Map<IMacroBinding, IASTFileLocation> result) { final Map<IMacroBinding, IASTFileLocation> result) {
for (IASTPreprocessorMacroDefinition def : defs) { for (IASTPreprocessorMacroDefinition def : defs) {
IASTFileLocation loc= def.getFileLocation(); IASTName name= def.getName();
if (name != null) {
IASTFileLocation loc= name.getFileLocation();
if (loc != null) { if (loc != null) {
final IBinding binding= def.getName().getBinding(); final IBinding binding= name.getBinding();
if (binding instanceof IMacroBinding) { if (binding instanceof IMacroBinding) {
loc= new ASTFileLocation(loc.getFileName(), loc.getNodeOffset(), loc.getNodeLength()); loc= new ASTFileLocation(loc.getFileName(), loc.getNodeOffset(), loc.getNodeLength());
result.put((IMacroBinding) binding, loc); result.put((IMacroBinding) binding, loc);
@ -144,6 +146,7 @@ public class MultiMacroExpansionExplorer extends MacroExpansionExplorer {
} }
} }
} }
}
public MultiMacroExpansionExplorer(final IASTTranslationUnit tu, final IRegion loc) { public MultiMacroExpansionExplorer(final IASTTranslationUnit tu, final IRegion loc) {
this(tu, new ASTFileLocation(tu.getFilePath(), loc.getOffset(), loc.getLength())); this(tu, new ASTFileLocation(tu.getFilePath(), loc.getOffset(), loc.getLength()));