[PATCH] D120398: [format] follow up: Use unsigned char as the base of all enums in FormatStyle

Konrad Wilhelm Kleine via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 23 02:22:22 PST 2022


kwk created this revision.
kwk requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Analogous to https://reviews.llvm.org/D93758, this patch uses
`unsigned char` for all enums in `FormatStyle`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D120398

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
@@ -105,7 +105,7 @@
   BracketAlignmentStyle AlignAfterOpenBracket;
 
   /// Different style for aligning array initializers.
-  enum ArrayInitializerAlignmentStyle {
+  enum ArrayInitializerAlignmentStyle : unsigned char {
     /// 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 : unsigned char {
     ACS_None,
     ACS_Consecutive,
     ACS_AcrossEmptyLines,
@@ -1771,7 +1771,7 @@
   BraceWrappingFlags BraceWrapping;
 
   /// Different ways to break before concept declarations.
-  enum BreakBeforeConceptDeclarationsStyle {
+  enum BreakBeforeConceptDeclarationsStyle : unsigned char {
     /// Keep the template declaration line together with ``concept``.
     /// \code
     ///   template <typename T> concept C = ...;
@@ -1882,7 +1882,7 @@
   std::string CommentPragmas;
 
   /// Different specifiers and qualifiers alignment styles.
-  enum QualifierAlignmentStyle {
+  enum QualifierAlignmentStyle : unsigned char {
     /// Don't change specifiers/qualifiers to either Left or Right alignment
     /// (default).
     /// \code
@@ -3067,7 +3067,7 @@
   std::vector<RawStringFormat> RawStringFormats;
 
   /// \brief The ``&`` and ``&&`` alignment style.
-  enum ReferenceAlignmentStyle {
+  enum ReferenceAlignmentStyle : unsigned char {
     /// 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 : unsigned char {
     /// 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 : unsigned char {
     /// Leave definition blocks as they are.
     SDS_Leave,
     /// Insert an empty line between definition blocks.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120398.410751.patch
Type: text/x-patch
Size: 2595 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220223/18760296/attachment-0001.bin>


More information about the cfe-commits mailing list