forked from qt-creator/qt-creator
CppEditor: Fix go to definition of macros.
- Go to macro definition only on macro name (ie not in parameters). - Prefer macro definition over expanded code definition, as the preprocessor is executed first: when trying to go to definition, the user sees the macro, not the expanded code. Task-number: QTCREATORBUG-2240 Task-number: QTCREATORBUG-6175 Task-number: QTCREATORBUG-6848 Task-number: QTCREATORBUG-7008 Task-number: QTCREATORBUG-7009 Change-Id: I819c763524e79b20518c26a46a99a3a3b0a131bd Reviewed-by: Andre Hartmann <aha_1980@gmx.de> Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@nokia.com>
This commit is contained in:
committed by
Erik Verbruggen
parent
0cf5044d5a
commit
a450c13327
@@ -473,7 +473,7 @@ const Macro *Document::findMacroDefinitionAt(unsigned line) const
|
||||
const Document::MacroUse *Document::findMacroUseAt(unsigned offset) const
|
||||
{
|
||||
foreach (const Document::MacroUse &use, _macroUses) {
|
||||
if (use.contains(offset))
|
||||
if (use.contains(offset) && (offset < use.begin() + use.macro().name().length()))
|
||||
return &use;
|
||||
}
|
||||
return 0;
|
||||
@@ -482,7 +482,7 @@ const Document::MacroUse *Document::findMacroUseAt(unsigned offset) const
|
||||
const Document::UndefinedMacroUse *Document::findUndefinedMacroUseAt(unsigned offset) const
|
||||
{
|
||||
foreach (const Document::UndefinedMacroUse &use, _undefinedMacroUses) {
|
||||
if (use.contains(offset))
|
||||
if (use.contains(offset) && (offset < use.begin() + use.name().length()))
|
||||
return &use;
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user