Parse attributes on enumerators and instantiate attributes on enum decls.

llvm-svn: 117182
diff --git a/clang/test/Sema/attr-deprecated.c b/clang/test/Sema/attr-deprecated.c
index e7c997f..f9cdaf06 100644
--- a/clang/test/Sema/attr-deprecated.c
+++ b/clang/test/Sema/attr-deprecated.c
@@ -98,3 +98,14 @@
 foo_dep test17, // expected-warning {{'foo_dep' is deprecated}}
         test18 __attribute__((deprecated)),
         test19;
+
+// rdar://problem/8518751
+enum __attribute__((deprecated)) Test20 {
+  test20_a __attribute__((deprecated)),
+  test20_b
+};
+void test20() {
+  enum Test20 f; // expected-warning {{'Test20' is deprecated}}
+  f = test20_a; // expected-warning {{'test20_a' is deprecated}}
+  f = test20_b;
+}
diff --git a/clang/test/SemaCXX/attr-deprecated.cpp b/clang/test/SemaCXX/attr-deprecated.cpp
index 2164f9d..fe7c833 100644
--- a/clang/test/SemaCXX/attr-deprecated.cpp
+++ b/clang/test/SemaCXX/attr-deprecated.cpp
@@ -190,3 +190,46 @@
     {}
   };
 }
+
+// rdar://problem/8518751
+namespace test6 {
+  enum __attribute__((deprecated)) A {
+    a0
+  };
+  void testA() {
+    A x; // expected-warning {{'A' is deprecated}}
+    x = a0;
+  }
+  
+  enum B {
+    b0 __attribute__((deprecated)),
+    b1
+  };
+  void testB() {
+    B x;
+    x = b0; // expected-warning {{'b0' is deprecated}}
+    x = b1;
+  }
+
+  template <class T> struct C {
+    enum __attribute__((deprecated)) Enum {
+      c0
+    };
+  };
+  void testC() {
+    C<int>::Enum x; // expected-warning {{'Enum' is deprecated}}
+    x = C<int>::c0;
+  }
+
+  template <class T> struct D {
+    enum Enum {
+      d0,
+      d1 __attribute__((deprecated)),
+    };
+  };
+  void testD() {
+    D<int>::Enum x;
+    x = D<int>::d0;
+    x = D<int>::d1; // expected-warning {{'d1' is deprecated}}
+  }
+}