diff options
Diffstat (limited to 'lib/AST/DeclPrinter.cpp')
-rw-r--r-- | lib/AST/DeclPrinter.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
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) { |