This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Don't add a space before Obj-C selector methods that are also clang-format keywords
AbandonedPublic

Authored by keith on Mar 6 2016, 8:29 PM.

Details

Reviewers
djasper
ksuther
Summary

The following Obj-C methods will get formatted with an extra space between the right paren and the name:

- (void)delete:(id)sender
- (void)export:(id)sender

So they'll incorrectly appear as:

- (void) delete:(id)sender
- (void) export:(id)sender

The fix is to check if the token is a TT_SelectorName instead of tok::identifier. That way keywords recognized by clang-format still get treated as an Obj-C method name (because they're both a TT_SelectorName and tok::delete type).

Diff Detail

Event Timeline

ksuther updated this revision to Diff 49930.Mar 6 2016, 8:29 PM
ksuther retitled this revision from to [clang-format] Don't add a space before Obj-C selector methods that are also clang-format keywords.
ksuther updated this object.
ksuther added a reviewer: djasper.
ksuther added a subscriber: cfe-commits.
keith commandeered this revision.Nov 16 2020, 5:03 PM
keith added a reviewer: ksuther.
keith added a subscriber: keith.

Note the test case shown here passes on master, so we can drop this

keith abandoned this revision.Nov 16 2020, 5:03 PM