]> granicus.if.org Git - clang/commitdiff
AST printing for scoped enumerations and enumerations with a fixed underlying type...
authorDouglas Gregor <dgregor@apple.com>
Wed, 1 Dec 2010 16:01:08 +0000 (16:01 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 1 Dec 2010 16:01:08 +0000 (16:01 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120576 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/DeclPrinter.cpp

index a6e60aa5afaa007474690b5a05a1c710c6c939e9..5a3144049488c172db11425a70d640d487d9c5d2 100644 (file)
@@ -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) {