diff options
author | Christian Kamm <christian.d.kamm@nokia.com> | 2011-09-12 08:41:53 +0200 |
---|---|---|
committer | Christian Kamm <christian.d.kamm@nokia.com> | 2011-09-12 11:16:39 +0200 |
commit | 151475a0fe0bef303f0f6ce86fe9440d22bc2d9b (patch) | |
tree | 3b43bd885de22e789b95661fbdf849e804ef3724 /src/libs/cplusplus/TypePrettyPrinter.cpp | |
parent | 903c6b60cdd6c67b4fa5935d25213625e5f22724 (diff) |
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>
Diffstat (limited to 'src/libs/cplusplus/TypePrettyPrinter.cpp')
-rw-r--r-- | src/libs/cplusplus/TypePrettyPrinter.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libs/cplusplus/TypePrettyPrinter.cpp b/src/libs/cplusplus/TypePrettyPrinter.cpp index 16def43bf0..eb96cd6249 100644 --- a/src/libs/cplusplus/TypePrettyPrinter.cpp +++ b/src/libs/cplusplus/TypePrettyPrinter.cpp @@ -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); } } |