summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2017-01-20 03:33:42 +0000
committerJordan Rose <jordan_rose@apple.com>2017-01-20 03:33:42 +0000
commitccca669ccd081071d5add8263c681125d76807b0 (patch)
tree898d6b16ad81bbc939d684febda4e47e159c1bc1
parent1af1f071ea36208afd806ecb0205525fa5bd8225 (diff)
downloadbcm5719-llvm-ccca669ccd081071d5add8263c681125d76807b0.tar.gz
bcm5719-llvm-ccca669ccd081071d5add8263c681125d76807b0.zip
[AST Printer] Print attributes on enum constants
The AST printer was dropping attributes on enumerators (enum constants). Now it's not. llvm-svn: 292571
-rw-r--r--clang/lib/AST/DeclPrinter.cpp1
-rw-r--r--clang/test/Sema/ast-print.c9
2 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp
index b8ebe1c568c..15b9a6de0bd 100644
--- a/clang/lib/AST/DeclPrinter.cpp
+++ b/clang/lib/AST/DeclPrinter.cpp
@@ -464,6 +464,7 @@ void DeclPrinter::VisitRecordDecl(RecordDecl *D) {
void DeclPrinter::VisitEnumConstantDecl(EnumConstantDecl *D) {
Out << *D;
+ prettyPrintAttributes(D);
if (Expr *Init = D->getInitExpr()) {
Out << " = ";
Init->printPretty(Out, nullptr, Policy, Indentation);
diff --git a/clang/test/Sema/ast-print.c b/clang/test/Sema/ast-print.c
index 4c0aef5b2f3..f701b122095 100644
--- a/clang/test/Sema/ast-print.c
+++ b/clang/test/Sema/ast-print.c
@@ -65,3 +65,12 @@ void initializers() {
// CHECK: } z = {(struct Z){}};
} z = {(struct Z){}};
}
+
+// CHECK-LABEL: enum EnumWithAttributes {
+enum EnumWithAttributes {
+ // CHECK-NEXT: EnumWithAttributesFoo __attribute__((deprecated(""))),
+ EnumWithAttributesFoo __attribute__((deprecated)),
+ // CHECK-NEXT: EnumWithAttributesBar __attribute__((unavailable(""))) = 50
+ EnumWithAttributesBar __attribute__((unavailable)) = 50
+ // CHECK-NEXT: } __attribute__((deprecated("")))
+} __attribute__((deprecated));
OpenPOWER on IntegriCloud