forked from qt-creator/qt-creator
Enhance data stored for macros and macro uses.
In preparation for finding macro uses. * Macro: add offset and length * MacroUse: add line * Document: add convenience functions for finding a macro definition, use or undefined use at a given location. Reviewed-by: Erik Verbruggen
This commit is contained in:
@@ -1363,15 +1363,14 @@ CPPEditor::Link CPPEditor::findLinkAt(const QTextCursor &cursor,
|
||||
}
|
||||
} else {
|
||||
// Handle macro uses
|
||||
foreach (const Document::MacroUse use, doc->macroUses()) {
|
||||
if (use.contains(endOfName - 1)) {
|
||||
const Macro ¯o = use.macro();
|
||||
link.fileName = macro.fileName();
|
||||
link.line = macro.line();
|
||||
link.pos = use.begin();
|
||||
link.length = use.end() - use.begin();
|
||||
return link;
|
||||
}
|
||||
const Document::MacroUse *use = doc->findMacroUseAt(endOfName - 1);
|
||||
if (use) {
|
||||
const Macro ¯o = use->macro();
|
||||
link.fileName = macro.fileName();
|
||||
link.line = macro.line();
|
||||
link.pos = use->begin();
|
||||
link.length = use->end() - use->begin();
|
||||
return link;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user