[PATCH] D28462: clang-format: Add new style option AlignConsecutiveMacros

Nick Renieris via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 20 07:45:29 PDT 2019


VelocityRa added inline comments.


================
Comment at: lib/Format/WhitespaceManager.cpp:500
+    if (Changes[i].NewlinesBefore != 0) {
+      EndOfSequence = i;
+      // If there is a blank line, or if the last line didn't contain any
----------------
klimek wrote:
> VelocityRa wrote:
> > klimek wrote:
> > > Why set EndOfSequence outside the if below?
> > It's from `AlignTokens`. I think it's because due to some of the loop logic, it ends up not checking up to the point of the the last token.
> > Without setting this and calling `AlignCurrentSequence()` once more at the end, the last line of a macro group does not get properly aligned, the tests fail.
> I was suggesting to move it inside the if below, did you try that (sounds like you tried to remove it).
I moved it so that the below `if` is:
```
      if (Changes[i].NewlinesBefore > 1 || !FoundMatchOnLine) {
        EndOfSequence = i;
        AlignCurrentSequence();
      }
```
and it did not work correctly.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D28462/new/

https://reviews.llvm.org/D28462





More information about the cfe-commits mailing list