mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-16 11:56:38 +00:00
[clang-format] Fix regression with AlignTrailingComments set to true
Fixes #62161. Differential Revision: https://reviews.llvm.org/D148447 (cherry picked from commit 2bcfff6708d293abab87a4d5a1dff25950d55d91)
This commit is contained in:
parent
70e4662aa4
commit
840ac8c52f
@ -721,23 +721,23 @@ template <> struct MappingTraits<FormatStyle::TrailingCommentsAlignmentStyle> {
|
||||
FormatStyle::TrailingCommentsAlignmentStyle &Value) {
|
||||
IO.enumCase(Value, "Leave",
|
||||
FormatStyle::TrailingCommentsAlignmentStyle(
|
||||
{FormatStyle::TCAS_Leave, 1}));
|
||||
{FormatStyle::TCAS_Leave, 0}));
|
||||
|
||||
IO.enumCase(Value, "Always",
|
||||
FormatStyle::TrailingCommentsAlignmentStyle(
|
||||
{FormatStyle::TCAS_Always, 1}));
|
||||
{FormatStyle::TCAS_Always, 0}));
|
||||
|
||||
IO.enumCase(Value, "Never",
|
||||
FormatStyle::TrailingCommentsAlignmentStyle(
|
||||
{FormatStyle::TCAS_Never, 1}));
|
||||
{FormatStyle::TCAS_Never, 0}));
|
||||
|
||||
// For backwards compatibility
|
||||
IO.enumCase(Value, "true",
|
||||
FormatStyle::TrailingCommentsAlignmentStyle(
|
||||
{FormatStyle::TCAS_Always, 1}));
|
||||
{FormatStyle::TCAS_Always, 0}));
|
||||
IO.enumCase(Value, "false",
|
||||
FormatStyle::TrailingCommentsAlignmentStyle(
|
||||
{FormatStyle::TCAS_Never, 1}));
|
||||
{FormatStyle::TCAS_Never, 0}));
|
||||
}
|
||||
|
||||
static void mapping(IO &IO,
|
||||
|
@ -468,20 +468,20 @@ TEST(ConfigParseTest, ParsesConfiguration) {
|
||||
|
||||
CHECK_PARSE("AlignTrailingComments: Leave", AlignTrailingComments,
|
||||
FormatStyle::TrailingCommentsAlignmentStyle(
|
||||
{FormatStyle::TCAS_Leave, 1}));
|
||||
{FormatStyle::TCAS_Leave, 0}));
|
||||
CHECK_PARSE("AlignTrailingComments: Always", AlignTrailingComments,
|
||||
FormatStyle::TrailingCommentsAlignmentStyle(
|
||||
{FormatStyle::TCAS_Always, 1}));
|
||||
{FormatStyle::TCAS_Always, 0}));
|
||||
CHECK_PARSE("AlignTrailingComments: Never", AlignTrailingComments,
|
||||
FormatStyle::TrailingCommentsAlignmentStyle(
|
||||
{FormatStyle::TCAS_Never, 1}));
|
||||
{FormatStyle::TCAS_Never, 0}));
|
||||
// For backwards compatibility
|
||||
CHECK_PARSE("AlignTrailingComments: true", AlignTrailingComments,
|
||||
FormatStyle::TrailingCommentsAlignmentStyle(
|
||||
{FormatStyle::TCAS_Always, 1}));
|
||||
{FormatStyle::TCAS_Always, 0}));
|
||||
CHECK_PARSE("AlignTrailingComments: false", AlignTrailingComments,
|
||||
FormatStyle::TrailingCommentsAlignmentStyle(
|
||||
{FormatStyle::TCAS_Never, 1}));
|
||||
{FormatStyle::TCAS_Never, 0}));
|
||||
CHECK_PARSE_NESTED_VALUE("Kind: Always", AlignTrailingComments, Kind,
|
||||
FormatStyle::TCAS_Always);
|
||||
CHECK_PARSE_NESTED_VALUE("Kind: Never", AlignTrailingComments, Kind,
|
||||
|
Loading…
x
Reference in New Issue
Block a user