return 150;
if (Left.is(tok::coloncolon))
return 500;
+ if (Left.isOneOf(tok::kw_class, tok::kw_struct))
+ return 5000;
if (Left.Type == TT_RangeBasedForLoopColon ||
Left.Type == TT_InheritanceColon)
if (Left.is(tok::identifier) && Right.is(tok::string_literal))
return true;
return (isBinaryOperator(Left) && Left.isNot(tok::lessless)) ||
- Left.isOneOf(tok::comma, tok::coloncolon, tok::semi, tok::l_brace) ||
+ Left.isOneOf(tok::comma, tok::coloncolon, tok::semi, tok::l_brace,
+ tok::kw_class, tok::kw_struct) ||
Right.isOneOf(tok::lessless, tok::arrow, tok::period, tok::colon) ||
(Left.is(tok::r_paren) && Left.Type != TT_CastRParen &&
Right.isOneOf(tok::identifier, tok::kw___attribute)) ||
"};"));
}
-TEST_F(FormatTest, FormatsDerivedClass) {
+TEST_F(FormatTest, FormatsClasses) {
verifyFormat("class A : public B {\n};");
verifyFormat("class A : public ::B {\n};");
" public F,\n"
" public G {\n"
"};");
+
+ verifyFormat("class\n"
+ " ReallyReallyLongClassName {\n};",
+ getLLVMStyleWithColumns(32));
}
TEST_F(FormatTest, FormatsVariableDeclarationsAfterStructOrClass) {