]> granicus.if.org Git - clang/commit
clang-format: Fix infinite loop in macro special case.
authorDaniel Jasper <djasper@google.com>
Wed, 28 Aug 2013 09:07:32 +0000 (09:07 +0000)
committerDaniel Jasper <djasper@google.com>
Wed, 28 Aug 2013 09:07:32 +0000 (09:07 +0000)
commitc9346c996c9d5de130541c84206c4a4d5bba24e9
treed2afe6bad286b2405611635b48ad85c7707afa07
parenta4dd982805e89a37a080350bf8de9069135c5a60
clang-format: Fix infinite loop in macro special case.

If escaped newlines are aligned right
(FormatStyle.AlignEscapedNewlinesLeft == false), and a line contained
too many characters to fit into the column limit, this would result in
a (virtually) endless loop creating a negative number of spaces.

Instead, allow the escaped newlines to be pushed past the column limit
in this case.

This fixes llvm.org/PR16515.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189459 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Format/WhitespaceManager.cpp
unittests/Format/FormatTest.cpp