Fix uninitialized access error found by valgrind.

llvm-svn: 182476
This commit is contained in:
Manuel Klimek 2013-05-22 14:01:08 +00:00
parent 97aea34b54
commit 05c6789b00
1 changed files with 3 additions and 0 deletions

View File

@ -129,6 +129,9 @@ void WhitespaceManager::calculateLineBreakInformation() {
(Changes[i].NewlinesBefore > 0 || Changes[i].Kind == tok::eof) && (Changes[i].NewlinesBefore > 0 || Changes[i].Kind == tok::eof) &&
Changes[i - 1].Kind == tok::comment; 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; Changes.back().IsTrailingComment = Changes.back().Kind == tok::comment;
} }