Commit 0d87abee authored by Christian Stenger's avatar Christian Stenger

AutoTest: Fix handling of forward declared test classes

If a class has been forward declared we might not end up
inside the real class declaration when trying to find
declared test functions. So, do not just take the first
found symbol into account, continue to process others if
we haven't found the real declaration.

Task-number: QTCREATORBUG-19319
Change-Id: I752d7a10470f5362e2214596966d93c037d58f4a
Reviewed-by: David Schulz's avatarDavid Schulz <david.schulz@qt.io>
parent 466fb7ea
......@@ -148,8 +148,8 @@ static CPlusPlus::Document::Ptr declaringDocument(CPlusPlus::Document::Ptr doc,
}
}
if (lookupItems.size()) {
if (CPlusPlus::Symbol *symbol = lookupItems.first().declaration()) {
for (const CPlusPlus::LookupItem &item : lookupItems) {
if (CPlusPlus::Symbol *symbol = item.declaration()) {
if (CPlusPlus::Class *toeClass = symbol->asClass()) {
const QString declFileName = QLatin1String(toeClass->fileId()->chars(),
toeClass->fileId()->size());
......
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