clang-format: Fix formatting of empty files (fixes c-index-tests).

llvm-svn: 195638
This commit is contained in:
Daniel Jasper 2013-11-25 11:53:05 +00:00
parent ccfc0481f1
commit 5877bf1b7c
1 changed files with 3 additions and 2 deletions

View File

@ -1332,8 +1332,9 @@ private:
SourceLocation Start = First.WhitespaceRange.getBegin();
if (!IncludeLeadingNewlines)
Start = Start.getLocWithOffset(First.LastNewlineOffset);
SourceLocation End = Last.getStartOfNonWhitespace().getLocWithOffset(
Last.TokenText.size() - 1);
SourceLocation End = Last.getStartOfNonWhitespace();
if (Last.TokenText.size() > 0)
End = End.getLocWithOffset(Last.TokenText.size() - 1);
CharSourceRange Range = CharSourceRange::getCharRange(Start, End);
return affectsCharSourceRange(Range);
}