Index: include/clang/Format/Format.h =================================================================== --- include/clang/Format/Format.h +++ include/clang/Format/Format.h @@ -40,168 +40,50 @@ /// \brief The \c FormatStyle is used to configure the formatting to follow /// specific guidelines. struct FormatStyle { - /// \brief Supported languages. When stored in a configuration file, specifies - /// the language, that the configuration targets. When passed to the - /// reformat() function, enables syntax features specific to the language. - enum LanguageKind { - /// Do not use. - LK_None, - /// Should be used for C, C++, ObjectiveC, ObjectiveC++. - LK_Cpp, - /// Should be used for Java. - LK_Java, - /// Should be used for JavaScript. - LK_JavaScript, - /// Should be used for Protocol Buffers - /// (https://developers.google.com/protocol-buffers/). - LK_Proto - }; - - /// \brief Language, this format style is targeted at. - LanguageKind Language; - - /// \brief The column limit. - /// - /// A column limit of \c 0 means that there is no column limit. In this case, - /// clang-format will respect the input's line breaking decisions within - /// statements unless they contradict other rules. - unsigned ColumnLimit; - - /// \brief The maximum number of consecutive empty lines to keep. - unsigned MaxEmptyLinesToKeep; - - /// \brief If true, empty lines at the start of blocks are kept. - bool KeepEmptyLinesAtTheStartOfBlocks; - - /// \brief The penalty for each line break introduced inside a comment. - unsigned PenaltyBreakComment; - - /// \brief The penalty for each line break introduced inside a string literal. - unsigned PenaltyBreakString; - - /// \brief The penalty for each character outside of the column limit. - unsigned PenaltyExcessCharacter; - - /// \brief The penalty for breaking before the first \c <<. - unsigned PenaltyBreakFirstLessLess; - - /// \brief The penalty for breaking a function call after "call(". - unsigned PenaltyBreakBeforeFirstCallParameter; - - /// \brief The & and * alignment style. - enum PointerAlignmentStyle { - /// Align pointer to the left. - PAS_Left, - /// Align pointer to the right. - PAS_Right, - /// Align pointer in the middle. - PAS_Middle - }; - - /// Pointer and reference alignment style. - PointerAlignmentStyle PointerAlignment; - - /// \brief If \c true, analyze the formatted file for the most common - /// alignment of & and *. \c PointerAlignment is then used only as fallback. - bool DerivePointerAlignment; - /// \brief The extra indent or outdent of access modifiers, e.g. \c public:. int AccessModifierOffset; - /// \brief Supported language standards. - enum LanguageStandard { - /// Use C++03-compatible syntax. - LS_Cpp03, - /// Use features of C++11 (e.g. \c A> instead of - /// A >). - LS_Cpp11, - /// Automatic detection based on the input. - LS_Auto - }; - - /// \brief Format compatible with this standard, e.g. use - /// A > instead of \c A> for LS_Cpp03. - LanguageStandard Standard; - - /// \brief Indent case labels one level from the switch statement. + /// \brief If \c true, horizontally aligns arguments after an open bracket. /// - /// When \c false, use the same indentation level as for the switch statement. - /// 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. - NI_None, - /// Indent only in inner namespaces (nested in other namespaces). - NI_Inner, - /// Indent in all namespaces. - NI_All - }; - - /// \brief The indentation used for namespaces. - NamespaceIndentationKind NamespaceIndentation; + /// This applies to round brackets (parentheses), angle brackets and square + /// brackets. This will result in formattings like + /// \code + /// someLongFunction(argument1, + /// argument2); + /// \endcode + bool AlignAfterOpenBracket; - /// \brief The number of spaces before trailing line comments - /// (\c // - comments). + /// \brief If \c true, aligns consecutive assignments. /// - /// This does not affect trailing block comments (\c /**/ - comments) as those - /// commonly have different usage patterns and a number of special cases. - unsigned SpacesBeforeTrailingComments; + /// This will align the assignment operators of consecutive lines. This + /// will result in formattings like + /// \code + /// int aaaa = 12; + /// int b = 23; + /// int ccc = 23; + /// \endcode + bool AlignConsecutiveAssignments; - /// \brief If \c false, a function declaration's or function definition's - /// parameters will either all be on the same line or will have one line each. - bool BinPackParameters; + /// \brief If \c true, aligns escaped newlines as far left as possible. + /// Otherwise puts them into the right-most column. + bool AlignEscapedNewlinesLeft; - /// \brief If \c false, a function call's arguments will either be all on the - /// same line or will have one line each. - bool BinPackArguments; + /// \brief If \c true, horizontally align operands of binary and ternary + /// expressions. + bool AlignOperands; - /// \brief If \c true, clang-format detects whether function calls and - /// definitions are formatted with one parameter per line. - /// - /// Each call can be bin-packed, one-per-line or inconclusive. If it is - /// inconclusive, e.g. completely on one line, but a decision needs to be - /// made, clang-format analyzes whether there are other bin-packed cases in - /// the input file and act accordingly. - /// - /// NOTE: This is an experimental flag, that might go away or be renamed. Do - /// not use this in config files, etc. Use at your own risk. - bool ExperimentalAutoDetectBinPacking; + /// \brief If \c true, aligns trailing comments. + bool AlignTrailingComments; /// \brief Allow putting all parameters of a function declaration onto /// the next line even if \c BinPackParameters is \c false. bool AllowAllParametersOfDeclarationOnNextLine; - /// \brief Penalty for putting the return type of a function onto its own - /// line. - unsigned PenaltyReturnTypeOnItsOwnLine; - - /// \brief If the constructor initializers don't fit on a line, put each - /// initializer on its own line. - bool ConstructorInitializerAllOnOneLineOrOnePerLine; - - /// \brief Always break constructor initializers before commas and align - /// the commas with the colon. - bool BreakConstructorInitializersBeforeComma; - /// \brief Allows contracting simple braced statements to a single line. /// /// E.g., this allows if (a) { return; } to be put on a single line. bool AllowShortBlocksOnASingleLine; - /// \brief If \c true, if (a) return; can be put on a single - /// line. - bool AllowShortIfStatementsOnASingleLine; - - /// \brief If \c true, while (true) continue; can be put on a - /// single line. - bool AllowShortLoopsOnASingleLine; - /// \brief If \c true, short case labels will be contracted to a single line. bool AllowShortCaseLabelsOnASingleLine; @@ -222,58 +104,13 @@ /// on a single line. ShortFunctionStyle AllowShortFunctionsOnASingleLine; - /// \brief Add a space after \c @property in Objective-C, i.e. use - /// \@property (readonly) instead of \@property(readonly). - bool ObjCSpaceAfterProperty; - - /// \brief Add a space in front of an Objective-C protocol list, i.e. use - /// Foo instead of \c Foo. - bool ObjCSpaceBeforeProtocolList; - - /// \brief If \c true, horizontally aligns arguments after an open bracket. - /// - /// This applies to round brackets (parentheses), angle brackets and square - /// brackets. This will result in formattings like - /// \code - /// someLongFunction(argument1, - /// argument2); - /// \endcode - bool AlignAfterOpenBracket; - - /// \brief If \c true, horizontally align operands of binary and ternary - /// expressions. - bool AlignOperands; - - /// \brief If \c true, aligns trailing comments. - bool AlignTrailingComments; - - /// \brief If \c true, aligns consecutive assignments. - /// - /// This will align the assignment operators of consecutive lines. This - /// will result in formattings like - /// \code - /// int aaaa = 12; - /// int b = 23; - /// int ccc = 23; - /// \endcode - bool AlignConsecutiveAssignments; - - /// \brief If \c true, aligns escaped newlines as far left as possible. - /// Otherwise puts them into the right-most column. - bool AlignEscapedNewlinesLeft; - - /// \brief The number of columns to use for indentation. - unsigned IndentWidth; - - /// \brief The number of columns used for tab stops. - unsigned TabWidth; - - /// \brief The number of characters to use for indentation of constructor - /// initializer lists. - unsigned ConstructorInitializerIndentWidth; + /// \brief If \c true, if (a) return; can be put on a single + /// line. + bool AllowShortIfStatementsOnASingleLine; - /// \brief The number of characters to use for indentation of ObjC blocks. - unsigned ObjCBlockIndentWidth; + /// \brief If \c true, while (true) continue; can be put on a + /// single line. + bool AllowShortLoopsOnASingleLine; /// \brief If \c true, always break after function definition return types. /// @@ -282,10 +119,6 @@ /// irrelevant. bool AlwaysBreakAfterDefinitionReturnType; - /// \brief If \c true, always break after the template<...> of a - /// template declaration. - bool AlwaysBreakTemplateDeclarations; - /// \brief If \c true, always break before multiline string literals. /// /// This flag is mean to make cases where there are multiple multiline strings @@ -294,19 +127,17 @@ /// \c ContinuationIndentWidth spaces from the start of the line. bool AlwaysBreakBeforeMultilineStrings; - /// \brief Different ways to use tab in formatting. - enum UseTabStyle { - /// Never use tab. - UT_Never, - /// Use tabs only for indentation. - UT_ForIndentation, - /// Use tabs whenever we need to fill whitespace that spans at least from - /// one tab stop to the next one. - UT_Always - }; + /// \brief If \c true, always break after the template<...> of a + /// template declaration. + bool AlwaysBreakTemplateDeclarations; - /// \brief The way to use tab characters in the resulting file. - UseTabStyle UseTab; + /// \brief If \c false, a function call's arguments will either be all on the + /// same line or will have one line each. + bool BinPackArguments; + + /// \brief If \c false, a function declaration's or function definition's + /// parameters will either all be on the same line or will have one line each. + bool BinPackParameters; /// \brief The style of breaking before or after binary operators. enum BinaryOperatorStyle { @@ -321,9 +152,6 @@ /// \brief The way to wrap binary operators. BinaryOperatorStyle BreakBeforeBinaryOperators; - /// \brief If \c true, ternary operators will be placed after line breaks. - bool BreakBeforeTernaryOperators; - /// \brief Different ways to attach braces to their surrounding context. enum BraceBreakingStyle { /// Always attach braces to surrounding context. @@ -341,8 +169,37 @@ BS_GNU }; - /// \brief The brace breaking style to use. - BraceBreakingStyle BreakBeforeBraces; + /// \brief The brace breaking style to use. + BraceBreakingStyle BreakBeforeBraces; + + /// \brief If \c true, ternary operators will be placed after line breaks. + bool BreakBeforeTernaryOperators; + + /// \brief Always break constructor initializers before commas and align + /// the commas with the colon. + bool BreakConstructorInitializersBeforeComma; + + /// \brief The column limit. + /// + /// A column limit of \c 0 means that there is no column limit. In this case, + /// clang-format will respect the input's line breaking decisions within + /// statements unless they contradict other rules. + unsigned ColumnLimit; + + /// \brief A regular expression that describes comments with special meaning, + /// which should not be split into lines or otherwise changed. + std::string CommentPragmas; + + /// \brief If the constructor initializers don't fit on a line, put each + /// initializer on its own line. + bool ConstructorInitializerAllOnOneLineOrOnePerLine; + + /// \brief The number of characters to use for indentation of constructor + /// initializer lists. + unsigned ConstructorInitializerIndentWidth; + + /// \brief Indent width for line continuations. + unsigned ContinuationIndentWidth; /// \brief If \c true, format braced lists as best suited for C++11 braced /// lists. @@ -359,29 +216,138 @@ /// a zero-length name is assumed. bool Cpp11BracedListStyle; - /// \brief If \c true, spaces will be inserted after '(' and before ')'. - bool SpacesInParentheses; + /// \brief If \c true, analyze the formatted file for the most common + /// alignment of & and *. \c PointerAlignment is then used only as fallback. + bool DerivePointerAlignment; - /// \brief If \c true, spaces will be inserted after '<' and before '>' in - /// template argument lists - bool SpacesInAngles; + /// \brief Disables formatting at all. + bool DisableFormat; - /// \brief If \c true, spaces will be inserted after '[' and before ']'. - bool SpacesInSquareBrackets; + /// \brief If \c true, clang-format detects whether function calls and + /// definitions are formatted with one parameter per line. + /// + /// Each call can be bin-packed, one-per-line or inconclusive. If it is + /// inconclusive, e.g. completely on one line, but a decision needs to be + /// made, clang-format analyzes whether there are other bin-packed cases in + /// the input file and act accordingly. + /// + /// NOTE: This is an experimental flag, that might go away or be renamed. Do + /// not use this in config files, etc. Use at your own risk. + bool ExperimentalAutoDetectBinPacking; - /// \brief If \c true, spaces may be inserted into '()'. - bool SpaceInEmptyParentheses; + /// \brief A vector of macros that should be interpreted as foreach loops + /// instead of as function calls. + /// + /// These are expected to be macros of the form: + /// \code + /// FOREACH(, ...) + /// + /// \endcode + /// + /// For example: BOOST_FOREACH. + std::vector ForEachMacros; - /// \brief If \c true, spaces are inserted inside container literals (e.g. - /// ObjC and Javascript array and dict literals). - bool SpacesInContainerLiterals; + /// \brief Indent case labels one level from the switch statement. + /// + /// When \c false, use the same indentation level as for the switch statement. + /// Switch statement body is always indented one level more than case labels. + bool IndentCaseLabels; - /// \brief If \c true, spaces may be inserted into C style casts. - bool SpacesInCStyleCastParentheses; + /// \brief The number of columns to use for indentation. + unsigned IndentWidth; + + /// \brief Indent if a function definition or declaration is wrapped after the + /// type. + bool IndentWrappedFunctionNames; + + /// \brief If true, empty lines at the start of blocks are kept. + bool KeepEmptyLinesAtTheStartOfBlocks; + + /// \brief Supported languages. When stored in a configuration file, specifies + /// the language, that the configuration targets. When passed to the + /// reformat() function, enables syntax features specific to the language. + enum LanguageKind { + /// Do not use. + LK_None, + /// Should be used for C, C++, ObjectiveC, ObjectiveC++. + LK_Cpp, + /// Should be used for Java. + LK_Java, + /// Should be used for JavaScript. + LK_JavaScript, + /// Should be used for Protocol Buffers + /// (https://developers.google.com/protocol-buffers/). + LK_Proto + }; + + /// \brief Language, this format style is targeted at. + LanguageKind Language; + + /// \brief The maximum number of consecutive empty lines to keep. + unsigned MaxEmptyLinesToKeep; + + /// \brief Different ways to indent namespace contents. + enum NamespaceIndentationKind { + /// Don't indent in namespaces. + NI_None, + /// Indent only in inner namespaces (nested in other namespaces). + NI_Inner, + /// Indent in all namespaces. + NI_All + }; + + /// \brief The indentation used for namespaces. + NamespaceIndentationKind NamespaceIndentation; + + /// \brief The number of characters to use for indentation of ObjC blocks. + unsigned ObjCBlockIndentWidth; + + /// \brief Add a space after \c @property in Objective-C, i.e. use + /// \@property (readonly) instead of \@property(readonly). + bool ObjCSpaceAfterProperty; + + /// \brief Add a space in front of an Objective-C protocol list, i.e. use + /// Foo instead of \c Foo. + bool ObjCSpaceBeforeProtocolList; + + /// \brief The penalty for breaking a function call after "call(". + unsigned PenaltyBreakBeforeFirstCallParameter; + + /// \brief The penalty for each line break introduced inside a comment. + unsigned PenaltyBreakComment; + + /// \brief The penalty for breaking before the first \c <<. + unsigned PenaltyBreakFirstLessLess; + + /// \brief The penalty for each line break introduced inside a string literal. + unsigned PenaltyBreakString; + + /// \brief The penalty for each character outside of the column limit. + unsigned PenaltyExcessCharacter; + + /// \brief Penalty for putting the return type of a function onto its own + /// line. + unsigned PenaltyReturnTypeOnItsOwnLine; + + /// \brief The & and * alignment style. + enum PointerAlignmentStyle { + /// Align pointer to the left. + PAS_Left, + /// Align pointer to the right. + PAS_Right, + /// Align pointer in the middle. + PAS_Middle + }; + + /// Pointer and reference alignment style. + PointerAlignmentStyle PointerAlignment; /// \brief If \c true, a space may be inserted after C style casts. bool SpaceAfterCStyleCast; + /// \brief If \c false, spaces will be removed before assignment operators. + bool SpaceBeforeAssignmentOperators; + /// \brief Different ways to put a space before opening parentheses. enum SpaceBeforeParensOptions { /// Never put a space before opening parentheses. @@ -399,72 +365,110 @@ /// \brief Defines in which cases to put a space before opening parentheses. SpaceBeforeParensOptions SpaceBeforeParens; - /// \brief If \c false, spaces will be removed before assignment operators. - bool SpaceBeforeAssignmentOperators; + /// \brief If \c true, spaces may be inserted into '()'. + bool SpaceInEmptyParentheses; - /// \brief Indent width for line continuations. - unsigned ContinuationIndentWidth; + /// \brief The number of spaces before trailing line comments + /// (\c // - comments). + /// + /// This does not affect trailing block comments (\c /**/ - comments) as those + /// commonly have different usage patterns and a number of special cases. + unsigned SpacesBeforeTrailingComments; - /// \brief A regular expression that describes comments with special meaning, - /// which should not be split into lines or otherwise changed. - std::string CommentPragmas; + /// \brief If \c true, spaces will be inserted after '<' and before '>' in + /// template argument lists + bool SpacesInAngles; - /// \brief Disables formatting at all. - bool DisableFormat; + /// \brief If \c true, spaces are inserted inside container literals (e.g. + /// ObjC and Javascript array and dict literals). + bool SpacesInContainerLiterals; - /// \brief A vector of macros that should be interpreted as foreach loops - /// instead of as function calls. - /// - /// These are expected to be macros of the form: - /// \code - /// FOREACH(, ...) - /// - /// \endcode - /// - /// For example: BOOST_FOREACH. - std::vector ForEachMacros; + /// \brief If \c true, spaces may be inserted into C style casts. + bool SpacesInCStyleCastParentheses; + + /// \brief If \c true, spaces will be inserted after '(' and before ')'. + bool SpacesInParentheses; + + /// \brief If \c true, spaces will be inserted after '[' and before ']'. + bool SpacesInSquareBrackets; + + /// \brief Supported language standards. + enum LanguageStandard { + /// Use C++03-compatible syntax. + LS_Cpp03, + /// Use features of C++11 (e.g. \c A> instead of + /// A >). + LS_Cpp11, + /// Automatic detection based on the input. + LS_Auto + }; + + /// \brief Format compatible with this standard, e.g. use + /// A > instead of \c A> for LS_Cpp03. + LanguageStandard Standard; + + /// \brief The number of columns used for tab stops. + unsigned TabWidth; + + /// \brief Different ways to use tab in formatting. + enum UseTabStyle { + /// Never use tab. + UT_Never, + /// Use tabs only for indentation. + UT_ForIndentation, + /// Use tabs whenever we need to fill whitespace that spans at least from + /// one tab stop to the next one. + UT_Always + }; + + /// \brief The way to use tab characters in the resulting file. + UseTabStyle UseTab; bool operator==(const FormatStyle &R) const { return AccessModifierOffset == R.AccessModifierOffset && AlignAfterOpenBracket == R.AlignAfterOpenBracket && - AlignOperands == R.AlignOperands && AlignEscapedNewlinesLeft == R.AlignEscapedNewlinesLeft && + AlignOperands == R.AlignOperands && AlignTrailingComments == R.AlignTrailingComments && AllowAllParametersOfDeclarationOnNextLine == R.AllowAllParametersOfDeclarationOnNextLine && + AllowShortBlocksOnASingleLine == R.AllowShortBlocksOnASingleLine && AllowShortFunctionsOnASingleLine == R.AllowShortFunctionsOnASingleLine && - AllowShortBlocksOnASingleLine == R.AllowShortBlocksOnASingleLine && AllowShortIfStatementsOnASingleLine == R.AllowShortIfStatementsOnASingleLine && AllowShortLoopsOnASingleLine == R.AllowShortLoopsOnASingleLine && AlwaysBreakAfterDefinitionReturnType == R.AlwaysBreakAfterDefinitionReturnType && - AlwaysBreakTemplateDeclarations == - R.AlwaysBreakTemplateDeclarations && AlwaysBreakBeforeMultilineStrings == R.AlwaysBreakBeforeMultilineStrings && - BinPackParameters == R.BinPackParameters && + AlwaysBreakTemplateDeclarations == + R.AlwaysBreakTemplateDeclarations && BinPackArguments == R.BinPackArguments && + BinPackParameters == R.BinPackParameters && BreakBeforeBinaryOperators == R.BreakBeforeBinaryOperators && - BreakBeforeTernaryOperators == R.BreakBeforeTernaryOperators && BreakBeforeBraces == R.BreakBeforeBraces && + BreakBeforeTernaryOperators == R.BreakBeforeTernaryOperators && BreakConstructorInitializersBeforeComma == R.BreakConstructorInitializersBeforeComma && ColumnLimit == R.ColumnLimit && + CommentPragmas == R.CommentPragmas && ConstructorInitializerAllOnOneLineOrOnePerLine == R.ConstructorInitializerAllOnOneLineOrOnePerLine && ConstructorInitializerIndentWidth == R.ConstructorInitializerIndentWidth && + ContinuationIndentWidth == R.ContinuationIndentWidth && + Cpp11BracedListStyle == R.Cpp11BracedListStyle && DerivePointerAlignment == R.DerivePointerAlignment && ExperimentalAutoDetectBinPacking == R.ExperimentalAutoDetectBinPacking && + ForEachMacros == R.ForEachMacros && IndentCaseLabels == R.IndentCaseLabels && - IndentWrappedFunctionNames == R.IndentWrappedFunctionNames && IndentWidth == R.IndentWidth && Language == R.Language && - MaxEmptyLinesToKeep == R.MaxEmptyLinesToKeep && + IndentWrappedFunctionNames == R.IndentWrappedFunctionNames && KeepEmptyLinesAtTheStartOfBlocks == R.KeepEmptyLinesAtTheStartOfBlocks && + MaxEmptyLinesToKeep == R.MaxEmptyLinesToKeep && NamespaceIndentation == R.NamespaceIndentation && ObjCBlockIndentWidth == R.ObjCBlockIndentWidth && ObjCSpaceAfterProperty == R.ObjCSpaceAfterProperty && @@ -475,21 +479,19 @@ PenaltyExcessCharacter == R.PenaltyExcessCharacter && PenaltyReturnTypeOnItsOwnLine == R.PenaltyReturnTypeOnItsOwnLine && PointerAlignment == R.PointerAlignment && + SpaceAfterCStyleCast == R.SpaceAfterCStyleCast && + SpaceBeforeAssignmentOperators == R.SpaceBeforeAssignmentOperators && + SpaceBeforeParens == R.SpaceBeforeParens && + SpaceInEmptyParentheses == R.SpaceInEmptyParentheses && SpacesBeforeTrailingComments == R.SpacesBeforeTrailingComments && - Cpp11BracedListStyle == R.Cpp11BracedListStyle && - Standard == R.Standard && TabWidth == R.TabWidth && - UseTab == R.UseTab && SpacesInParentheses == R.SpacesInParentheses && - SpacesInSquareBrackets == R.SpacesInSquareBrackets && SpacesInAngles == R.SpacesInAngles && - SpaceInEmptyParentheses == R.SpaceInEmptyParentheses && SpacesInContainerLiterals == R.SpacesInContainerLiterals && SpacesInCStyleCastParentheses == R.SpacesInCStyleCastParentheses && - SpaceAfterCStyleCast == R.SpaceAfterCStyleCast && - SpaceBeforeParens == R.SpaceBeforeParens && - SpaceBeforeAssignmentOperators == R.SpaceBeforeAssignmentOperators && - ContinuationIndentWidth == R.ContinuationIndentWidth && - CommentPragmas == R.CommentPragmas && - ForEachMacros == R.ForEachMacros; + SpacesInParentheses == R.SpacesInParentheses && + SpacesInSquareBrackets == R.SpacesInSquareBrackets && + Standard == R.Standard && + TabWidth == R.TabWidth && + UseTab == R.UseTab; } }; Index: lib/Format/Format.cpp =================================================================== --- lib/Format/Format.cpp +++ lib/Format/Format.cpp @@ -171,53 +171,60 @@ IO.mapOptional("AccessModifierOffset", Style.AccessModifierOffset); IO.mapOptional("AlignAfterOpenBracket", Style.AlignAfterOpenBracket); + IO.mapOptional("AlignConsecutiveAssignments", + Style.AlignConsecutiveAssignments); IO.mapOptional("AlignEscapedNewlinesLeft", Style.AlignEscapedNewlinesLeft); IO.mapOptional("AlignOperands", Style.AlignOperands); IO.mapOptional("AlignTrailingComments", Style.AlignTrailingComments); - IO.mapOptional("AlignConsecutiveAssignments", - Style.AlignConsecutiveAssignments); IO.mapOptional("AllowAllParametersOfDeclarationOnNextLine", Style.AllowAllParametersOfDeclarationOnNextLine); IO.mapOptional("AllowShortBlocksOnASingleLine", Style.AllowShortBlocksOnASingleLine); IO.mapOptional("AllowShortCaseLabelsOnASingleLine", Style.AllowShortCaseLabelsOnASingleLine); + IO.mapOptional("AllowShortFunctionsOnASingleLine", + Style.AllowShortFunctionsOnASingleLine); IO.mapOptional("AllowShortIfStatementsOnASingleLine", Style.AllowShortIfStatementsOnASingleLine); IO.mapOptional("AllowShortLoopsOnASingleLine", Style.AllowShortLoopsOnASingleLine); - IO.mapOptional("AllowShortFunctionsOnASingleLine", - Style.AllowShortFunctionsOnASingleLine); IO.mapOptional("AlwaysBreakAfterDefinitionReturnType", Style.AlwaysBreakAfterDefinitionReturnType); - IO.mapOptional("AlwaysBreakTemplateDeclarations", - Style.AlwaysBreakTemplateDeclarations); IO.mapOptional("AlwaysBreakBeforeMultilineStrings", Style.AlwaysBreakBeforeMultilineStrings); + IO.mapOptional("AlwaysBreakTemplateDeclarations", + Style.AlwaysBreakTemplateDeclarations); + IO.mapOptional("BinPackArguments", Style.BinPackArguments); + IO.mapOptional("BinPackParameters", Style.BinPackParameters); IO.mapOptional("BreakBeforeBinaryOperators", Style.BreakBeforeBinaryOperators); + IO.mapOptional("BreakBeforeBraces", Style.BreakBeforeBraces); IO.mapOptional("BreakBeforeTernaryOperators", Style.BreakBeforeTernaryOperators); IO.mapOptional("BreakConstructorInitializersBeforeComma", Style.BreakConstructorInitializersBeforeComma); - IO.mapOptional("BinPackParameters", Style.BinPackParameters); - IO.mapOptional("BinPackArguments", Style.BinPackArguments); IO.mapOptional("ColumnLimit", Style.ColumnLimit); + IO.mapOptional("CommentPragmas", Style.CommentPragmas); IO.mapOptional("ConstructorInitializerAllOnOneLineOrOnePerLine", Style.ConstructorInitializerAllOnOneLineOrOnePerLine); IO.mapOptional("ConstructorInitializerIndentWidth", Style.ConstructorInitializerIndentWidth); + IO.mapOptional("ContinuationIndentWidth", Style.ContinuationIndentWidth); + IO.mapOptional("Cpp11BracedListStyle", Style.Cpp11BracedListStyle); IO.mapOptional("DerivePointerAlignment", Style.DerivePointerAlignment); + IO.mapOptional("DisableFormat", Style.DisableFormat); IO.mapOptional("ExperimentalAutoDetectBinPacking", Style.ExperimentalAutoDetectBinPacking); + IO.mapOptional("ForEachMacros", Style.ForEachMacros); IO.mapOptional("IndentCaseLabels", Style.IndentCaseLabels); - IO.mapOptional("IndentWrappedFunctionNames", - Style.IndentWrappedFunctionNames); IO.mapOptional("IndentFunctionDeclarationAfterType", Style.IndentWrappedFunctionNames); - IO.mapOptional("MaxEmptyLinesToKeep", Style.MaxEmptyLinesToKeep); + IO.mapOptional("IndentWidth", Style.IndentWidth); + IO.mapOptional("IndentWrappedFunctionNames", + Style.IndentWrappedFunctionNames); IO.mapOptional("KeepEmptyLinesAtTheStartOfBlocks", Style.KeepEmptyLinesAtTheStartOfBlocks); + IO.mapOptional("MaxEmptyLinesToKeep", Style.MaxEmptyLinesToKeep); IO.mapOptional("NamespaceIndentation", Style.NamespaceIndentation); IO.mapOptional("ObjCBlockIndentWidth", Style.ObjCBlockIndentWidth); IO.mapOptional("ObjCSpaceAfterProperty", Style.ObjCSpaceAfterProperty); @@ -226,45 +233,38 @@ IO.mapOptional("PenaltyBreakBeforeFirstCallParameter", Style.PenaltyBreakBeforeFirstCallParameter); IO.mapOptional("PenaltyBreakComment", Style.PenaltyBreakComment); - IO.mapOptional("PenaltyBreakString", Style.PenaltyBreakString); IO.mapOptional("PenaltyBreakFirstLessLess", Style.PenaltyBreakFirstLessLess); + IO.mapOptional("PenaltyBreakString", Style.PenaltyBreakString); IO.mapOptional("PenaltyExcessCharacter", Style.PenaltyExcessCharacter); IO.mapOptional("PenaltyReturnTypeOnItsOwnLine", Style.PenaltyReturnTypeOnItsOwnLine); IO.mapOptional("PointerAlignment", Style.PointerAlignment); + IO.mapOptional("SpaceAfterCStyleCast", Style.SpaceAfterCStyleCast); + IO.mapOptional("SpaceBeforeAssignmentOperators", + Style.SpaceBeforeAssignmentOperators); + IO.mapOptional("SpaceBeforeParens", Style.SpaceBeforeParens); + IO.mapOptional("SpaceInEmptyParentheses", Style.SpaceInEmptyParentheses); IO.mapOptional("SpacesBeforeTrailingComments", Style.SpacesBeforeTrailingComments); - IO.mapOptional("Cpp11BracedListStyle", Style.Cpp11BracedListStyle); - IO.mapOptional("Standard", Style.Standard); - IO.mapOptional("IndentWidth", Style.IndentWidth); - IO.mapOptional("TabWidth", Style.TabWidth); - IO.mapOptional("UseTab", Style.UseTab); - IO.mapOptional("BreakBeforeBraces", Style.BreakBeforeBraces); - IO.mapOptional("SpacesInParentheses", Style.SpacesInParentheses); - IO.mapOptional("SpacesInSquareBrackets", Style.SpacesInSquareBrackets); IO.mapOptional("SpacesInAngles", Style.SpacesInAngles); - IO.mapOptional("SpaceInEmptyParentheses", Style.SpaceInEmptyParentheses); - IO.mapOptional("SpacesInCStyleCastParentheses", - Style.SpacesInCStyleCastParentheses); - IO.mapOptional("SpaceAfterCStyleCast", Style.SpaceAfterCStyleCast); IO.mapOptional("SpacesInContainerLiterals", Style.SpacesInContainerLiterals); - IO.mapOptional("SpaceBeforeAssignmentOperators", - Style.SpaceBeforeAssignmentOperators); - IO.mapOptional("ContinuationIndentWidth", Style.ContinuationIndentWidth); - IO.mapOptional("CommentPragmas", Style.CommentPragmas); - IO.mapOptional("ForEachMacros", Style.ForEachMacros); + IO.mapOptional("SpacesInCStyleCastParentheses", + Style.SpacesInCStyleCastParentheses); + IO.mapOptional("SpacesInParentheses", Style.SpacesInParentheses); + IO.mapOptional("SpacesInSquareBrackets", Style.SpacesInSquareBrackets); + IO.mapOptional("Standard", Style.Standard); + IO.mapOptional("TabWidth", Style.TabWidth); + IO.mapOptional("UseTab", Style.UseTab); // For backward compatibility. if (!IO.outputting()) { + IO.mapOptional("DerivePointerBinding", Style.DerivePointerAlignment); + IO.mapOptional("PointerBindsToType", Style.PointerAlignment); IO.mapOptional("SpaceAfterControlStatementKeyword", Style.SpaceBeforeParens); - IO.mapOptional("PointerBindsToType", Style.PointerAlignment); - IO.mapOptional("DerivePointerBinding", Style.DerivePointerAlignment); } - IO.mapOptional("SpaceBeforeParens", Style.SpaceBeforeParens); - IO.mapOptional("DisableFormat", Style.DisableFormat); } };