**IndentWidth** (``unsigned``)
The number of columns to use for indentation.
+**IndentWrappedFunctionNames** (``bool``)
+ Indent if a function definition or declaration is wrapped after the
+ type.
+
**KeepEmptyLinesAtTheStartOfBlocks** (``bool``)
If true, empty lines at the start of blocks are kept.
/// Switch statement body is always indented one level more than case labels.
bool IndentCaseLabels;
+ /// \brief Indent if a function definition or declaration is wrapped after the
+ /// type.
+ bool IndentWrappedFunctionNames;
+
/// \brief Different ways to indent namespace contents.
enum NamespaceIndentationKind {
/// Don't indent in namespaces.
ExperimentalAutoDetectBinPacking ==
R.ExperimentalAutoDetectBinPacking &&
IndentCaseLabels == R.IndentCaseLabels &&
+ IndentWrappedFunctionNames == R.IndentWrappedFunctionNames &&
IndentWidth == R.IndentWidth && Language == R.Language &&
MaxEmptyLinesToKeep == R.MaxEmptyLinesToKeep &&
KeepEmptyLinesAtTheStartOfBlocks ==
return State.Stack.back().VariablePos;
if ((PreviousNonComment && (PreviousNonComment->ClosesTemplateDeclaration ||
PreviousNonComment->Type == TT_AttributeParen)) ||
- NextNonComment->is(tok::kw_operator) ||
- NextNonComment->Type == TT_FunctionDeclarationName)
+ (!Style.IndentWrappedFunctionNames &&
+ (NextNonComment->is(tok::kw_operator) ||
+ NextNonComment->Type == TT_FunctionDeclarationName)))
return std::max(State.Stack.back().LastSpace, State.Stack.back().Indent);
if (NextNonComment->Type == TT_SelectorName) {
if (!State.Stack.back().ObjCSelectorNameFound) {
IO.mapOptional("ExperimentalAutoDetectBinPacking",
Style.ExperimentalAutoDetectBinPacking);
IO.mapOptional("IndentCaseLabels", Style.IndentCaseLabels);
+ IO.mapOptional("IndentWrappedFunctionNames",
+ Style.IndentWrappedFunctionNames);
+ IO.mapOptional("IndentFunctionDeclarationAfterType",
+ Style.IndentWrappedFunctionNames);
IO.mapOptional("MaxEmptyLinesToKeep", Style.MaxEmptyLinesToKeep);
IO.mapOptional("KeepEmptyLinesAtTheStartOfBlocks",
Style.KeepEmptyLinesAtTheStartOfBlocks);
LLVMStyle.ForEachMacros.push_back("Q_FOREACH");
LLVMStyle.ForEachMacros.push_back("BOOST_FOREACH");
LLVMStyle.IndentCaseLabels = false;
+ LLVMStyle.IndentWrappedFunctionNames = false;
LLVMStyle.IndentWidth = 2;
LLVMStyle.TabWidth = 8;
LLVMStyle.MaxEmptyLinesToKeep = 1;
"LooooooooooooooooooooooooooooooooooongFunctionDefinition() {}");
verifyFormat("decltype(LoooooooooooooooooooooooooooooooooooooooongName)\n"
"LooooooooooooooooooooooooooooooooooongFunctionDefinition() {}");
+ FormatStyle Indented = getLLVMStyle();
+ Indented.IndentWrappedFunctionNames = true;
+ verifyFormat("LoooooooooooooooooooooooooooooooooooooooongReturnType\n"
+ " LoooooooooooooooooooooooooooooooongFunctionDeclaration();",
+ Indented);
+ verifyFormat(
+ "LoooooooooooooooooooooooooooooooooooooooongReturnType\n"
+ " LooooooooooooooooooooooooooooooooooongFunctionDefinition() {}",
+ Indented);
+ verifyFormat(
+ "LoooooooooooooooooooooooooooooooooooooooongReturnType const\n"
+ " LooooooooooooooooooooooooooooooooooongFunctionDefinition() {}",
+ Indented);
+ verifyFormat(
+ "decltype(LoooooooooooooooooooooooooooooooooooooooongName)\n"
+ " LooooooooooooooooooooooooooooooooooongFunctionDefinition() {}",
+ Indented);
// FIXME: Without the comment, this breaks after "(".
verifyFormat("LoooooooooooooooooooooooooooooooooooooooongType // break\n"
CHECK_PARSE_BOOL(ConstructorInitializerAllOnOneLineOrOnePerLine);
CHECK_PARSE_BOOL(DerivePointerAlignment);
CHECK_PARSE_BOOL(IndentCaseLabels);
+ CHECK_PARSE_BOOL(IndentWrappedFunctionNames);
CHECK_PARSE_BOOL(KeepEmptyLinesAtTheStartOfBlocks);
CHECK_PARSE_BOOL(ObjCSpaceAfterProperty);
CHECK_PARSE_BOOL(ObjCSpaceBeforeProtocolList);