kwk created this revision.
kwk added reviewers: HazardyKnusperkeks, MyDeveloperDay, curdeius.
Herald added a project: All.
kwk requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D120884

Files:
  clang/include/clang/Format/Format.h

Index: clang/include/clang/Format/Format.h
===================================================================
--- clang/include/clang/Format/Format.h
+++ 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[] =
@@ -140,7 +140,7 @@
   /// ``AlignConsecutiveBitFields``), names in declarations (see
   /// ``AlignConsecutiveDeclarations``) or macro definitions (see
   /// ``AlignConsecutiveMacros``).
-  enum AlignConsecutiveStyle {
+  enum AlignConsecutiveStyle : int8_t {
     ACS_None,
     ACS_Consecutive,
     ACS_AcrossEmptyLines,
@@ -429,7 +429,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 \
@@ -464,7 +464,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.
@@ -567,7 +567,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) {
@@ -614,7 +614,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",
@@ -666,7 +666,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)
@@ -738,7 +738,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.
@@ -777,7 +777,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,
@@ -789,7 +789,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
@@ -883,7 +883,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
@@ -961,7 +961,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
@@ -1007,7 +1007,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.
@@ -1017,7 +1017,7 @@
   };
 
   /// The style of breaking before or after binary operators.
-  enum BinaryOperatorStyle : unsigned char {
+  enum BinaryOperatorStyle : int8_t {
     /// Break after operators.
     /// \code
     ///    LooooooooooongType loooooooooooooooooooooongVariable =
@@ -1061,7 +1061,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 {
@@ -1496,7 +1496,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()) {
@@ -1771,7 +1771,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 <typename T> concept C = ...;
@@ -1810,7 +1810,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()
@@ -1882,7 +1882,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
@@ -1950,7 +1950,7 @@
   std::vector<std::string> 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
@@ -2077,7 +2077,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 {
@@ -2126,7 +2126,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 {
@@ -2202,7 +2202,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()
@@ -2447,7 +2447,7 @@
   bool IndentGotoLabels;
 
   /// Options for indenting preprocessor directives.
-  enum PPDirectiveIndentStyle : unsigned char {
+  enum PPDirectiveIndentStyle : int8_t {
     /// Does not indent any directives.
     /// \code
     ///    #if FOO
@@ -2482,7 +2482,7 @@
   PPDirectiveIndentStyle IndentPPDirectives;
 
   /// Indents extern blocks
-  enum IndentExternBlockStyle : unsigned char {
+  enum IndentExternBlockStyle : int8_t {
     /// Backwards compatible with AfterExternBlock's indenting.
     /// \code
     ///    IndentExternBlock: AfterExternBlock
@@ -2639,7 +2639,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";
@@ -2697,7 +2697,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++.
@@ -2731,7 +2731,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(
@@ -2811,7 +2811,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 {
@@ -2969,7 +2969,7 @@
   unsigned PenaltyIndentedWhitespace;
 
   /// The ``&``, ``&&`` and ``*`` alignment style.
-  enum PointerAlignmentStyle : unsigned char {
+  enum PointerAlignmentStyle : int8_t {
     /// Align pointer to the left.
     /// \code
     ///   int* a;
@@ -3067,7 +3067,7 @@
   std::vector<RawStringFormat> RawStringFormats;
 
   /// \brief The ``&`` and ``&&`` alignment style.
-  enum ReferenceAlignmentStyle {
+  enum ReferenceAlignmentStyle : int8_t {
     /// Align reference like ``PointerAlignment``.
     RAS_Pointer,
     /// Align reference to the left.
@@ -3166,7 +3166,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 <typename T>
@@ -3245,7 +3245,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.
@@ -3325,7 +3325,7 @@
   unsigned ShortNamespaceLines;
 
   /// Include sorting options.
-  enum SortIncludesOptions : unsigned char {
+  enum SortIncludesOptions : int8_t {
     /// Includes are never sorted.
     /// \code
     ///    #include "B/A.h"
@@ -3365,7 +3365,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;
@@ -3430,7 +3430,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
@@ -3511,7 +3511,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() {
@@ -3742,7 +3742,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<int>(arg);
@@ -3861,7 +3861,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;
@@ -3897,7 +3897,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
@@ -3946,7 +3946,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.
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to