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

llvm-svn: 213719
This commit is contained in:
Richard Smith 2014-07-23 03:22:10 +00:00
parent a4bb292095
commit a593419593
2 changed files with 10 additions and 8 deletions

View File

@ -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 << "...";

View File

@ -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) {