On Mon, Jan 21, 2013 at 6:18 PM, Daniel Jasper <djas...@google.com> wrote:
> Author: djasper > Date: Mon Jan 21 08:18:28 2013 > New Revision: 173043 > > URL: http://llvm.org/viewvc/llvm-project?rev=173043&view=rev > Log: > Fix bug discovered by valgrind. > s/by valgrind/by MemorySanitizer/ :) --kcc > > When trying to merge lines, we should not touch lines that are invalid, > as we don't know how long they might be. > > Modified: > cfe/trunk/lib/Format/Format.cpp > > Modified: cfe/trunk/lib/Format/Format.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=173043&r1=173042&r2=173043&view=diff > > ============================================================================== > --- cfe/trunk/lib/Format/Format.cpp (original) > +++ cfe/trunk/lib/Format/Format.cpp Mon Jan 21 08:18:28 2013 > @@ -1716,7 +1716,7 @@ > return; > Limit -= I->Last->TotalLength + 1; // One space. > > - if (I + 1 == E) > + if (I + 1 == E || (I + 1)->Type == LT_Invalid) > return; > > if (I->Last->is(tok::l_brace)) { > @@ -1770,7 +1770,8 @@ > std::vector<AnnotatedLine>::iterator E, > unsigned 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; > > // First, check that the current line allows merging. This is the > case if > > > _______________________________________________ > cfe-commits mailing list > cfe-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >
_______________________________________________ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits