[PATCH] D21279: Fix some issues in clang-format's AlignConsecutive modes

Ben Harper via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 22 02:55:34 PDT 2016


bmharper added a comment.

The reason one has to precompute ScopeLevel is because IndentLevel is not actually meaningful on each token. It's only meaningful for the first token on the line (the remaining tokens on the line have IndentLevel = 0). So if you look at the implementation of calculateScopeLevel(), you'll see that the function "remembers" the most recent meaningful IndentLevel, and copies that into ScopeLevel for all subsequent tokens on the same line.
Now, one could argue that IndentLevel ought to be the same for all tokens on a line, but that seems to me like a much bigger change, that would propagate into many other parts of the code.


https://reviews.llvm.org/D21279





More information about the cfe-commits mailing list