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

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 12 04:55:40 PST 2022


MyDeveloperDay requested changes to this revision.
MyDeveloperDay added inline comments.
This revision now requires changes to proceed.


================
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) {
----------------
I guess I just don't understand what we mean by AnchorWidth


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


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