From: Douglas Gregor Date: Wed, 1 Dec 2010 16:01:08 +0000 (+0000) Subject: AST printing for scoped enumerations and enumerations with a fixed underlying type... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9fa8c4652afd4ee0faa70b563688d56c51c7fc93;p=clang AST printing for scoped enumerations and enumerations with a fixed underlying type, from Daniel Wallin git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120576 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/DeclPrinter.cpp b/lib/AST/DeclPrinter.cpp index a6e60aa5af..5a31440494 100644 --- a/lib/AST/DeclPrinter.cpp +++ b/lib/AST/DeclPrinter.cpp @@ -307,9 +307,22 @@ void DeclPrinter::VisitTypedefDecl(TypedefDecl *D) { } void DeclPrinter::VisitEnumDecl(EnumDecl *D) { - Out << "enum " << D << " {\n"; - VisitDeclContext(D); - Indent() << "}"; + 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); + Indent() << "}"; + } } void DeclPrinter::VisitRecordDecl(RecordDecl *D) {