From 09bf431ab578dcc02f46b7ae2c75da38c1cfa58e Mon Sep 17 00:00:00 2001 From: Roberto Raggi <roberto.raggi@nokia.com> Date: Fri, 21 May 2010 11:35:03 +0200 Subject: [PATCH] Fixed jump to the matching definition. --- src/libs/cplusplus/CppDocument.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/libs/cplusplus/CppDocument.cpp b/src/libs/cplusplus/CppDocument.cpp index eb17e4c9d77..cd7c0feb589 100644 --- a/src/libs/cplusplus/CppDocument.cpp +++ b/src/libs/cplusplus/CppDocument.cpp @@ -742,14 +742,17 @@ Symbol *Snapshot::findMatchingDefinition(Symbol *symbol) const QList<Function *> viableFunctions; + ClassOrNamespace *enclosingType = context.lookupType(declaration); + if (! enclosingType) + continue; // nothing to do + foreach (Function *fun, result) { const QList<Symbol *> declarations = context.lookup(fun->name(), fun->scope()); + if (declarations.isEmpty()) + continue; - if (declarations.contains(declaration)) + else if (enclosingType == context.lookupType(declarations.first())) viableFunctions.append(fun); - - else if (false) - qDebug() << "does not contain" << declaration->fileName() << declaration->line() << declaration->column(); } if (viableFunctions.isEmpty()) -- GitLab