[cfe-commits] r120576 - /cfe/trunk/lib/AST/DeclPrinter.cpp

Douglas Gregor dgregor at apple.com
Wed Dec 1 08:01:08 PST 2010


Author: dgregor
Date: Wed Dec  1 10:01:08 2010
New Revision: 120576

URL: http://llvm.org/viewvc/llvm-project?rev=120576&view=rev
Log:
AST printing for scoped enumerations and enumerations with a fixed underlying type, from Daniel Wallin

Modified:
    cfe/trunk/lib/AST/DeclPrinter.cpp

Modified: cfe/trunk/lib/AST/DeclPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclPrinter.cpp?rev=120576&r1=120575&r2=120576&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclPrinter.cpp (original)
+++ cfe/trunk/lib/AST/DeclPrinter.cpp Wed Dec  1 10:01:08 2010
@@ -307,9 +307,22 @@
 }
 
 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) {





More information about the cfe-commits mailing list