This is an archive of the discontinued LLVM Phabricator instance.

Don't emit `-Wnullability-completeness` warnings on `weak` Objective-C properties.
ClosedPublic

Authored by mwyman on Jun 16 2022, 11:12 PM.

Details

Summary

Zeroing weak references are by definition nullable, and adding nonnull or _Nonnull yields a mutual-exclusivity error. However, when -Wnullability-completeness is enabled, in non-audited header regions it's necessary to add the nullable property keyword to avoid a warning. It should not be necessary to add code clutter to restate the nullability of a weak property even under -Wnullability-completeness.

Additionally, the fix-it hints are both non-idiomatic Objective-C (adding _Nullable to the property's pointer type rather than in the @property attributes) and suggest the option of adding _Nonnull (which would be an error).

Diff Detail

Event Timeline

mwyman created this revision.Jun 16 2022, 11:12 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 16 2022, 11:12 PM
mwyman requested review of this revision.Jun 16 2022, 11:12 PM
mwyman updated this revision to Diff 440390.Jun 27 2022, 2:10 PM

Adding Doug Gregor who appears to have created the original warning.

mwyman updated this revision to Diff 469020.Oct 19 2022, 1:16 PM
This revision is now accepted and ready to land.Oct 20 2022, 5:40 PM