If the first token of an annotated line already has a computed Newlines, reuse it to avoid potential overlapping whitespace replacements before preprocessor branching directives.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/Format/UnwrappedLineFormatter.cpp | ||
---|---|---|
1424 | I will remove this parameter as it's Line.First. |
Comment Actions
This patch seems to introduce some significant regressions to formatting. I've filed https://github.com/llvm/llvm-project/issues/63170 with some candidate code. I'll try to reduce the case as I can, but I'm guessing something is incorrect w/ how the indentation level is tracked, since we see includes being incorrectly indented and lots of lines w/ whitespace.
Comment Actions
@leonardchan I'm not sure this patch should be reverted just yet. I can't reproduce the regression, and this patch does fix a previous regression.
Comment Actions
Add a member Newlines to struct FormatToken and compute it only once in UnwrappedLineFormatter::formatFirstToken().
I will remove this parameter as it's Line.First.