/// the next line without calling this bin-packing.
bool AllowAllParametersOnNextLine;
+ /// \brief Allow putting the return type of a function onto its own line.
+ bool AllowReturnTypeOnItsOwnLine;
+
/// \brief If the constructor initializers don't fit on a line, put each
/// initializer on its own line.
bool ConstructorInitializerAllOnOneLineOrOnePerLine;
LLVMStyle.SpacesBeforeTrailingComments = 1;
LLVMStyle.BinPackParameters = true;
LLVMStyle.AllowAllParametersOnNextLine = true;
+ LLVMStyle.AllowReturnTypeOnItsOwnLine = true;
LLVMStyle.ConstructorInitializerAllOnOneLineOrOnePerLine = false;
LLVMStyle.AllowShortIfStatementsOnASingleLine = false;
LLVMStyle.ObjCSpaceBeforeProtocolList = true;
GoogleStyle.SpacesBeforeTrailingComments = 2;
GoogleStyle.BinPackParameters = false;
GoogleStyle.AllowAllParametersOnNextLine = true;
+ GoogleStyle.AllowReturnTypeOnItsOwnLine = false;
GoogleStyle.ConstructorInitializerAllOnOneLineOrOnePerLine = true;
GoogleStyle.AllowShortIfStatementsOnASingleLine = false;
GoogleStyle.ObjCSpaceBeforeProtocolList = false;
// Don't break at ':' if identifier before it can beak.
return false;
}
- if (Right.Type == TT_StartOfName)
+ if (Right.Type == TT_StartOfName && Style.AllowReturnTypeOnItsOwnLine)
return true;
if (Right.is(tok::colon) && Right.Type == TT_ObjCMethodExpr)
return false;
"TypeSpecDecl *\n"
"TypeSpecDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L,\n"
" IdentifierIn *II, Type *T) {\n}");
+ verifyGoogleFormat(
+ "TypeSpecDecl* TypeSpecDecl::Create(\n"
+ " ASTContext& C, DeclContext* DC, SourceLocation L) {\n}");
}
TEST_F(FormatTest, LineStartsWithSpecialCharacter) {