From 063bd3b886b2e9baf35de5655807d150dd727038 Mon Sep 17 00:00:00 2001 From: Konrad Kleine Date: Mon, 21 Mar 2022 21:16:35 +0000 Subject: [PATCH] [format] Use int8_t as the underlying type of all enums in FormatStyle It was requested here (https://reviews.llvm.org/D120398#3353053) to make the underlying type of all enums in `FormatStyle` an `int8_t`. Originally the type was changed in https://reviews.llvm.org/D93758. Reviewed By: HazardyKnusperkeks, curdeius, owenpan Differential Revision: https://reviews.llvm.org/D120884 --- clang/include/clang/Format/Format.h | 82 ++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h index d815eb1..e1f5974 100644 --- a/clang/include/clang/Format/Format.h +++ b/clang/include/clang/Format/Format.h @@ -62,7 +62,7 @@ struct FormatStyle { 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 @@ struct FormatStyle { 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[] = @@ -296,7 +296,7 @@ struct FormatStyle { 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 +331,7 @@ struct FormatStyle { 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 +434,7 @@ struct FormatStyle { /// 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 +481,7 @@ struct FormatStyle { /// 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 +533,7 @@ struct FormatStyle { 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 +605,7 @@ struct FormatStyle { /// 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 +644,7 @@ struct FormatStyle { /// 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 +656,7 @@ struct FormatStyle { /// 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 +750,7 @@ struct FormatStyle { 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 +828,7 @@ struct FormatStyle { 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 +874,7 @@ struct FormatStyle { /// 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 +884,7 @@ struct FormatStyle { }; /// 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 +928,7 @@ struct FormatStyle { 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 +1363,7 @@ struct FormatStyle { 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 +1641,7 @@ struct FormatStyle { 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 +1680,7 @@ struct FormatStyle { 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 +1752,7 @@ struct FormatStyle { 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 +1820,7 @@ struct FormatStyle { 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 +1947,7 @@ struct FormatStyle { /// 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 +1996,7 @@ struct FormatStyle { 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 +2072,7 @@ struct FormatStyle { 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 +2317,7 @@ struct FormatStyle { 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 +2352,7 @@ struct FormatStyle { PPDirectiveIndentStyle IndentPPDirectives; /// Indents extern blocks - enum IndentExternBlockStyle : unsigned char { + enum IndentExternBlockStyle : int8_t { /// Backwards compatible with AfterExternBlock's indenting. /// \code /// IndentExternBlock: AfterExternBlock @@ -2509,7 +2509,7 @@ struct FormatStyle { /// 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 +2567,7 @@ struct FormatStyle { /// 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 +2601,7 @@ struct FormatStyle { 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 +2681,7 @@ struct FormatStyle { 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 +2839,7 @@ struct FormatStyle { unsigned PenaltyIndentedWhitespace; /// The ``&``, ``&&`` and ``*`` alignment style. - enum PointerAlignmentStyle : unsigned char { + enum PointerAlignmentStyle : int8_t { /// Align pointer to the left. /// \code /// int* a; @@ -2937,7 +2937,7 @@ struct FormatStyle { 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 +3036,7 @@ struct FormatStyle { /// \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 +3115,7 @@ struct FormatStyle { 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 +3195,7 @@ struct FormatStyle { unsigned ShortNamespaceLines; /// Include sorting options. - enum SortIncludesOptions : unsigned char { + enum SortIncludesOptions : int8_t { /// Includes are never sorted. /// \code /// #include "B/A.h" @@ -3235,7 +3235,7 @@ struct FormatStyle { 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 +3300,7 @@ struct FormatStyle { 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 +3381,7 @@ struct FormatStyle { 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 +3612,7 @@ struct FormatStyle { /// 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 +3731,7 @@ struct FormatStyle { 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 +3767,7 @@ struct FormatStyle { /// /// 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 +3816,7 @@ struct FormatStyle { 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. -- 2.7.4