[cfe-commits] [patch] Formatter: Put spaces in front of '(' in @implemenation, @interface, @protocol lines

Daniel Jasper djasper at google.com
Thu Jan 10 10:55:18 PST 2013


Looks good.

   LT_VirtualFunctionDecl,
-  LT_ObjCMethodDecl
+  LT_ObjCMethodDecl,
+  LT_ObjCDecl // An @interface, @implementation, or @protocol line.

Note that I have sorted these alphabetically now. Sorry in advance for the
conflict.


On Thu, Jan 10, 2013 at 2:34 AM, Nico Weber <thakis at chromium.org> wrote:

> Hi,
>
> the attached patch changes the formatting of `@interface Foo(Bar)` to
> `@interface (Bar)`, as requested by Jordy.
>
> I'm doing this by letting TokenAnnotator::determineTokenTypes() set
> the Type of the first token in a line to TT_ObjCDecl if the line
> starts with @interface, @implementation, or @protocol, and then
> havingTokenAnnotator::annotate() change the CurrentLineType to
> LT_ObjCDecl if the line's first token's Type is TT_ObjCDecl. This is a
> bit roundabout, but seems to match how LT_ObjCMethodDecl is set.
>
> Once that's done, TokenAnnotator::spaceRequiredBetween(lhs, rhs) just
> returns true if the rhs is a '(' and the CurrentLineType is
> LT_ObjCDecl.
>
> Does this look like the right way to go about things?
>
> Nico
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130110/2fcfabf9/attachment.html>


More information about the cfe-commits mailing list