This is an archive of the discontinued LLVM Phabricator instance.

Clean up ObjCPropertyDecl printing
ClosedPublic

Authored by dgoldman on Feb 8 2019, 11:11 AM.

Details

Summary
  • @property(attr, attr2) instead of @property ( attr,attr2 ).
  • @property NSObject *foo instead of @property NSObject * foo
  • Change priority of attributes (see code/comments inline).
  • Support for printing weak and unsafe_unretained attributes.

Diff Detail

Repository
rL LLVM

Event Timeline

dgoldman created this revision.Feb 8 2019, 11:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 8 2019, 11:11 AM

@arphaman @akyrtzi could you take a look at this?

@property(attr, attr2) instead of @property ( attr,attr2 ).

The style I see most often is @property (attr, attr2), which is in between those two.

Friendly ping

Hi David,
I am just wondering - while you're here would you mind adding couple more tests? It would be great to have a test for each attribute.

Also, what do you think about Ben's suggestion? I think it would be nice to be consistent with the style Objective-C documentation uses:
https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/EncapsulatingData/EncapsulatingData.html

Hi David,
I am just wondering - while you're here would you mind adding couple more tests? It would be great to have a test for each attribute.

Also, what do you think about Ben's suggestion? I think it would be nice to be consistent with the style Objective-C documentation uses:
https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/EncapsulatingData/EncapsulatingData.html

Sure, I can add a few more tests.

Hmm, I've seen it more often the other way around; to be honest I think the docs that you've linked to are outdated. See https://developer.apple.com/documentation/uikit/uiapplication/1622975-sharedapplication?language=objc for an example of what I've seen.

I do think that it would be nice to have X *prop instead of X * prop though, let me try adding that.

dgoldman updated this revision to Diff 189317.Mar 5 2019, 7:26 AM
  • Add more tests and improved printing of pointers
dgoldman updated this revision to Diff 189318.Mar 5 2019, 7:28 AM
  • Fix broken test by last change
dgoldman edited the summary of this revision. (Show Details)

friendly ping

jkorous accepted this revision.Mar 21 2019, 4:12 PM

LGTM. Thanks for working on this!

This revision is now accepted and ready to land.Mar 21 2019, 4:12 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptApr 8 2019, 12:51 PM