зеркало из https://github.com/microsoft/clang-1.git
Fix bug discovered by valgrind.
When trying to merge lines, we should not touch lines that are invalid, as we don't know how long they might be. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173043 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
0fbe0087d2
Коммит
9c8c40e733
|
@ -1716,7 +1716,7 @@ private:
|
||||||
return;
|
return;
|
||||||
Limit -= I->Last->TotalLength + 1; // One space.
|
Limit -= I->Last->TotalLength + 1; // One space.
|
||||||
|
|
||||||
if (I + 1 == E)
|
if (I + 1 == E || (I + 1)->Type == LT_Invalid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (I->Last->is(tok::l_brace)) {
|
if (I->Last->is(tok::l_brace)) {
|
||||||
|
@ -1770,7 +1770,8 @@ private:
|
||||||
std::vector<AnnotatedLine>::iterator E,
|
std::vector<AnnotatedLine>::iterator E,
|
||||||
unsigned Limit){
|
unsigned Limit){
|
||||||
// Check that we still have three lines and they fit into the limit.
|
// Check that we still have three lines and they fit into the limit.
|
||||||
if (I + 2 == E || !nextTwoLinesFitInto(I, Limit))
|
if (I + 2 == E || (I + 2)->Type == LT_Invalid ||
|
||||||
|
!nextTwoLinesFitInto(I, Limit))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// First, check that the current line allows merging. This is the case if
|
// First, check that the current line allows merging. This is the case if
|
||||||
|
|
Загрузка…
Ссылка в новой задаче