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
This commit is contained in:
Christian Kamm
2010-06-18 09:26:38 +02:00
parent 3c3af9c25b
commit eb2ac188f2

View File

@@ -807,11 +807,13 @@ Class *Snapshot::findMatchingClassDeclaration(Symbol *declaration) const
LookupContext context(doc, *this);
ClassOrNamespace *type = context.lookupType(declaration);
if (!type || type->symbols().count() != 1)
if (!type)
continue;
if (Class *c = type->symbols().first()->asClass())
return c;
foreach (Symbol *s, type->symbols()) {
if (Class *c = s->asClass())
return c;
}
}
return 0;