From 0449c67f033c59c10fe86e0ca869a8e8b77f333c Mon Sep 17 00:00:00 2001 From: Roberto Raggi <qtc-committer@nokia.com> Date: Wed, 7 Jan 2009 10:35:53 +0100 Subject: [PATCH] Fixed the pretty printing of class specifiers and base clauses. --- shared/cplusplus/PrettyPrinter.cpp | 7 ++++++- tests/manual/cplusplus/tests/t1.cpp | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/shared/cplusplus/PrettyPrinter.cpp b/shared/cplusplus/PrettyPrinter.cpp index 4adc69e78c3..891a63020cd 100644 --- a/shared/cplusplus/PrettyPrinter.cpp +++ b/shared/cplusplus/PrettyPrinter.cpp @@ -145,12 +145,16 @@ bool PrettyPrinter::visit(AttributeAST *ast) bool PrettyPrinter::visit(BaseSpecifierAST *ast) { if (ast->token_virtual && ast->token_access_specifier) { - out << "virtual "; + out << "virtual"; + out << ' '; out << spell(ast->token_access_specifier); + out << ' '; } else if (ast->token_virtual) { out << "virtual"; + out << ' '; } else if (ast->token_access_specifier) { out << spell(ast->token_access_specifier); + out << ' '; } accept(ast->name); return false; @@ -234,6 +238,7 @@ bool PrettyPrinter::visit(ClassSpecifierAST *ast) out << ", "; } } + newline(); out << '{'; if (ast->member_specifiers) { indent(); diff --git a/tests/manual/cplusplus/tests/t1.cpp b/tests/manual/cplusplus/tests/t1.cpp index 75c4666d55b..8687efb48f4 100644 --- a/tests/manual/cplusplus/tests/t1.cpp +++ b/tests/manual/cplusplus/tests/t1.cpp @@ -22,3 +22,7 @@ class Class { } }; +class Derived: public Class { +}; + +class Derived2: public Class, public virtual Derived {}; -- GitLab