[PATCH] Allow trailing comma in Objective-C protocol lists.

Grant Paul grp at fb.com
Mon Mar 30 23:46:16 PDT 2015


Hi,

This patch allows trailing commas in protocol lists. This is useful
when conditionally conforming to protocols. For example:

    @inteface MyView : UIView <
      UITableViewDelegate,
    #ifdef IN_APP_EXTENSION
      UIGestureRecognizerDelegate,
    #endif
    #ifdef OPTIONAL_FEATURE
      UITextFieldDelegate,
    #endif
    >

    @end

Without this patch, there's no clean way to write that because the
protocol list is not allowed to have a trailing comma. (You could use
JavaScript-style leading commas, but that’s not common in C-based
languages.) With this patch, the trailing comma is simply ignored. It’s
similar to how it’s ignored in Objective-C array and dictionary literals.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: protocols.patch
Type: application/octet-stream
Size: 1904 bytes
Desc: protocols.patch
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150331/35eaaa1c/attachment.obj>


More information about the cfe-commits mailing list