This is an archive of the discontinued LLVM Phabricator instance.

[SemaObjC] Warn on visibility attributes on an @implementation
AcceptedPublic

Authored by erik.pilkington on Apr 29 2020, 8:08 AM.

Details

Summary

D60542 added support for attributes on @implementations, but CodeGen always looks for visibility attributes on the @interface, so these attributes just end up getting ignored. I think we could support them on implementations, but it seems like information that should really belong in the header. This patch explicitly ignores them with a warning.

rdar://60045616

Diff Detail

Event Timeline

This seems fine to me unless there are cases where the user wants to use it on the implementation. I can't think of a case where that is needed.

What if someone wants to use the attribute on either the interface or the implementation but can't modify the header?

aaron.ballman accepted this revision.May 2 2020, 8:09 AM

This seems reasonable to me. I agree that this feels like it's something that should be written on the declaration in the header, not just magically appear on the definition, but I'm not an expert in ObjC to know if there are use cases where this may be useful.

This revision is now accepted and ready to land.May 2 2020, 8:09 AM