[PATCH] D79388: [clang-format] Fix AlignConsecutive on PP blocks

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 21 08:15:04 PDT 2020


MyDeveloperDay added inline comments.


================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:2996
     Line->Tokens.back().Tok->MustBreakBefore = true;
+    Line->Tokens.back().Tok->MustBreakAlignBefore = true;
     MustBreakBeforeNextToken = false;
----------------
MyDeveloperDay wrote:
> If the line ends with a comment and we have align trailing comments turned on then I think this breaks the alignment
If I comment out this line, then all the tests pass! and  https://bugs.llvm.org/show_bug.cgi?id=47589 is resolved. I think we need to understand why we are putting this here?

```
void UnwrappedLineParser::pushToken(FormatToken *Tok) {
  Line->Tokens.push_back(UnwrappedLineNode(Tok));
  if (MustBreakBeforeNextToken) {
    Line->Tokens.back().Tok->MustBreakBefore = true;
    // Line->Tokens.back().Tok->MustBreakAlignBefore = true;
    MustBreakBeforeNextToken = false;
  }
}
```



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79388



More information about the cfe-commits mailing list