forked from qt-creator/qt-creator
Properly annotate templates with full scope in type hierarchy
Fix activation of template classes. Change-Id: I811f505c1c01fa95d74847cb91dd1cf37476534b Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -133,7 +133,8 @@ CppDeclarableElement::CppDeclarableElement(Symbol *declaration)
|
||||
name = overview.prettyName(declaration->name());
|
||||
if (declaration->enclosingScope()->isClass() ||
|
||||
declaration->enclosingScope()->isNamespace() ||
|
||||
declaration->enclosingScope()->isEnum()) {
|
||||
declaration->enclosingScope()->isEnum() ||
|
||||
declaration->enclosingScope()->isTemplate()) {
|
||||
qualifiedName = overview.prettyName(LookupContext::fullyQualifiedName(declaration));
|
||||
helpIdCandidates = stripName(qualifiedName);
|
||||
} else {
|
||||
@@ -462,9 +463,23 @@ QFuture<QSharedPointer<CppElement>> CppElementEvaluator::execute(SourceFunction
|
||||
if (lookupItems.isEmpty())
|
||||
return createFinishedFuture();
|
||||
|
||||
const LookupItem &lookupItem = lookupItems.first(); // ### TODO: select best candidate.
|
||||
if (shouldOmitElement(lookupItem, scope))
|
||||
LookupItem lookupItem;
|
||||
|
||||
for (const LookupItem &item : lookupItems) {
|
||||
if (shouldOmitElement(item, scope))
|
||||
continue;
|
||||
Symbol *symbol = item.declaration();
|
||||
if (!symbol)
|
||||
continue;
|
||||
if (!symbol->isClass() && !symbol->isTemplate() && !symbol->isForwardClassDeclaration())
|
||||
continue;
|
||||
lookupItem = item;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!lookupItem.declaration())
|
||||
return createFinishedFuture();
|
||||
|
||||
return std::invoke(execFuntion, this, snapshot, lookupItem, typeOfExpression.context());
|
||||
}
|
||||
|
||||
@@ -566,6 +581,10 @@ static void handleLookupItemMatch(QFutureInterface<QSharedPointer<CppElement>> &
|
||||
}
|
||||
}
|
||||
|
||||
if (declaration->asTemplate() && declaration->asTemplate()->declaration()
|
||||
&& declaration->asTemplate()->declaration()->asClass())
|
||||
declaration = declaration->asTemplate()->declaration()->asClass();
|
||||
|
||||
if (futureInterface.isCanceled())
|
||||
return;
|
||||
QSharedPointer<CppClass> cppClass(new CppClass(declaration));
|
||||
|
||||
Reference in New Issue
Block a user