forked from qt-creator/qt-creator
C++: Fix function return type printing.
We used to print T * foo(), but our style suggests T *foo(). Change-Id: Ie3b0ce6b620785ec98aeb394f7955ce959440619 Reviewed-on: http://codereview.qt-project.org/4634 Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
This commit is contained in:
@@ -289,6 +289,12 @@ void TypePrettyPrinter::visit(ArrayType *type)
|
||||
acceptType(type->elementType());
|
||||
}
|
||||
|
||||
static bool endsWithPtrOrRef(const QString &type)
|
||||
{
|
||||
return type.endsWith(QLatin1Char('*'))
|
||||
|| type.endsWith(QLatin1Char('&'));
|
||||
}
|
||||
|
||||
void TypePrettyPrinter::visit(Function *type)
|
||||
{
|
||||
if (_needsParens) {
|
||||
@@ -309,7 +315,8 @@ void TypePrettyPrinter::visit(Function *type)
|
||||
if (_overview->showReturnTypes()) {
|
||||
const QString returnType = _overview->prettyType(type->returnType());
|
||||
if (!returnType.isEmpty()) {
|
||||
_text.prepend(QLatin1Char(' '));
|
||||
if (!endsWithPtrOrRef(returnType))
|
||||
_text.prepend(QLatin1Char(' '));
|
||||
_text.prepend(returnType);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user