aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/cplusplus/TypePrettyPrinter.cpp
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2016-08-21 22:21:03 +0300
committerOrgad Shaneh <orgads@gmail.com>2016-09-06 09:33:48 +0000
commit39aff55d8a166f8ccd17cd1d703b556391a4a768 (patch)
tree5ac0f177d1f95005d046fd896c89279560e1ad06 /src/libs/cplusplus/TypePrettyPrinter.cpp
parent50a6c478304adb40020d6ccdacc41e9a77a7ad77 (diff)
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>
Diffstat (limited to 'src/libs/cplusplus/TypePrettyPrinter.cpp')
-rw-r--r--src/libs/cplusplus/TypePrettyPrinter.cpp38
1 files changed, 21 insertions, 17 deletions
diff --git a/src/libs/cplusplus/TypePrettyPrinter.cpp b/src/libs/cplusplus/TypePrettyPrinter.cpp
index 4b2d92d37e..3e07308361 100644
--- a/src/libs/cplusplus/TypePrettyPrinter.cpp
+++ b/src/libs/cplusplus/TypePrettyPrinter.cpp
@@ -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;