diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h --- a/clang/include/clang/Format/Format.h +++ b/clang/include/clang/Format/Format.h @@ -62,7 +62,7 @@ int AccessModifierOffset; /// Different styles for aligning after open brackets. - enum BracketAlignmentStyle : unsigned char { + enum BracketAlignmentStyle : int8_t { /// Align parameters on the open bracket, e.g.: /// \code /// someLongFunction(argument1, @@ -105,7 +105,7 @@ BracketAlignmentStyle AlignAfterOpenBracket; /// Different style for aligning array initializers. - enum ArrayInitializerAlignmentStyle { + enum ArrayInitializerAlignmentStyle : int8_t { /// Align array column and left justify the columns e.g.: /// \code /// struct test demo[] = @@ -138,6 +138,7 @@ /// \version 13 ArrayInitializerAlignmentStyle AlignArrayOfStructures; +<<<<<<< HEAD /// Alignment options. /// /// They can also be read as a whole for compatibility. The choices are: @@ -248,6 +249,20 @@ bool operator!=(const AlignConsecutiveStyle &R) const { return !(*this == R); } +======= + /// Styles for alignment of consecutive tokens. Tokens can be assignment signs + /// (see + /// ``AlignConsecutiveAssignments``), bitfield member separators (see + /// ``AlignConsecutiveBitFields``), names in declarations (see + /// ``AlignConsecutiveDeclarations``) or macro definitions (see + /// ``AlignConsecutiveMacros``). + enum AlignConsecutiveStyle : int8_t { + ACS_None, + ACS_Consecutive, + ACS_AcrossEmptyLines, + ACS_AcrossComments, + ACS_AcrossEmptyLinesAndComments +>>>>>>> 60c77906316c ([format] Use int8_t as the underlying type of all enums in FormatStyle) }; /// Style of aligning consecutive macro definitions. @@ -296,7 +311,7 @@ AlignConsecutiveStyle AlignConsecutiveDeclarations; /// Different styles for aligning escaped newlines. - enum EscapedNewlineAlignmentStyle : unsigned char { + enum EscapedNewlineAlignmentStyle : int8_t { /// Don't align escaped newlines. /// \code /// #define A \ @@ -331,7 +346,7 @@ EscapedNewlineAlignmentStyle AlignEscapedNewlines; /// Different styles for aligning operands. - enum OperandAlignmentStyle : unsigned char { + enum OperandAlignmentStyle : int8_t { /// Do not align operands of binary and ternary expressions. /// The wrapped lines are indented ``ContinuationIndentWidth`` spaces from /// the start of the line. @@ -434,7 +449,7 @@ /// Different styles for merging short blocks containing at most one /// statement. - enum ShortBlockStyle : unsigned char { + enum ShortBlockStyle : int8_t { /// Never merge blocks into a single line. /// \code /// while (true) { @@ -481,7 +496,7 @@ /// Different styles for merging short functions containing at most one /// statement. - enum ShortFunctionStyle : unsigned char { + enum ShortFunctionStyle : int8_t { /// Never merge functions into a single line. SFS_None, /// Only merge functions defined inside a class. Same as "inline", @@ -533,7 +548,7 @@ ShortFunctionStyle AllowShortFunctionsOnASingleLine; /// Different styles for handling short if statements. - enum ShortIfStyle : unsigned char { + enum ShortIfStyle : int8_t { /// Never put short ifs on the same line. /// \code /// if (a) @@ -605,7 +620,7 @@ /// Different styles for merging short lambdas containing at most one /// statement. - enum ShortLambdaStyle : unsigned char { + enum ShortLambdaStyle : int8_t { /// Never merge lambdas into a single line. SLS_None, /// Only merge empty lambdas. @@ -644,7 +659,7 @@ /// Different ways to break after the function definition return type. /// This option is **deprecated** and is retained for backwards compatibility. - enum DefinitionReturnTypeBreakingStyle : unsigned char { + enum DefinitionReturnTypeBreakingStyle : int8_t { /// Break after return type automatically. /// ``PenaltyReturnTypeOnItsOwnLine`` is taken into account. DRTBS_None, @@ -656,7 +671,7 @@ /// Different ways to break after the function definition or /// declaration return type. - enum ReturnTypeBreakingStyle : unsigned char { + enum ReturnTypeBreakingStyle : int8_t { /// Break after return type automatically. /// ``PenaltyReturnTypeOnItsOwnLine`` is taken into account. /// \code @@ -750,7 +765,7 @@ bool AlwaysBreakBeforeMultilineStrings; /// Different ways to break after the template declaration. - enum BreakTemplateDeclarationsStyle : unsigned char { + enum BreakTemplateDeclarationsStyle : int8_t { /// Do not force break before declaration. /// ``PenaltyBreakTemplateDeclaration`` is taken into account. /// \code @@ -828,7 +843,7 @@ bool BinPackArguments; /// The style of inserting trailing commas into container literals. - enum TrailingCommaStyle : unsigned char { + enum TrailingCommaStyle : int8_t { /// Do not insert trailing commas. TCS_None, /// Insert trailing commas in container literals that were wrapped over @@ -874,7 +889,7 @@ /// The style of wrapping parameters on the same line (bin-packed) or /// on one line each. - enum BinPackStyle : unsigned char { + enum BinPackStyle : int8_t { /// Automatically determine parameter bin-packing behavior. BPS_Auto, /// Always bin-pack parameters. @@ -884,7 +899,7 @@ }; /// The style of breaking before or after binary operators. - enum BinaryOperatorStyle : unsigned char { + enum BinaryOperatorStyle : int8_t { /// Break after operators. /// \code /// LooooooooooongType loooooooooooooooooooooongVariable = @@ -928,7 +943,7 @@ BinaryOperatorStyle BreakBeforeBinaryOperators; /// Different ways to attach braces to their surrounding context. - enum BraceBreakingStyle : unsigned char { + enum BraceBreakingStyle : int8_t { /// Always attach braces to surrounding context. /// \code /// namespace N { @@ -1363,7 +1378,7 @@ BraceBreakingStyle BreakBeforeBraces; /// Different ways to wrap braces after control statements. - enum BraceWrappingAfterControlStatementStyle : unsigned char { + enum BraceWrappingAfterControlStatementStyle : int8_t { /// Never wrap braces after a control statement. /// \code /// if (foo()) { @@ -1641,7 +1656,7 @@ BraceWrappingFlags BraceWrapping; /// Different ways to break before concept declarations. - enum BreakBeforeConceptDeclarationsStyle { + enum BreakBeforeConceptDeclarationsStyle : int8_t { /// Keep the template declaration line together with ``concept``. /// \code /// template concept C = ...; @@ -1680,7 +1695,7 @@ bool BreakBeforeTernaryOperators; /// Different ways to break initializers. - enum BreakConstructorInitializersStyle : unsigned char { + enum BreakConstructorInitializersStyle : int8_t { /// Break constructor initializers before the colon and after the commas. /// \code /// Constructor() @@ -1752,7 +1767,7 @@ std::string CommentPragmas; /// Different specifiers and qualifiers alignment styles. - enum QualifierAlignmentStyle { + enum QualifierAlignmentStyle : int8_t { /// Don't change specifiers/qualifiers to either Left or Right alignment /// (default). /// \code @@ -1820,7 +1835,7 @@ std::vector QualifierOrder; /// Different ways to break inheritance list. - enum BreakInheritanceListStyle : unsigned char { + enum BreakInheritanceListStyle : int8_t { /// Break inheritance list before the colon and after the commas. /// \code /// class Foo @@ -1947,7 +1962,7 @@ /// Different styles for empty line after access modifiers. /// ``EmptyLineBeforeAccessModifier`` configuration handles the number of /// empty lines between two access modifiers. - enum EmptyLineAfterAccessModifierStyle : unsigned char { + enum EmptyLineAfterAccessModifierStyle : int8_t { /// Remove all empty lines after access modifiers. /// \code /// struct foo { @@ -1996,7 +2011,7 @@ EmptyLineAfterAccessModifierStyle EmptyLineAfterAccessModifier; /// Different styles for empty line before access modifiers. - enum EmptyLineBeforeAccessModifierStyle : unsigned char { + enum EmptyLineBeforeAccessModifierStyle : int8_t { /// Remove all empty lines before access modifiers. /// \code /// struct foo { @@ -2072,7 +2087,7 @@ bool ExperimentalAutoDetectBinPacking; /// Different ways to try to fit all constructor initializers on a line. - enum PackConstructorInitializersStyle : unsigned char { + enum PackConstructorInitializersStyle : int8_t { /// Always put each constructor initializer on its own line. /// \code /// Constructor() @@ -2317,7 +2332,7 @@ bool IndentGotoLabels; /// Options for indenting preprocessor directives. - enum PPDirectiveIndentStyle : unsigned char { + enum PPDirectiveIndentStyle : int8_t { /// Does not indent any directives. /// \code /// #if FOO @@ -2352,7 +2367,7 @@ PPDirectiveIndentStyle IndentPPDirectives; /// Indents extern blocks - enum IndentExternBlockStyle : unsigned char { + enum IndentExternBlockStyle : int8_t { /// Backwards compatible with AfterExternBlock's indenting. /// \code /// IndentExternBlock: AfterExternBlock @@ -2509,7 +2524,7 @@ /// Quotation styles for JavaScript strings. Does not affect template /// strings. - enum JavaScriptQuoteStyle : unsigned char { + enum JavaScriptQuoteStyle : int8_t { /// Leave string quotes as they are. /// \code{.js} /// string1 = "foo"; @@ -2567,7 +2582,7 @@ /// 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 : unsigned char { + enum LanguageKind : int8_t { /// Do not use. LK_None, /// Should be used for C, C++. @@ -2601,7 +2616,7 @@ LanguageKind Language; /// Indentation logic for lambda bodies. - enum LambdaBodyIndentationKind : unsigned char { + enum LambdaBodyIndentationKind : int8_t { /// Align lambda body relative to the lambda signature. This is the default. /// \code /// someMethod( @@ -2681,7 +2696,7 @@ unsigned MaxEmptyLinesToKeep; /// Different ways to indent namespace contents. - enum NamespaceIndentationKind : unsigned char { + enum NamespaceIndentationKind : int8_t { /// Don't indent in namespaces. /// \code /// namespace out { @@ -2839,7 +2854,7 @@ unsigned PenaltyIndentedWhitespace; /// The ``&``, ``&&`` and ``*`` alignment style. - enum PointerAlignmentStyle : unsigned char { + enum PointerAlignmentStyle : int8_t { /// Align pointer to the left. /// \code /// int* a; @@ -2937,7 +2952,7 @@ std::vector RawStringFormats; /// \brief The ``&`` and ``&&`` alignment style. - enum ReferenceAlignmentStyle { + enum ReferenceAlignmentStyle : int8_t { /// Align reference like ``PointerAlignment``. RAS_Pointer, /// Align reference to the left. @@ -3036,7 +3051,7 @@ /// \brief The possible positions for the requires clause. The /// ``IndentRequires`` option is only used if the ``requires`` is put on the /// start of a line. - enum RequiresClausePositionStyle { + enum RequiresClausePositionStyle : int8_t { /// Always put the ``requires`` clause on its own line. /// \code /// template @@ -3115,7 +3130,7 @@ RequiresClausePositionStyle RequiresClausePosition; /// \brief The style if definition blocks should be separated. - enum SeparateDefinitionStyle { + enum SeparateDefinitionStyle : int8_t { /// Leave definition blocks as they are. SDS_Leave, /// Insert an empty line between definition blocks. @@ -3195,7 +3210,7 @@ unsigned ShortNamespaceLines; /// Include sorting options. - enum SortIncludesOptions : unsigned char { + enum SortIncludesOptions : int8_t { /// Includes are never sorted. /// \code /// #include "B/A.h" @@ -3235,7 +3250,7 @@ SortIncludesOptions SortIncludes; /// Position for Java Static imports. - enum SortJavaStaticImportOptions : unsigned char { + enum SortJavaStaticImportOptions : int8_t { /// Static imports are placed before non-static imports. /// \code{.java} /// import static org.example.function1; @@ -3300,7 +3315,7 @@ bool SpaceAfterTemplateKeyword; /// Different ways to put a space before opening parentheses. - enum SpaceAroundPointerQualifiersStyle : unsigned char { + enum SpaceAroundPointerQualifiersStyle : int8_t { /// Don't ensure spaces around pointer qualifiers and use PointerAlignment /// instead. /// \code @@ -3381,7 +3396,7 @@ bool SpaceBeforeInheritanceColon; /// Different ways to put a space before opening parentheses. - enum SpaceBeforeParensStyle : unsigned char { + enum SpaceBeforeParensStyle : int8_t { /// Never put a space before opening parentheses. /// \code /// void f() { @@ -3612,7 +3627,7 @@ /// Styles for adding spacing after ``<`` and before ``>` /// in template argument lists. - enum SpacesInAnglesStyle : unsigned char { + enum SpacesInAnglesStyle : int8_t { /// Remove spaces after ``<`` and before ``>``. /// \code /// static_cast(arg); @@ -3731,7 +3746,7 @@ bool SpaceBeforeSquareBrackets; /// Styles for adding spacing around ``:`` in bitfield definitions. - enum BitFieldColonSpacingStyle : unsigned char { + enum BitFieldColonSpacingStyle : int8_t { /// Add one space on each side of the ``:`` /// \code /// unsigned bf : 2; @@ -3767,7 +3782,7 @@ /// /// The correct way to spell a specific language version is e.g. ``c++11``. /// The historical aliases ``Cpp03`` and ``Cpp11`` are deprecated. - enum LanguageStandard : unsigned char { + enum LanguageStandard : int8_t { /// Parse and format as C++03. /// ``Cpp03`` is a deprecated alias for ``c++03`` LS_Cpp03, // c++03 @@ -3816,7 +3831,7 @@ unsigned TabWidth; /// Different ways to use tab in formatting. - enum UseTabStyle : unsigned char { + enum UseTabStyle : int8_t { /// Never use tab. UT_Never, /// Use tabs only for indentation.