[cfe-commits] [patch] Formatter: Put spaces in front of '(' in @implemenation, @interface, @protocol lines
Nico Weber
thakis at chromium.org
Wed Jan 9 17:34:08 PST 2013
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang-format-objcinterface-paren.patch
Type: application/octet-stream
Size: 5211 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130109/f55aa827/attachment.obj>
More information about the cfe-commits
mailing list