Page MenuHomePhabricator

[Clang][Sema] Fix attribute mismatch warning for ObjC class properties
ClosedPublic

Authored by egorzhdan on Dec 30 2021, 6:27 AM.

Details

Summary

If a class declares an instance property, and an inheritor class declares a class property with the same name, Clang Sema currently treats the latter as an overridden property, and compares the attributes of the two properties to check for a mismatch. The resulting diagnostics might be misleading, since neither of the properties actually overrides the another one.

rdar://86018435

Diff Detail

Event Timeline

egorzhdan requested review of this revision.Dec 30 2021, 6:27 AM
egorzhdan created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptDec 30 2021, 6:27 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

I think we would still want to diagnose any mismatches between class properties that override a class property in the superclass. do you think that would be useful? You can adjust the lookup to take that into account.

egorzhdan updated this revision to Diff 398601.Jan 10 2022, 5:58 AM

Diagnose mismatches between class property of a class and a class property of its superclass.

arphaman accepted this revision.Jan 10 2022, 2:46 PM

LGTM, Cheers!

This revision is now accepted and ready to land.Jan 10 2022, 2:46 PM
egorzhdan updated this revision to Diff 398753.Jan 10 2022, 3:05 PM

Fix clang-format warning

This revision was landed with ongoing or failed builds.Jan 11 2022, 4:32 AM
This revision was automatically updated to reflect the committed changes.