Skip to content

[feature availability] Don't warn about unguarded uses of ObjC protocols adopted by interfaces #10996

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 2 additions & 1 deletion clang/lib/Sema/SemaExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,8 @@ bool Sema::DiagnoseUseOfDecl(NamedDecl *D, ArrayRef<SourceLocation> Locs,
DiagnoseAvailabilityOfDecl(D, Locs, UnknownObjCClass, ObjCPropertyAccess,
AvoidPartialAvailabilityChecks, ClassReceiver);

DiagnoseFeatureAvailabilityOfDecl(D, Locs);
if (!AvoidPartialAvailabilityChecks)
DiagnoseFeatureAvailabilityOfDecl(D, Locs);

DiagnoseUnusedOfDecl(*this, D, Loc);

Expand Down
8 changes: 5 additions & 3 deletions clang/test/SemaObjC/feature-availability.m
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ @interface Base3 <P1>
@end

__attribute__((availability(domain:feature1, AVAIL)))
@interface Base4 <P1> // expected-error {{use of 'P1' requires feature 'feature1' to be unavailable}}
@interface Base4 <P1>
@end

__attribute__((availability(domain:feature1, AVAIL)))
Expand All @@ -166,8 +166,10 @@ @interface Base5(Cat3) <P2>
@end

__attribute__((availability(domain:feature1, UNAVAIL)))
@interface Base5(Cat4) <P2> // expected-error {{use of 'P2' requires feature 'feature1' to be available}}
@interface Base5(Cat4) <P2>
@end

@interface Base6 <P1, P2> // expected-error {{use of 'P1' requires feature 'feature1' to be unavailable}} expected-error {{use of 'P2' requires feature 'feature1' to be available}}
@interface Base6 <P1, P2>
@end

void foo(id<P1>); // expected-error {{use of 'P1' requires feature 'feature1' to be unavailable}}