forked from qt-creator/qt-creator
C++: Enable showEnclosingTemplate also for function type
Do not require directly passing the enclosing template. Change-Id: Ie03bc58338fe003677a5f5311d86d70f499373ee Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
50a6c47830
commit
39aff55d8a
@@ -182,23 +182,6 @@ void TypePrettyPrinter::visit(Template *type)
|
||||
_name += QLatin1Char('>');
|
||||
}
|
||||
acceptType(d->type());
|
||||
if (oo.showEnclosingTemplate) {
|
||||
QString templateScope = "template<";
|
||||
for (unsigned i = 0, total = type->templateParameterCount(); i < total; ++i) {
|
||||
if (Symbol *param = type->templateParameterAt(i)) {
|
||||
if (i > 0)
|
||||
templateScope.append(", ");
|
||||
if (TypenameArgument *typenameArg = param->asTypenameArgument()) {
|
||||
templateScope.append(QLatin1String(typenameArg->isClassDeclarator()
|
||||
? "class " : "typename "));
|
||||
templateScope.append(oo(typenameArg->name()));
|
||||
} else if (Argument *arg = param->asArgument()) {
|
||||
templateScope.append(operator()(arg->type(), oo(arg->name())));
|
||||
}
|
||||
}
|
||||
}
|
||||
_text.prepend(templateScope + ">\n");
|
||||
}
|
||||
}
|
||||
prependCv(_fullySpecifiedType);
|
||||
}
|
||||
@@ -424,6 +407,27 @@ void TypePrettyPrinter::visit(Function *type)
|
||||
}
|
||||
}
|
||||
|
||||
if (_overview->showEnclosingTemplate) {
|
||||
if (Template *templ = type->enclosingTemplate()) {
|
||||
QString templateScope = "template<";
|
||||
for (unsigned i = 0, total = templ->templateParameterCount(); i < total; ++i) {
|
||||
if (Symbol *param = templ->templateParameterAt(i)) {
|
||||
if (i > 0)
|
||||
templateScope.append(", ");
|
||||
if (TypenameArgument *typenameArg = param->asTypenameArgument()) {
|
||||
templateScope.append(QLatin1String(typenameArg->isClassDeclarator()
|
||||
? "class " : "typename "));
|
||||
templateScope.append(_overview->prettyName(typenameArg->name()));
|
||||
} else if (Argument *arg = param->asArgument()) {
|
||||
templateScope.append(operator()(arg->type(),
|
||||
_overview->prettyName(arg->name())));
|
||||
}
|
||||
}
|
||||
}
|
||||
_text.prepend(templateScope + ">\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (_overview->showFunctionSignatures) {
|
||||
Overview argumentText;
|
||||
argumentText.starBindFlags = _overview->starBindFlags;
|
||||
|
||||
Reference in New Issue
Block a user