aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/cplusplus/CppDocument.cpp
diff options
context:
space:
mode:
authorRoberto Raggi <[email protected]>2010-07-05 13:34:27 +0200
committerRoberto Raggi <[email protected]>2010-07-05 13:38:53 +0200
commit76ebb4647930bf17b394c5610e26930a0af491d9 (patch)
tree30ee7b5363c4dfcb45a588825ee5296e51ef8643 /src/libs/cplusplus/CppDocument.cpp
parentd209bd72db8be026815fdb81dc32dbde13981de3 (diff)
Fixed: "Follow symbol" on constructor or destructor always jumps to class definition
Task-number: QTCREATORBUG-1776
Diffstat (limited to 'src/libs/cplusplus/CppDocument.cpp')
-rw-r--r--src/libs/cplusplus/CppDocument.cpp16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/libs/cplusplus/CppDocument.cpp b/src/libs/cplusplus/CppDocument.cpp
index e8dd8647465..bbf3eac045e 100644
--- a/src/libs/cplusplus/CppDocument.cpp
+++ b/src/libs/cplusplus/CppDocument.cpp
@@ -703,25 +703,17 @@ public:
};
} // end of anonymous namespace
-Symbol *Snapshot::findMatchingDefinition(Symbol *symbol) const
+Symbol *Snapshot::findMatchingDefinition(Symbol *declaration) const
{
- if (! symbol->identifier())
+ if (! (declaration && declaration->identifier()))
return 0;
- Document::Ptr thisDocument = document(QString::fromUtf8(symbol->fileName(), symbol->fileNameLength()));
+ Document::Ptr thisDocument = document(QString::fromUtf8(declaration->fileName(), declaration->fileNameLength()));
if (! thisDocument) {
- qWarning() << "undefined document:" << symbol->fileName();
+ qWarning() << "undefined document:" << declaration->fileName();
return 0;
}
- LookupContext thisContext(thisDocument, *this);
- const QList<Symbol *> declarationCandidates = thisContext.lookup(symbol->name(), symbol->scope());
- if (declarationCandidates.isEmpty()) {
- qWarning() << "unresolved declaration:" << symbol->fileName() << symbol->line() << symbol->column();
- return 0;
- }
-
- Symbol *declaration = declarationCandidates.first();
Function *declarationTy = declaration->type()->asFunctionType();
if (! declarationTy) {
qWarning() << "not a function:" << declaration->fileName() << declaration->line() << declaration->column();