r213719 - AST printer: fix double space before base class with no access specifier.

Richard Smith richard-llvm at metafoo.co.uk
Tue Jul 22 20:22:10 PDT 2014


Author: rsmith
Date: Tue Jul 22 22:22:10 2014
New Revision: 213719

URL: http://llvm.org/viewvc/llvm-project?rev=213719&view=rev
Log:
AST printer: fix double space before base class with no access specifier.

Modified:
    cfe/trunk/lib/AST/DeclPrinter.cpp
    cfe/trunk/unittests/AST/DeclPrinterTest.cpp

Modified: cfe/trunk/lib/AST/DeclPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclPrinter.cpp?rev=213719&r1=213718&r2=213719&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclPrinter.cpp (original)
+++ cfe/trunk/lib/AST/DeclPrinter.cpp Tue Jul 22 22:22:10 2014
@@ -784,9 +784,11 @@ void DeclPrinter::VisitCXXRecordDecl(CXX
           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 << "...";

Modified: cfe/trunk/unittests/AST/DeclPrinterTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/DeclPrinterTest.cpp?rev=213719&r1=213718&r2=213719&view=diff
==============================================================================
--- cfe/trunk/unittests/AST/DeclPrinterTest.cpp (original)
+++ cfe/trunk/unittests/AST/DeclPrinterTest.cpp Tue Jul 22 22:22:10 2014
@@ -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) {





More information about the cfe-commits mailing list