[PATCH] D151761: clang-format: Add AlignConsecutiveShortCaseLabels
Björn Schäpers via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 31 12:37:43 PDT 2023
HazardyKnusperkeks added a comment.
When I read the title I thought "Yay, some one is doing what I want and don't find the time.", but (for me) sadly you're not.
I'd like to align the colon (and thus the statement behind that). Do you think you can add that option too?
================
Comment at: clang/include/clang/Format/Format.h:308
+ /// \version 17
+ AlignConsecutiveStyle AlignConsecutiveShortCaseLabels;
----------------
We need another name, you're not aligning the label, but the statement.
================
Comment at: clang/unittests/Format/FormatTest.cpp:19206
+
+ // Make sure we don't incorrectly align correctly across nested switch cases
+ EXPECT_EQ("switch (level) {\n"
----------------
================
Comment at: clang/unittests/Format/FormatTest.cpp:19207
+ // Make sure we don't incorrectly align correctly across nested switch cases
+ EXPECT_EQ("switch (level) {\n"
+ "case log::info: return \"info\";\n"
----------------
There is a `verifyFormat` overload which takes 2 strings, please use that.
================
Comment at: clang/unittests/Format/FormatTest.cpp:19255
+ Alignment);
+}
+
----------------
Add a test with `AcrossEmptyLines` and `AcrossComments`.
================
Comment at: clang/unittests/Format/FormatTest.cpp:19256
+}
+
TEST_F(FormatTest, AlignWithLineBreaks) {
----------------
Also add tests with `SpaceBeforeCaseColon`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D151761/new/
https://reviews.llvm.org/D151761
More information about the cfe-commits
mailing list