Page MenuHomePhabricator

Support for attributes on @class declarations
Needs ReviewPublic

Authored by erik.pilkington on Aug 2 2019, 10:50 AM.



This is useful to make availability checking work with forward declarations, but there also seem to be other attributes that make sense here.


Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptAug 2 2019, 10:50 AM

I don't think I know enough about ObjC semantics to say much about the language design aspects of this patch.


Slight preference for using ParsedAttributesWithRange instead when making new interfaces -- we often need the range when trying to prohibit attributes in places, or for other diagnostic purposes.

However, this may not be feasible depending on where you're getting the attributes from (some parts of the parser are still unfortunately deficient in this regard).


Comment seems out of date now.


Can probably drop this spurious newline.


Do you have plans to fix this? If so, I'm fine with a FIXME for now, but I think the note is essentially a bug as it stands.


What is a "postfix attribute"? I would have assumed this was attempting to add a type attribute rather than a declaration attribute (based on the usual C and C++ semantics), so this diagnostic is a bit unhelpful.

Have you looked through the attributes that can be written on @interfaces and verified that they're all sensible to write on a @class? It's not hard to imagine that *some* of them should be diagnosed when added to a non-definition.