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

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 22 06:02:20 PST 2022


MyDeveloperDay added inline comments.


================
Comment at: clang/docs/tools/dump_format_style.py:121
   def __str__(self):
-    return '\n'.join(map(str, self.values))
+    return self.comment + '\n' + '\n'.join(map(str, self.values))
 
----------------
Can this change be separate? why is this needed? Could you add a screengrab of the html that it generates?


================
Comment at: clang/lib/Format/WhitespaceManager.cpp:273
+// RightJustify - Whether it is the token's right end or left end that
+// gets moved to that column.
 template <typename F>
----------------
something odd here why not, the following its fits 80 columns

```
// Column - The token for which Matches returns true is moved to this column.
// RightJustify - Whether it is the token's right end or left end that gets
// moved to that column.
```


================
Comment at: clang/lib/Format/WhitespaceManager.cpp:337
+      Shift = Column - RightJustify * Changes[i].TokenLength -
+              Changes[i].StartOfTokenColumn;
       Changes[i].Spaces += Shift;
----------------
RightJustify is a bool? so I'm sure this is a good way of doing a conditional but surely there is a compiler out there that is going to complain


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