Makes whitespace management more consistent.
Instead of selectively storing some changes and directly generating replacements for others, we now notify the WhitespaceManager of the whitespace before every token (and optionally with more changes inside tokens). Then, we run over all whitespace in the very end in original source order, where we have all information available to correctly align comments and escaped newlines. The future direction is to pull more of the comment alignment implementation that is now in the BreakableToken into the WhitespaceManager. This fixes a bug when aligning comments or escaped newlines in unwrapped lines that are handled out of order: #define A \ f({ \ g(); \ }); ... now gets correctly layouted. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182467 91177308-0d34-0410-b5e6-96231b3b80d8
Showing
- lib/Format/BreakableToken.cpp 13 additions, 7 deletionslib/Format/BreakableToken.cpp
- lib/Format/BreakableToken.h 5 additions, 4 deletionslib/Format/BreakableToken.h
- lib/Format/Format.cpp 51 additions, 73 deletionslib/Format/Format.cpp
- lib/Format/TokenAnnotator.cpp 20 additions, 3 deletionslib/Format/TokenAnnotator.cpp
- lib/Format/TokenAnnotator.h 10 additions, 3 deletionslib/Format/TokenAnnotator.h
- lib/Format/WhitespaceManager.cpp 200 additions, 142 deletionslib/Format/WhitespaceManager.cpp
- lib/Format/WhitespaceManager.h 109 additions, 53 deletionslib/Format/WhitespaceManager.h
- unittests/Format/FormatTest.cpp 7 additions, 0 deletionsunittests/Format/FormatTest.cpp
Loading
Please register or sign in to comment