Skip to content

Commit 87ad34f

Browse files
committed
Revert "[clang-format] Add AlignConsecutiveShortCaseStatements"
This reverts commit 4ba0084.
1 parent 1a3da0b commit 87ad34f

File tree

8 files changed

+19
-569
lines changed

8 files changed

+19
-569
lines changed

clang/docs/ClangFormatStyleOptions.rst

Lines changed: 0 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -789,104 +789,6 @@ the configuration (without a prefix: ``Auto``).
789789
bbb >>= 2;
790790

791791

792-
.. _AlignConsecutiveShortCaseStatements:
793-
794-
**AlignConsecutiveShortCaseStatements** (``ShortCaseStatementsAlignmentStyle``) :versionbadge:`clang-format 17` :ref:`<AlignConsecutiveShortCaseStatements>`
795-
Style of aligning consecutive short case labels.
796-
Only applies if ``AllowShortCaseLabelsOnASingleLine`` is ``true``.
797-
798-
799-
.. code-block:: yaml
800-
801-
# Example of usage:
802-
AlignConsecutiveShortCaseStatements:
803-
Enabled: true
804-
AcrossEmptyLines: true
805-
AcrossComments: true
806-
AlignCaseColons: false
807-
808-
Nested configuration flags:
809-
810-
Alignment options.
811-
812-
* ``bool Enabled`` Whether aligning is enabled.
813-
814-
.. code-block:: c++
815-
816-
true:
817-
switch (level) {
818-
case log::info: return "info:";
819-
case log::warning: return "warning:";
820-
default: return "";
821-
}
822-
823-
false:
824-
switch (level) {
825-
case log::info: return "info:";
826-
case log::warning: return "warning:";
827-
default: return "";
828-
}
829-
830-
* ``bool AcrossEmptyLines`` Whether to align across empty lines.
831-
832-
.. code-block:: c++
833-
834-
true:
835-
switch (level) {
836-
case log::info: return "info:";
837-
case log::warning: return "warning:";
838-
839-
default: return "";
840-
}
841-
842-
false:
843-
switch (level) {
844-
case log::info: return "info:";
845-
case log::warning: return "warning:";
846-
847-
default: return "";
848-
}
849-
850-
* ``bool AcrossComments`` Whether to align across comments.
851-
852-
.. code-block:: c++
853-
854-
true:
855-
switch (level) {
856-
case log::info: return "info:";
857-
case log::warning: return "warning:";
858-
/* A comment. */
859-
default: return "";
860-
}
861-
862-
false:
863-
switch (level) {
864-
case log::info: return "info:";
865-
case log::warning: return "warning:";
866-
/* A comment. */
867-
default: return "";
868-
}
869-
870-
* ``bool AlignCaseColons`` Whether aligned case labels are aligned on the colon, or on the
871-
, or on the tokens after the colon.
872-
873-
.. code-block:: c++
874-
875-
true:
876-
switch (level) {
877-
case log::info : return "info:";
878-
case log::warning: return "warning:";
879-
default : return "";
880-
}
881-
882-
false:
883-
switch (level) {
884-
case log::info: return "info:";
885-
case log::warning: return "warning:";
886-
default: return "";
887-
}
888-
889-
890792
.. _AlignEscapedNewlines:
891793

892794
**AlignEscapedNewlines** (``EscapedNewlineAlignmentStyle``) :versionbadge:`clang-format 5` :ref:`<AlignEscapedNewlines>`

clang/docs/ReleaseNotes.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -988,8 +988,6 @@ clang-format
988988
- Add ``KeepEmptyLinesAtEOF`` to keep empty lines at end of file.
989989
- Add ``RemoveParentheses`` to remove redundant parentheses.
990990
- Add ``TypeNames`` to treat listed non-keyword identifiers as type names.
991-
- Add ``AlignConsecutiveShortCaseStatements`` which can be used to align case
992-
labels in conjunction with ``AllowShortCaseLabelsOnASingleLine``.
993991

994992
libclang
995993
--------

clang/include/clang/Format/Format.h

Lines changed: 0 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -299,103 +299,6 @@ struct FormatStyle {
299299
/// \version 3.8
300300
AlignConsecutiveStyle AlignConsecutiveDeclarations;
301301

302-
/// Alignment options.
303-
///
304-
struct ShortCaseStatementsAlignmentStyle {
305-
/// Whether aligning is enabled.
306-
/// \code
307-
/// true:
308-
/// switch (level) {
309-
/// case log::info: return "info:";
310-
/// case log::warning: return "warning:";
311-
/// default: return "";
312-
/// }
313-
///
314-
/// false:
315-
/// switch (level) {
316-
/// case log::info: return "info:";
317-
/// case log::warning: return "warning:";
318-
/// default: return "";
319-
/// }
320-
/// \endcode
321-
bool Enabled;
322-
/// Whether to align across empty lines.
323-
/// \code
324-
/// true:
325-
/// switch (level) {
326-
/// case log::info: return "info:";
327-
/// case log::warning: return "warning:";
328-
///
329-
/// default: return "";
330-
/// }
331-
///
332-
/// false:
333-
/// switch (level) {
334-
/// case log::info: return "info:";
335-
/// case log::warning: return "warning:";
336-
///
337-
/// default: return "";
338-
/// }
339-
/// \endcode
340-
bool AcrossEmptyLines;
341-
/// Whether to align across comments.
342-
/// \code
343-
/// true:
344-
/// switch (level) {
345-
/// case log::info: return "info:";
346-
/// case log::warning: return "warning:";
347-
/// /* A comment. */
348-
/// default: return "";
349-
/// }
350-
///
351-
/// false:
352-
/// switch (level) {
353-
/// case log::info: return "info:";
354-
/// case log::warning: return "warning:";
355-
/// /* A comment. */
356-
/// default: return "";
357-
/// }
358-
/// \endcode
359-
bool AcrossComments;
360-
/// Whether aligned case labels are aligned on the colon, or on the
361-
/// , or on the tokens after the colon.
362-
/// \code
363-
/// true:
364-
/// switch (level) {
365-
/// case log::info : return "info:";
366-
/// case log::warning: return "warning:";
367-
/// default : return "";
368-
/// }
369-
///
370-
/// false:
371-
/// switch (level) {
372-
/// case log::info: return "info:";
373-
/// case log::warning: return "warning:";
374-
/// default: return "";
375-
/// }
376-
/// \endcode
377-
bool AlignCaseColons;
378-
bool operator==(const ShortCaseStatementsAlignmentStyle &R) const {
379-
return Enabled == R.Enabled && AcrossEmptyLines == R.AcrossEmptyLines &&
380-
AcrossComments == R.AcrossComments &&
381-
AlignCaseColons == R.AlignCaseColons;
382-
}
383-
};
384-
385-
/// Style of aligning consecutive short case labels.
386-
/// Only applies if ``AllowShortCaseLabelsOnASingleLine`` is ``true``.
387-
///
388-
/// \code{.yaml}
389-
/// # Example of usage:
390-
/// AlignConsecutiveShortCaseStatements:
391-
/// Enabled: true
392-
/// AcrossEmptyLines: true
393-
/// AcrossComments: true
394-
/// AlignCaseColons: false
395-
/// \endcode
396-
/// \version 17
397-
ShortCaseStatementsAlignmentStyle AlignConsecutiveShortCaseStatements;
398-
399302
/// Different styles for aligning escaped newlines.
400303
enum EscapedNewlineAlignmentStyle : int8_t {
401304
/// Don't align escaped newlines.
@@ -4454,8 +4357,6 @@ struct FormatStyle {
44544357
AlignConsecutiveBitFields == R.AlignConsecutiveBitFields &&
44554358
AlignConsecutiveDeclarations == R.AlignConsecutiveDeclarations &&
44564359
AlignConsecutiveMacros == R.AlignConsecutiveMacros &&
4457-
AlignConsecutiveShortCaseStatements ==
4458-
R.AlignConsecutiveShortCaseStatements &&
44594360
AlignEscapedNewlines == R.AlignEscapedNewlines &&
44604361
AlignOperands == R.AlignOperands &&
44614362
AlignTrailingComments == R.AlignTrailingComments &&

clang/lib/Format/Format.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -111,17 +111,6 @@ template <> struct MappingTraits<FormatStyle::AlignConsecutiveStyle> {
111111
}
112112
};
113113

114-
template <>
115-
struct MappingTraits<FormatStyle::ShortCaseStatementsAlignmentStyle> {
116-
static void mapping(IO &IO,
117-
FormatStyle::ShortCaseStatementsAlignmentStyle &Value) {
118-
IO.mapOptional("Enabled", Value.Enabled);
119-
IO.mapOptional("AcrossEmptyLines", Value.AcrossEmptyLines);
120-
IO.mapOptional("AcrossComments", Value.AcrossComments);
121-
IO.mapOptional("AlignCaseColons", Value.AlignCaseColons);
122-
}
123-
};
124-
125114
template <>
126115
struct ScalarEnumerationTraits<FormatStyle::AttributeBreakingStyle> {
127116
static void enumeration(IO &IO, FormatStyle::AttributeBreakingStyle &Value) {
@@ -868,8 +857,6 @@ template <> struct MappingTraits<FormatStyle> {
868857
IO.mapOptional("AlignConsecutiveDeclarations",
869858
Style.AlignConsecutiveDeclarations);
870859
IO.mapOptional("AlignConsecutiveMacros", Style.AlignConsecutiveMacros);
871-
IO.mapOptional("AlignConsecutiveShortCaseStatements",
872-
Style.AlignConsecutiveShortCaseStatements);
873860
IO.mapOptional("AlignEscapedNewlines", Style.AlignEscapedNewlines);
874861
IO.mapOptional("AlignOperands", Style.AlignOperands);
875862
IO.mapOptional("AlignTrailingComments", Style.AlignTrailingComments);
@@ -1346,7 +1333,6 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language) {
13461333
LLVMStyle.AlignConsecutiveBitFields = {};
13471334
LLVMStyle.AlignConsecutiveDeclarations = {};
13481335
LLVMStyle.AlignConsecutiveMacros = {};
1349-
LLVMStyle.AlignConsecutiveShortCaseStatements = {};
13501336
LLVMStyle.AlignTrailingComments = {};
13511337
LLVMStyle.AlignTrailingComments.Kind = FormatStyle::TCAS_Always;
13521338
LLVMStyle.AlignTrailingComments.OverEmptyLines = 0;

0 commit comments

Comments
 (0)