summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorErik Pilkington <erik.pilkington@gmail.com>2018-09-05 19:13:27 +0000
committerErik Pilkington <erik.pilkington@gmail.com>2018-09-05 19:13:27 +0000
commit3e4e3b17c14c15c23c0ed18ca9165b42b1b13ae3 (patch)
treeff1eabb913e32a9406b2770d04fff38d17470f26 /clang/test
parent52a503d4f333d7f8ccfde50fa7a2fb5fe11c4b1d (diff)
downloadbcm5719-llvm-3e4e3b17c14c15c23c0ed18ca9165b42b1b13ae3.tar.gz
bcm5719-llvm-3e4e3b17c14c15c23c0ed18ca9165b42b1b13ae3.zip
[Sema] Don't warn about omitting unavailable enum constants in a switch
rdar://42717026 Differential revision: https://reviews.llvm.org/D51649 llvm-svn: 341490
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Sema/switch-availability.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/clang/test/Sema/switch-availability.c b/clang/test/Sema/switch-availability.c
new file mode 100644
index 00000000000..888edddac46
--- /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}}
+}
OpenPOWER on IntegriCloud