enyquist added a comment.

Hey bmharper :) I've got a review open that conflicts with this one, just 
having a look to see what I'll need to refactor
(https://reviews.llvm.org/D28462).

In fact, I have a question-- the conflict is specifically in 
WhitespaceManager.cpp. Since I needed to detect PP macros containing changes in 
scope depth (code blocks surrounded by curly braces, macro parameter lists, 
etc), I was having the same problem as you-- AlignTokens was bailing out 
whenever the scope depth changed.

In my case, I just added a new parameter to AlignTokens, 
MaxNestingLevelIncrease, indicating how much the level can increase before we 
stop alignment, making the allowable scope-depth configurable. For example, 
calling AlignTokens with this flag set to 2 will cause alignment to continue up 
until we increase scope by two levels.

Now, my question- from what I can tell of your changes, it looks like my code 
can actually be simpler when this gets merged. The state of AlignTokens will be 
maintained across changing scope depths, and I won't need to modify AlignTokens 
so that it can survive something like "#define foo(x) ((x * 2) + 2)". Is  this 
correct?


https://reviews.llvm.org/D21279



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to