Skip to content

[clang-doc] ClangFormatStyleOptions.rst: Description for AlignConsecutiveStyle special options appear in places where they are not applicable #146019

Open
@Next-Door-Tech

Description

@Next-Door-Tech

There are a small handful of flags under struct AlignConsecutiveStyle which are only applicable to one of the seven AlignConsecutiveXYZ options; however, their descriptions appear under each instance of AlignConsecutiveStyle (6 extraneous places).

The offending flags are AlignCompound, AlignFunctionDeclarations, AlignFunctionPointers, and PadOperators.

As generated:

* ``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;

In source header:

/// Only for ``AlignConsecutiveAssignments``. Whether compound assignments
/// like ``+=`` are aligned along with ``=``.
/// \code
/// true:
/// a &= 2;
/// bbb = 2;
///
/// false:
/// a &= 2;
/// bbb = 2;
/// \endcode
bool AlignCompound;
/// Only for ``AlignConsecutiveDeclarations``. Whether function declarations
/// are aligned.
/// \code
/// true:
/// unsigned int f1(void);
/// void f2(void);
/// size_t f3(void);
///
/// false:
/// unsigned int f1(void);
/// void f2(void);
/// size_t f3(void);
/// \endcode
bool AlignFunctionDeclarations;
/// Only for ``AlignConsecutiveDeclarations``. Whether function pointers are
/// aligned.
/// \code
/// true:
/// unsigned i;
/// int &r;
/// int *p;
/// int (*f)();
///
/// false:
/// unsigned i;
/// int &r;
/// int *p;
/// int (*f)();
/// \endcode
bool AlignFunctionPointers;
/// 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
/// true:
/// a >>= 2;
/// bbb = 2;
///
/// a = 2;
/// bbb >>= 2;
///
/// false:
/// a >>= 2;
/// bbb = 2;
///
/// a = 2;
/// bbb >>= 2;
/// \endcode
bool PadOperators;

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions