[PATCH] D119599: Add option to align compound assignments like `+=`

sstwcw via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 12 05:55:37 PST 2022


sstwcw added inline comments.


================
Comment at: clang/lib/Format/WhitespaceManager.cpp:273
 AlignTokenSequence(const FormatStyle &Style, unsigned Start, unsigned End,
-                   unsigned Column, F &&Matches,
+                   unsigned Column, unsigned AnchorWidth, F &&Matches,
                    SmallVector<WhitespaceManager::Change, 16> &Changes) {
----------------
MyDeveloperDay wrote:
> I guess I just don't understand what we mean by AnchorWidth
Now that I look at it again it seems like only one column parameter is needed.


================
Comment at: clang/unittests/Format/FormatTest.cpp:16452
+  Alignment.AlignConsecutiveAssignments = FormatStyle::ACS_AcrossEmptyLines;
+  EXPECT_EQ("int a           += 5;\n"
+            "int one          = 1;\n"
----------------
MyDeveloperDay wrote:
> Is there a reason you couldn't use verifyFormat here? I would expect it to `messUp` the formatting and put it back correctly no?
`messUp` turns every newline into a space.


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