diff options
Diffstat (limited to 'src/libs/cplusplus/TypePrettyPrinter.cpp')
-rw-r--r-- | src/libs/cplusplus/TypePrettyPrinter.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libs/cplusplus/TypePrettyPrinter.cpp b/src/libs/cplusplus/TypePrettyPrinter.cpp index 7ae1aa3397..0e7ba19342 100644 --- a/src/libs/cplusplus/TypePrettyPrinter.cpp +++ b/src/libs/cplusplus/TypePrettyPrinter.cpp @@ -363,12 +363,11 @@ void TypePrettyPrinter::visit(Function *type) { bool showTemplateParameters = _overview->showTemplateParameters; QStringList nameParts = _name.split("::"); - int i = nameParts.length() - 1; Scope *s = type->enclosingScope(); if (s && s->asTemplate()) s = s->enclosingScope(); - for (; s && i >= 0; s = s->enclosingScope()) { + for (int i = nameParts.length() - 1; s && i >= 0; s = s->enclosingScope()) { if (s->asClass()) showTemplateParameters = true; @@ -433,7 +432,8 @@ void TypePrettyPrinter::visit(Function *type) } if (_overview->showEnclosingTemplate) { - for (Scope *s = type->enclosingScope(); s && i >= 0; s = s->enclosingScope()) { + for (auto [s, i] = std::tuple{type->enclosingScope(), nameParts.length() - 1}; s && i >= 0; + s = s->enclosingScope()) { if (Template *templ = s->asTemplate()) { QString templateScope = "template<"; const int paramCount = templ->templateParameterCount(); |