Cut-off clang-format analysis.
If clang-format is confronted with long and deeply nested lines (e.g. complex static initializers or function calls), it can currently try too hard to find the optimal solution and never finish. The reason is that the memoization does not work effectively for deeply nested lines. This patch removes an earlier workaround and instead opts for accepting a non-optimal solution in rare cases. However, it only does so only in cases where it would have to analyze an excessive number of states (currently set to 10000 - the most complex line in Format.cpp requires ~800 states) so this should not change the behavior in a relevant way. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182449 91177308-0d34-0410-b5e6-96231b3b80d8
Showing
- lib/Format/Format.cpp 23 additions, 12 deletionslib/Format/Format.cpp
- lib/Format/TokenAnnotator.cpp 0 additions, 2 deletionslib/Format/TokenAnnotator.cpp
- lib/Format/TokenAnnotator.h 1 addition, 15 deletionslib/Format/TokenAnnotator.h
- unittests/Format/FormatTest.cpp 20 additions, 0 deletionsunittests/Format/FormatTest.cpp
Loading
Please register or sign in to comment