Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion clang/lib/Sema/SemaStmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1667,8 +1667,12 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch,
// Don't warn about omitted unavailable EnumConstantDecls.
switch (EI->second->getAvailability()) {
case AR_Deprecated:
// Omitting a deprecated constant is ok; it should never materialize.
// Deprecated enumerators still need to be handled: they may be
// deprecated, but can still occur.
break;

case AR_Unavailable:
// Omitting an unavailable enumerator is ok; it should never occur.
continue;

case AR_NotYetIntroduced:
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Sema/switch-availability.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ enum SwitchTwo {
};

void testSwitchTwo(enum SwitchTwo st) {
switch (st) {} // expected-warning{{enumeration values 'Vim' and 'Emacs' not handled in switch}}
switch (st) {} // expected-warning{{enumeration values 'Ed', 'Vim' and 'Emacs' not handled in switch}}
}

enum SwitchThree {
Expand Down
Loading