[Sema] Don't warn about omitting unavailable enum constants in a switch

rdar://42717026

Differential revision: https://reviews.llvm.org/D51649

llvm-svn: 341490
diff --git a/clang/test/Sema/switch-availability.c b/clang/test/Sema/switch-availability.c
new file mode 100644
index 0000000..888eddd
--- /dev/null
+++ b/clang/test/Sema/switch-availability.c
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -verify -Wswitch -triple x86_64-apple-macosx10.12 %s
+
+enum SwitchOne {
+  Unavail __attribute__((availability(macos, unavailable))),
+};
+
+void testSwitchOne(enum SwitchOne so) {
+  switch (so) {} // no warning
+}
+
+enum SwitchTwo {
+  Ed __attribute__((availability(macos, deprecated=10.12))),
+  Vim __attribute__((availability(macos, deprecated=10.13))),
+  Emacs,
+};
+
+void testSwitchTwo(enum SwitchTwo st) {
+  switch (st) {} // expected-warning{{enumeration values 'Vim' and 'Emacs' not handled in switch}}
+}
+
+enum SwitchThree {
+  New __attribute__((availability(macos, introduced=1000))),
+};
+
+void testSwitchThree(enum SwitchThree st) {
+  switch (st) {} // expected-warning{{enumeration value 'New' not handled in switch}}
+}