TT_ObjCBlockLParen,
TT_ObjCDecl,
TT_ObjCMethodSpecifier,
+ TT_ObjCProperty,
TT_OverloadedOperator,
TT_PointerOrReference,
TT_PureVirtualSpecifier,
LT_PreprocessorDirective,
LT_VirtualFunctionDecl,
LT_ObjCDecl, // An @interface, @implementation, or @protocol line.
- LT_ObjCMethodDecl
+ LT_ObjCMethodDecl,
+ LT_ObjCProperty // An @property line.
};
class AnnotatedToken {
CurrentLineType = LT_ObjCMethodDecl;
else if (RootToken.Type == TT_ObjCDecl)
CurrentLineType = LT_ObjCDecl;
+ else if (RootToken.Type == TT_ObjCProperty)
+ CurrentLineType = LT_ObjCProperty;
if (!RootToken.Children.empty())
calculateExtraInformation(RootToken.Children[0]);
case tok::objc_implementation:
case tok::objc_protocol:
Current.Type = TT_ObjCDecl;
+ break;
+ case tok::objc_property:
+ Current.Type = TT_ObjCProperty;
+ break;
default:
break;
}
// Don't space between ':' and '('
return false;
}
+ if (CurrentLineType == LT_ObjCProperty &&
+ (Tok.is(tok::equal) || Tok.Parent->is(tok::equal)))
+ return false;
if (Tok.Type == TT_CtorInitializerColon || Tok.Type == TT_ObjCBlockLParen)
return true;
verifyFormat("@[");
verifyFormat("@{");
-
EXPECT_EQ("@interface", format("@ interface"));
// The precise formatting of this doesn't matter, nobody writes code like
verifyFormat("@synchronized(self) {\n"
" f();\n"
"}");
+
+ // FIXME: Some Apple code examples don't have spaces around '=' for
+ // @synthesize, decide if that's desired or not in LLVM style. Google style
+ // definitely wants spaces.
verifyFormat("@synthesize dropArrowPosition = dropArrowPosition_;");
+ verifyGoogleFormat("@synthesize dropArrowPosition = dropArrowPosition_;");
- // FIXME: "getter=bar" should not be surround by spaces in @property.
verifyFormat("@property(assign, nonatomic) CGFloat hoverAlpha;");
+ verifyFormat("@property(assign, getter=isEditable) BOOL editable;");
+ verifyGoogleFormat("@property(assign, getter=isEditable) BOOL editable;");
}
} // end namespace tooling