aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/DeclPrinter.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-12-01 16:01:08 +0000
committerDouglas Gregor <dgregor@apple.com>2010-12-01 16:01:08 +0000
commit9fa8c4652afd4ee0faa70b563688d56c51c7fc93 (patch)
treeca25ee63450d884eab6256172c221c02eb19fdc2 /lib/AST/DeclPrinter.cpp
parentb7b2688bab0eac053d3e2938b329c8e523fd252b (diff)
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
Diffstat (limited to 'lib/AST/DeclPrinter.cpp')
-rw-r--r--lib/AST/DeclPrinter.cpp19
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) {