Skip to content

Commit e0462c5

Browse files
committed
Address review comments
1 parent f60d9f6 commit e0462c5

File tree

4 files changed

+26
-37
lines changed

4 files changed

+26
-37
lines changed

clang/docs/ClangFormatStyleOptions.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,8 @@ the configuration (without a prefix: ``Auto``).
392392
a &= 2;
393393
bbb = 2;
394394

395-
* ``bool AlignFunctionPointers`` Only for ``AlignConsecutiveDeclarations``. Whether function pointers
396-
are aligned.
395+
* ``bool AlignFunctionPointers`` Only for ``AlignConsecutiveDeclarations``. Whether function pointers are
396+
aligned.
397397

398398
.. code-block:: c++
399399

@@ -534,8 +534,8 @@ the configuration (without a prefix: ``Auto``).
534534
a &= 2;
535535
bbb = 2;
536536

537-
* ``bool AlignFunctionPointers`` Only for ``AlignConsecutiveDeclarations``. Whether function pointers
538-
are aligned.
537+
* ``bool AlignFunctionPointers`` Only for ``AlignConsecutiveDeclarations``. Whether function pointers are
538+
aligned.
539539

540540
.. code-block:: c++
541541

@@ -676,8 +676,8 @@ the configuration (without a prefix: ``Auto``).
676676
a &= 2;
677677
bbb = 2;
678678

679-
* ``bool AlignFunctionPointers`` Only for ``AlignConsecutiveDeclarations``. Whether function pointers
680-
are aligned.
679+
* ``bool AlignFunctionPointers`` Only for ``AlignConsecutiveDeclarations``. Whether function pointers are
680+
aligned.
681681

682682
.. code-block:: c++
683683

@@ -819,8 +819,8 @@ the configuration (without a prefix: ``Auto``).
819819
a &= 2;
820820
bbb = 2;
821821

822-
* ``bool AlignFunctionPointers`` Only for ``AlignConsecutiveDeclarations``. Whether function pointers
823-
are aligned.
822+
* ``bool AlignFunctionPointers`` Only for ``AlignConsecutiveDeclarations``. Whether function pointers are
823+
aligned.
824824

825825
.. code-block:: c++
826826

clang/include/clang/Format/Format.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ struct FormatStyle {
225225
/// bbb = 2;
226226
/// \endcode
227227
bool AlignCompound;
228-
/// Only for ``AlignConsecutiveDeclarations``. Whether function pointers
229-
/// are aligned.
228+
/// Only for ``AlignConsecutiveDeclarations``. Whether function pointers are
229+
/// aligned.
230230
/// \code
231231
/// true:
232232
/// unsigned i;

clang/lib/Format/Format.cpp

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -76,50 +76,39 @@ template <> struct MappingTraits<FormatStyle::AlignConsecutiveStyle> {
7676
FormatStyle::AlignConsecutiveStyle(
7777
{/*Enabled=*/false, /*AcrossEmptyLines=*/false,
7878
/*AcrossComments=*/false, /*AlignCompound=*/false,
79-
/*AlignFunctionPointers=*/false,
80-
/*PadOperators=*/true}));
79+
/*AlignFunctionPointers=*/false, /*PadOperators=*/true}));
8180
IO.enumCase(Value, "Consecutive",
8281
FormatStyle::AlignConsecutiveStyle(
8382
{/*Enabled=*/true, /*AcrossEmptyLines=*/false,
8483
/*AcrossComments=*/false, /*AlignCompound=*/false,
85-
/*AlignFunctionPointers=*/false,
86-
/*PadOperators=*/true}));
84+
/*AlignFunctionPointers=*/false, /*PadOperators=*/true}));
8785
IO.enumCase(Value, "AcrossEmptyLines",
8886
FormatStyle::AlignConsecutiveStyle(
8987
{/*Enabled=*/true, /*AcrossEmptyLines=*/true,
9088
/*AcrossComments=*/false, /*AlignCompound=*/false,
91-
/*AlignFunctionPointers=*/false,
92-
/*PadOperators=*/true}));
93-
IO.enumCase(
94-
Value, "AcrossComments",
95-
FormatStyle::AlignConsecutiveStyle({/*Enabled=*/true,
96-
/*AcrossEmptyLines=*/false,
97-
/*AcrossComments=*/true,
98-
/*AlignCompound=*/false,
99-
/*AlignFunctionPointers=*/false,
100-
/*PadOperators=*/true}));
101-
IO.enumCase(
102-
Value, "AcrossEmptyLinesAndComments",
103-
FormatStyle::AlignConsecutiveStyle({/*Enabled=*/true,
104-
/*AcrossEmptyLines=*/true,
105-
/*AcrossComments=*/true,
106-
/*AlignCompound=*/false,
107-
/*AlignFunctionPointers=*/false,
108-
/*PadOperators=*/true}));
89+
/*AlignFunctionPointers=*/false, /*PadOperators=*/true}));
90+
IO.enumCase(Value, "AcrossComments",
91+
FormatStyle::AlignConsecutiveStyle(
92+
{/*Enabled=*/true, /*AcrossEmptyLines=*/false,
93+
/*AcrossComments=*/true, /*AlignCompound=*/false,
94+
/*AlignFunctionPointers=*/false, /*PadOperators=*/true}));
95+
IO.enumCase(Value, "AcrossEmptyLinesAndComments",
96+
FormatStyle::AlignConsecutiveStyle(
97+
{/*Enabled=*/true, /*AcrossEmptyLines=*/true,
98+
/*AcrossComments=*/true, /*AlignCompound=*/false,
99+
/*AlignFunctionPointers=*/false, /*PadOperators=*/true}));
109100

110101
// For backward compatibility.
111102
IO.enumCase(Value, "true",
112103
FormatStyle::AlignConsecutiveStyle(
113104
{/*Enabled=*/true, /*AcrossEmptyLines=*/false,
114105
/*AcrossComments=*/false, /*AlignCompound=*/false,
115-
/*AlignFunctionPointers=*/false,
116-
/*PadOperators=*/true}));
106+
/*AlignFunctionPointers=*/false, /*PadOperators=*/true}));
117107
IO.enumCase(Value, "false",
118108
FormatStyle::AlignConsecutiveStyle(
119109
{/*Enabled=*/false, /*AcrossEmptyLines=*/false,
120110
/*AcrossComments=*/false, /*AlignCompound=*/false,
121-
/*AlignFunctionPointers=*/false,
122-
/*PadOperators=*/true}));
111+
/*AlignFunctionPointers=*/false, /*PadOperators=*/true}));
123112
}
124113

125114
static void mapping(IO &IO, FormatStyle::AlignConsecutiveStyle &Value) {

clang/lib/Format/WhitespaceManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,7 @@ void WhitespaceManager::alignConsecutiveDeclarations() {
980980
Style,
981981
[&](Change const &C) {
982982
if (Style.AlignConsecutiveDeclarations.AlignFunctionPointers) {
983-
for (FormatToken *Prev = C.Tok->Previous; Prev; Prev = Prev->Previous)
983+
for (const auto *Prev = C.Tok->Previous; Prev; Prev = Prev->Previous)
984984
if (Prev->is(tok::equal))
985985
return false;
986986
if (C.Tok->is(TT_FunctionTypeLParen))

0 commit comments

Comments
 (0)