diff options
author | raidsan <raidsan@gmail.com> | 2012-12-07 18:41:09 +0800 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@digia.com> | 2012-12-12 15:06:40 +0100 |
commit | 45ec1bbe4a776db1586bcf89c78c4f0294f3ddb6 (patch) | |
tree | ff19ad55949b80b1fa131b10ac47cf9e52681d81 /src | |
parent | 352f6d6c4b21aa6147c0b20c3978efd33fb691d8 (diff) |
Fix: Switch Between Method Declaration/Definition issue when has implementation in header file
Task-number: QTCREATORBUG-8393
Change-Id: Ie390e3151e6edc68287e5e0241365d128e6e2c4c
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/cppeditor/cppeditor.cpp | 12 | ||||
-rw-r--r-- | src/plugins/cpptools/symbolfinder.cpp | 3 |
2 files changed, 10 insertions, 5 deletions
diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index 5dd4308da0..a8e4d41656 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -1120,10 +1120,12 @@ void CPPEditorWidget::switchDeclarationDefinition() foreach (const LookupItem &r, declarations) { if (Symbol *decl = r.declaration()) { if (Function *funTy = decl->type()->asFunctionType()) { - if (funTy->isEqualTo(function) && decl != function && binding == r.binding()) - best.prepend(decl); - else - best.append(decl); + if (funTy->isEqualTo(function)) { + if (decl != function && binding == r.binding()) + best.prepend(decl); + else + best.append(decl); + } } } } @@ -1131,7 +1133,7 @@ void CPPEditorWidget::switchDeclarationDefinition() openCppEditorAt(linkToSymbol(best.first())); } else if (lastVisibleSymbol && lastVisibleSymbol->isDeclaration() && lastVisibleSymbol->type()->isFunctionType()) { - if (Symbol *def = symbolFinder()->findMatchingDefinition(lastVisibleSymbol, snapshot)) + if (Symbol *def = symbolFinder()->findMatchingDefinition(lastVisibleSymbol, snapshot, true)) openCppEditorAt(linkToSymbol(def)); } } diff --git a/src/plugins/cpptools/symbolfinder.cpp b/src/plugins/cpptools/symbolfinder.cpp index bfb803d1c3..8a3f7bfe56 100644 --- a/src/plugins/cpptools/symbolfinder.cpp +++ b/src/plugins/cpptools/symbolfinder.cpp @@ -158,6 +158,9 @@ Symbol *SymbolFinder::findMatchingDefinition(Symbol *declaration, continue; // nothing to do foreach (Function *fun, result) { + if (fun->unqualifiedName()->isDestructorNameId() != declaration->unqualifiedName()->isDestructorNameId()) + continue; + const QList<LookupItem> declarations = context.lookup(fun->name(), fun->enclosingScope()); if (declarations.isEmpty()) continue; |