This is an archive of the discontinued LLVM Phabricator instance.

Objective-C categories should support attributes
ClosedPublic

Authored by arphaman on Mar 21 2017, 4:39 AM.

Details

Summary

We need to support attributes on Objective-C categories to allow the use of external_source_symbol attributes for categories. We don't want to use the external_source_symbol attributes from the interfaces for categories because they might come from a different Swift module.

Diff Detail

Repository
rL LLVM

Event Timeline

arphaman created this revision.Mar 21 2017, 4:39 AM
arphaman retitled this revision from Objective-C categ to Objective-C categories should support attributes.Mar 21 2017, 4:41 AM
arphaman edited the summary of this revision. (Show Details)

Sorry about an empty body, I had a keyboard malfunction. I have updated the patch now.

nathawes accepted this revision.Mar 21 2017, 9:37 AM

Thanks for this – looks good to me!

This revision is now accepted and ready to land.Mar 21 2017, 9:37 AM
aaron.ballman added inline comments.Mar 21 2017, 9:42 AM
test/SemaObjC/attr-deprecated.m
124–128

I would have assumed the use in the @implementation would have been enough to trigger it, is that not the behavior we'd want?

If not, can you extend the test to show that a use of the category triggers the deprecation warning?

arphaman added inline comments.Mar 21 2017, 11:09 AM
test/SemaObjC/attr-deprecated.m
124–128

I'm not sure. Typically an implementation of a category is located in a framework, so even if it's deprecated for the users of a framework, you wouldn't really want to get a warning about it when compiling that framework. That said there's is a non-default -Wdeprecated-implementation warning for class implementations, so I think it would make sense to use it for category implementations as well. I will add make sure that the warning is emitted when committing the patch.

This revision was automatically updated to reflect the committed changes.
lolgear added a subscriber: lolgear.Aug 1 2018, 3:57 AM

Well, deprecated category only shows "Implementing deprecated category" message.
However, I would like to tell users that all methods of this category are deprecated.
For that I need to add deprecated attribute for each method in this category.

lolgear removed a subscriber: lolgear.Aug 1 2018, 4:00 AM