File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -7513,6 +7513,10 @@ class DiagnoseUnguardedAvailability
7513
7513
7514
7514
bool TraverseLambdaExpr (LambdaExpr *E) { return true ; }
7515
7515
7516
+ // for 'case X:' statements, don't bother looking at the 'X'; it can't lead
7517
+ // to any useful diagnostics.
7518
+ bool TraverseCaseStmt (CaseStmt *CS) { return TraverseStmt (CS->getSubStmt ()); }
7519
+
7516
7520
bool VisitObjCPropertyRefExpr (ObjCPropertyRefExpr *PRE) {
7517
7521
if (PRE->isClassReceiver ())
7518
7522
DiagnoseDeclAvailability (PRE->getClassReceiver (), PRE->getReceiverLocation ());
Original file line number Diff line number Diff line change @@ -287,3 +287,27 @@ @interface ClassWithNewProtocolRequirement : BaseClass <NewProtocol>
287
287
@interface BaseClass (CategoryWithNewProtocolRequirement) <NewProtocol>
288
288
289
289
@end
290
+
291
+ typedef enum {
292
+ AK_Dodo __attribute__ ((availability (macos, deprecated=10.3 ))), // expected-note 3 {{marked deprecated here}}
293
+ AK_Cat __attribute__ ((availability (macos, introduced=10.4 ))),
294
+ AK_CyborgCat __attribute__ ((availability (macos, introduced=10.12 ))), // expected-note {{marked partial here}}
295
+ } Animals;
296
+
297
+ void switchAnimals (Animals a) {
298
+ switch (a) {
299
+ case AK_Dodo: break ; // expected-warning{{'AK_Dodo' is deprecated}}
300
+ case AK_Cat: break ;
301
+ case AK_Cat|AK_CyborgCat: break ; // expected-warning{{case value not in enum}}
302
+ case AK_CyborgCat: break ; // no warn
303
+ }
304
+
305
+ switch (a) {
306
+ case AK_Dodo...AK_CyborgCat : // expected-warning {{'AK_Dodo' is depr}}
307
+ break ;
308
+ }
309
+
310
+ (void )AK_Dodo; // expected-warning{{'AK_Dodo' is deprecated}}
311
+ (void )AK_Cat; // no warning
312
+ (void )AK_CyborgCat; // expected-warning{{'AK_CyborgCat' is only available on macOS 10.12 or newer}} expected-note {{@available}}
313
+ }
You can’t perform that action at this time.
0 commit comments