Commit eb2ac188 authored by Christian Kamm's avatar Christian Kamm
Browse files

C++: Make 'follow symbol' for classes work in more cases.

Previously, it would still fail if a forward declaration and declaration
for a class were in the same file.

Task-number: QTCREATORBUG-20
parent 3c3af9c2
...@@ -807,12 +807,14 @@ Class *Snapshot::findMatchingClassDeclaration(Symbol *declaration) const ...@@ -807,12 +807,14 @@ Class *Snapshot::findMatchingClassDeclaration(Symbol *declaration) const
LookupContext context(doc, *this); LookupContext context(doc, *this);
ClassOrNamespace *type = context.lookupType(declaration); ClassOrNamespace *type = context.lookupType(declaration);
if (!type || type->symbols().count() != 1) if (!type)
continue; continue;
if (Class *c = type->symbols().first()->asClass()) foreach (Symbol *s, type->symbols()) {
if (Class *c = s->asClass())
return c; return c;
} }
return 0; return 0;
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment