diff options
author | Daniel Jasper <djasper@google.com> | 2013-02-05 10:07:47 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-02-05 10:07:47 +0000 |
commit | 63d7cedca8616921c1908c88c2f23fcd67bbab99 (patch) | |
tree | 76ca1fb0f7f86634712e6fc2d578438933ca8d96 /lib/Format/TokenAnnotator.h | |
parent | d399bfff5a57325d8e63116c70aa727b1fb43232 (diff) |
Initial support for formatting ObjC method declarations/calls.
We can now format stuff like:
- (void)doSomethingWith:(GTMFoo *)theFoo
rect:(NSRect)theRect
interval:(float)theInterval {
[myObject doFooWith:arg1 //
name:arg2
error:arg3];
}
This seems to fix everything mentioned in llvm.org/PR14939.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174364 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/TokenAnnotator.h')
-rw-r--r-- | lib/Format/TokenAnnotator.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Format/TokenAnnotator.h b/lib/Format/TokenAnnotator.h index 0386b88f91..64c597e0d9 100644 --- a/lib/Format/TokenAnnotator.h +++ b/lib/Format/TokenAnnotator.h @@ -40,6 +40,7 @@ enum TokenType { TT_ObjCMethodSpecifier, TT_ObjCMethodExpr, TT_ObjCProperty, + TT_ObjCSelectorName, TT_OverloadedOperator, TT_PointerOrReference, TT_PureVirtualSpecifier, @@ -69,7 +70,8 @@ public: : FormatTok(FormatTok), Type(TT_Unknown), SpaceRequiredBefore(false), CanBreakBefore(false), MustBreakBefore(false), ClosesTemplateDeclaration(false), MatchingParen(NULL), - ParameterCount(1), BindingStrength(0), SplitPenalty(0), Parent(NULL) { + ParameterCount(1), BindingStrength(0), SplitPenalty(0), + LongestObjCSelectorName(0), Parent(NULL) { } bool is(tok::TokenKind Kind) const { return FormatTok.Tok.is(Kind); } @@ -109,6 +111,10 @@ public: /// \brief Penalty for inserting a line break before this token. unsigned SplitPenalty; + /// \brief If this is the first ObjC selector name in an ObjC method + /// definition or call, this contains the length of the longest name. + unsigned LongestObjCSelectorName; + std::vector<AnnotatedToken> Children; AnnotatedToken *Parent; |