AST printing for scoped enumerations and enumerations with a fixed underlying type, from Daniel Wallin

llvm-svn: 120576
This commit is contained in:
Douglas Gregor 2010-12-01 16:01:08 +00:00
parent 85df0ccafd
commit ec0e366163
1 changed files with 16 additions and 3 deletions

View File

@ -307,10 +307,23 @@ void DeclPrinter::VisitTypedefDecl(TypedefDecl *D) {
} }
void DeclPrinter::VisitEnumDecl(EnumDecl *D) { void DeclPrinter::VisitEnumDecl(EnumDecl *D) {
Out << "enum " << D << " {\n"; Out << "enum ";
if (D->isScoped())
Out << "class ";
Out << D;
if (D->isFixed()) {
std::string Underlying;
D->getIntegerType().getAsStringInternal(Underlying, Policy);
Out << " : " << Underlying;
}
if (D->isDefinition()) {
Out << " {\n";
VisitDeclContext(D); VisitDeclContext(D);
Indent() << "}"; Indent() << "}";
} }
}
void DeclPrinter::VisitRecordDecl(RecordDecl *D) { void DeclPrinter::VisitRecordDecl(RecordDecl *D) {
Out << D->getKindName(); Out << D->getKindName();