From: Richard Smith Date: Wed, 23 Jul 2014 03:22:10 +0000 (+0000) Subject: AST printer: fix double space before base class with no access specifier. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1c077723cfb2e40c150fdbd885bee92cb8873e55;p=clang AST printer: fix double space before base class with no access specifier. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@213719 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/DeclPrinter.cpp b/lib/AST/DeclPrinter.cpp index ec7ba65cb4..160e48b6d9 100644 --- a/lib/AST/DeclPrinter.cpp +++ b/lib/AST/DeclPrinter.cpp @@ -784,9 +784,11 @@ void DeclPrinter::VisitCXXRecordDecl(CXXRecordDecl *D) { Out << "virtual "; AccessSpecifier AS = Base->getAccessSpecifierAsWritten(); - if (AS != AS_none) + if (AS != AS_none) { Print(AS); - Out << " " << Base->getType().getAsString(Policy); + Out << " "; + } + Out << Base->getType().getAsString(Policy); if (Base->isPackExpansion()) Out << "..."; diff --git a/unittests/AST/DeclPrinterTest.cpp b/unittests/AST/DeclPrinterTest.cpp index 9ba597994b..9f179c4a3f 100644 --- a/unittests/AST/DeclPrinterTest.cpp +++ b/unittests/AST/DeclPrinterTest.cpp @@ -268,8 +268,8 @@ TEST(DeclPrinter, TestCXXRecordDecl4) { "class Z { int a; };" "class A : Z { int b; };", "A", - "class A : Z {\n}")); - // Should be: with semicolon, with { ... }, without two spaces + "class A : Z {\n}")); + // Should be: with semicolon, with { ... } } TEST(DeclPrinter, TestCXXRecordDecl5) { @@ -277,8 +277,8 @@ TEST(DeclPrinter, TestCXXRecordDecl5) { "struct Z { int a; };" "struct A : Z { int b; };", "A", - "struct A : Z {\n}")); - // Should be: with semicolon, with { ... }, without two spaces + "struct A : Z {\n}")); + // Should be: with semicolon, with { ... } } TEST(DeclPrinter, TestCXXRecordDecl6) { @@ -313,8 +313,8 @@ TEST(DeclPrinter, TestCXXRecordDecl9) { "class Z { int a; };" "class A : virtual Z { int b; };", "A", - "class A : virtual Z {\n}")); - // Should be: with semicolon, with { ... }, without two spaces + "class A : virtual Z {\n}")); + // Should be: with semicolon, with { ... } } TEST(DeclPrinter, TestCXXRecordDecl10) {