[PATCH] D21279: Fix some issues in clang-format's AlignConsecutive modes
Beren Minor via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 23 05:45:33 PDT 2016
berenm added a comment.
I had a little bit of look into the NestingLevel field. I understand that it only indicates the nesting level of the token inside the current unwrapped line, which could very well be the same as the nesting level of another token in the previous or next unwrapped line. Right now, it doesn't include the information on the nested level of the unwrapped line itself (this is in the Level field of the line itself).
I'm not sure if the value of IndentLevel comes directly from the unwrapped line's Level, but I believe that combining them would give an equivalent of a "global" nesting level of the token.
In order to be cleaner, I think it could be done in the AnnotatedLineParser class, that already fills the NestingLevel field. I wrote a patch that demonstrates this here: https://reviews.llvm.org/D24859. All the unit tests are passing, although I'm not 100% sure about all the implications this changes has. With this patch, I believed NestingLevel can be used directly to determine begin and end of alignment sequences, without requiring the ScopeLevel helper function.
More information about the cfe-commits