From: Manuel Klimek Date: Wed, 22 May 2013 14:01:08 +0000 (+0000) Subject: Fix uninitialized access error found by valgrind. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0cd57b52c932c89fae03f0001add4821deaff5e7;p=clang Fix uninitialized access error found by valgrind. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182476 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Format/WhitespaceManager.cpp b/lib/Format/WhitespaceManager.cpp index d4953b4a78..d1a925c516 100644 --- a/lib/Format/WhitespaceManager.cpp +++ b/lib/Format/WhitespaceManager.cpp @@ -129,6 +129,9 @@ void WhitespaceManager::calculateLineBreakInformation() { (Changes[i].NewlinesBefore > 0 || Changes[i].Kind == tok::eof) && Changes[i - 1].Kind == tok::comment; } + // FIXME: The last token is currently not always an eof token; in those + // cases, setting TokenLength of the last token to 0 is wrong. + Changes.back().TokenLength = 0; Changes.back().IsTrailingComment = Changes.back().Kind == tok::comment; }