[PATCH] D119599: [clang-format] Add option to align compound assignments like `+=`
Björn Schäpers via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Mar 5 14:12:12 PST 2022
HazardyKnusperkeks added a comment.
Only some small things, I think we are nearly done and this is a great change.
================
Comment at: clang/include/clang/Format/Format.h:139-140
+ ///
+ /// They can also be read as a whole for compatibility. The choices
+ /// are:
+ /// - None
----------------
This fits in one line.
(Please also recheck the other comments.)
================
Comment at: clang/include/clang/Format/Format.h:243
+ return Enabled == R.Enabled && AcrossEmptyLines == R.AcrossEmptyLines &&
+ AcrossComments == R.AcrossComments;
+ }
----------------
Please add `AlignCompound` and `PadOperators`.
================
Comment at: clang/lib/Format/Format.cpp:182
+ IO.mapOptional("AcrossComments", Value.AcrossComments);
+ IO.mapOptional("Aligncompound", Value.AlignCompound);
+ IO.mapOptional("PadOperators", Value.PadOperators);
----------------
================
Comment at: clang/lib/Format/WhitespaceManager.cpp:466
+// and `=`.
+// When RightJustify and PadAnchors are true, operators in each block to
+// be aligned will be padded on the left to the same length before
----------------
There is no `PadAnchors` anymore.
================
Comment at: clang/unittests/Format/FormatTest.cpp:16800
+ Alignment));
+}
+
----------------
Can you test it with `AlignConsecutiveDeclarations`?
================
Comment at: clang/unittests/Format/FormatTest.cpp:19781
+ CHECK_PARSE(#FIELD ": Consecutive", FIELD, \
+ FormatStyle::AlignConsecutiveStyle({/*.Enabled=*/true})); \
+ CHECK_PARSE(#FIELD ": AcrossEmptyLines", FIELD, \
----------------
Drop the .
Same below.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119599/new/
https://reviews.llvm.org/D119599
More information about the cfe-commits
mailing list