[clang] [clang-format] Add AlignConsecutiveEnums (PR #194154)

via cfe-commits cfe-commits at lists.llvm.org
Sun May 3 17:07:51 PDT 2026


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Windows-->
# :window: Windows x64 Test Results

* 53713 tests passed
* 1149 tests skipped
* 4 tests failed

## Failed Tests
(click on a test name to see its output)

### Clang
<details>
<summary>Clang.Format/docs_updated.test</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
"C:\Python312\python.exe" C:\_work\llvm-project\llvm-project\clang\test\Format/../../docs/tools/dump_format_style.py -o C:\_work\llvm-project\llvm-project\build\tools\clang\test\Format\Output\docs_updated.test.tmp.style
# executed command: 'C:\Python312\python.exe' 'C:\_work\llvm-project\llvm-project\clang\test\Format/../../docs/tools/dump_format_style.py' -o 'C:\_work\llvm-project\llvm-project\build\tools\clang\test\Format\Output\docs_updated.test.tmp.style'
# note: command had no output on stdout or stderr
# RUN: at line 2
diff --strip-trailing-cr C:\_work\llvm-project\llvm-project\build\tools\clang\test\Format\Output\docs_updated.test.tmp.style    C:\_work\llvm-project\llvm-project\clang\test\Format/../../docs/ClangFormatStyleOptions.rst
# executed command: diff --strip-trailing-cr 'C:\_work\llvm-project\llvm-project\build\tools\clang\test\Format\Output\docs_updated.test.tmp.style' 'C:\_work\llvm-project\llvm-project\clang\test\Format/../../docs/ClangFormatStyleOptions.rst'
# .---command stdout------------
# | *** C:\_work\llvm-project\llvm-project\build\tools\clang\test\Format\Output\docs_updated.test.tmp.style
# | --- C:\_work\llvm-project\llvm-project\clang\test\Format/../../docs/ClangFormatStyleOptions.rst
# | ***************
# | *** 615,778 ****
# |       AlignConsecutiveDeclarations: AcrossEmptyLines
# |   
# |       AlignConsecutiveDeclarations:
# | -       Enabled: true
# | -       AcrossEmptyLines: true
# | -       AcrossComments: false
# | - 
# | -   * ``bool Enabled`` Whether aligning is enabled.
# | - 
# | -     .. code-block:: c++
# | - 
# | -       #define SHORT_NAME       42
# | -       #define LONGER_NAME      0x007f
# | -       #define EVEN_LONGER_NAME (2)
# | -       #define foo(x)           (x * x)
# | -       #define bar(y, z)        (y + z)
# | - 
# | -       int a            = 1;
# | -       int somelongname = 2;
# | -       double c         = 3;
# | - 
# | -       int aaaa : 1;
# | -       int b    : 12;
# | -       int ccc  : 8;
# | - 
# | -       int         aaaa = 12;
# | -       float       b = 23;
# | -       std::string ccc;
# | - 
# | -   * ``bool AcrossEmptyLines`` Whether to align across empty lines.
# | - 
# | -     .. code-block:: c++
# | - 
# | -       true:
# | -       int a            = 1;
# | -       int somelongname = 2;
# | -       double c         = 3;
# | - 
# | -       int d            = 3;
# | - 
# | -       false:
# | -       int a            = 1;
# | -       int somelongname = 2;
# | -       double c         = 3;
# | - 
# | -       int d = 3;
# | - 
# | -   * ``bool AcrossComments`` Whether to align across comments.
# | - 
# | -     .. code-block:: c++
# | - 
# | -       true:
# | -       int d    = 3;
# | -       /* A comment. */
# | -       double e = 4;
# | - 
# | -       false:
# | -       int d = 3;
# | -       /* A comment. */
# | -       double e = 4;
# | - 
# | -   * ``bool AlignCompound`` Only for ``AlignConsecutiveAssignments``.  Whether compound assignments
# | -     like ``+=`` are aligned along with ``=``.
# | - 
# | -     .. code-block:: c++
# | - 
# | -       true:
# | -       a   &= 2;
# | -       bbb  = 2;
# | - 
# | -       false:
# | -       a &= 2;
# | -       bbb = 2;
# | - 
# | -   * ``bool AlignFunctionDeclarations`` Only for ``AlignConsecutiveDeclarations``. Whether function declarations
# | -     are aligned.
# | - 
# | -     .. code-block:: c++
# | - 
# | -       true:
# | -       unsigned int f1(void);
# | -       void         f2(void);
# | -       size_t       f3(void);
# | - 
# | -       false:
# | -       unsigned int f1(void);
# | -       void f2(void);
# | -       size_t f3(void);
# | - 
# | -   * ``bool AlignFunctionPointers`` Only for ``AlignConsecutiveDeclarations``. Whether function pointers are
# | -     aligned.
# | - 
# | -     .. code-block:: c++
# | - 
# | -       true:
# | -       unsigned i;
# | -       int     &r;
# | -       int     *p;
# | -       int      (*f)();
# | - 
# | -       false:
# | -       unsigned i;
# | -       int     &r;
# | -       int     *p;
# | -       int (*f)();
# | - 
# | -   * ``bool PadOperators`` Only for ``AlignConsecutiveAssignments``.  Whether short assignment
# | -     operators are left-padded to the same length as long ones in order to
# | -     put all assignment operators to the right of the left hand side.
# | - 
# | -     .. code-block:: c++
# | - 
# | -       true:
# | -       a   >>= 2;
# | -       bbb   = 2;
# | - 
# | -       a     = 2;
# | -       bbb >>= 2;
# | - 
# | -       false:
# | -       a >>= 2;
# | -       bbb = 2;
# | - 
# | -       a     = 2;
# | -       bbb >>= 2;
# | - 
# | - 
# | - .. _AlignConsecutiveEnums:
# | - 
# | - **AlignConsecutiveEnums** (``AlignConsecutiveStyle``) :versionbadge:`clang-format 23` :ref:`¶ <AlignConsecutiveEnums>`
# | -   Style of aligning consecutive enum assignments.
# | - 
# | -   ``Consecutive`` will align the enum assignments of consecutive lines.
# | -   This will result in formattings like:
# | - 
# | -   .. code-block:: c++
# | - 
# | -     flag_aaaa = 1,
# | -     flag_b    = 12,
# | -     flag_ccc  = 8,
# | - 
# | -   Nested configuration flags:
# | - 
# | -   Alignment options.
# | - 
# | -   They can also be read as a whole for compatibility. The choices are:
# | - 
# | -   * ``None``
# | -   * ``Consecutive``
# | -   * ``AcrossEmptyLines``
# | -   * ``AcrossComments``
# | -   * ``AcrossEmptyLinesAndComments``
# | - 
# | -   For example, to align across empty lines and not across comments, either
# | -   of these work.
# | - 
# | -   .. code-block:: c++
# | - 
# | -     AlignConsecutiveEnums: AcrossEmptyLines
# | - 
# | -     AlignConsecutiveEnums:
# |         Enabled: true
# |         AcrossEmptyLines: true
# |         AcrossComments: false
# | --- 615,620 ----
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>

### Clang-Unit
<details>
<summary>Clang-Unit.Format/_/FormatTests_exe/FormatTestJS/CppKeywords</summary>

```
Script:
--
C:\_work\llvm-project\llvm-project\build\tools\clang\unittests\Format\.\FormatTests.exe --gtest_filter=FormatTestJS.CppKeywords
--
unknown file
SEH exception with code 0x3221225501 thrown in the test body.
Stack trace:



```
</details>
<details>
<summary>Clang-Unit.Format/_/FormatTests_exe/FormatTestJS/EnumDeclarations</summary>

```
Script:
--
C:\_work\llvm-project\llvm-project\build\tools\clang\unittests\Format\.\FormatTests.exe --gtest_filter=FormatTestJS.EnumDeclarations
--
unknown file
SEH exception with code 0x3221225501 thrown in the test body.
Stack trace:



```
</details>
<details>
<summary>Clang-Unit.Format/_/FormatTests_exe/FormatTestJS/Modules</summary>

```
Script:
--
C:\_work\llvm-project\llvm-project\build\tools\clang\unittests\Format\.\FormatTests.exe --gtest_filter=FormatTestJS.Modules
--
unknown file
SEH exception with code 0x3221225501 thrown in the test body.
Stack trace:



```
</details>

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.

https://github.com/llvm/llvm-project/pull/194154


More information about the cfe-commits mailing list