[llvm-branch-commits] [clang] 840ac8c - [clang-format] Fix regression with AlignTrailingComments set to true
Tobias Hieta via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Apr 17 07:26:43 PDT 2023
Author: Owen Pan
Date: 2023-04-17T16:26:20+02:00
New Revision: 840ac8c52fd17cf5449f663674caf2064d95f6c4
URL: https://github.com/llvm/llvm-project/commit/840ac8c52fd17cf5449f663674caf2064d95f6c4
DIFF: https://github.com/llvm/llvm-project/commit/840ac8c52fd17cf5449f663674caf2064d95f6c4.diff
LOG: [clang-format] Fix regression with AlignTrailingComments set to true
Fixes #62161.
Differential Revision: https://reviews.llvm.org/D148447
(cherry picked from commit 2bcfff6708d293abab87a4d5a1dff25950d55d91)
Added:
Modified:
clang/lib/Format/Format.cpp
clang/unittests/Format/ConfigParseTest.cpp
Removed:
################################################################################
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 0d3fde90ab38..a59d53009eaa 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -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,
diff --git a/clang/unittests/Format/ConfigParseTest.cpp b/clang/unittests/Format/ConfigParseTest.cpp
index f432c2641b24..21d4b0715337 100644
--- a/clang/unittests/Format/ConfigParseTest.cpp
+++ b/clang/unittests/Format/ConfigParseTest.cpp
@@ -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,
More information about the llvm-branch-commits
mailing list