aboutsummaryrefslogtreecommitdiff
path: root/lib/Format/Format.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-03-01 18:11:39 +0000
committerDaniel Jasper <djasper@google.com>2013-03-01 18:11:39 +0000
commit516fb31d0536040334032e2af6b62cd6a5479d1c (patch)
tree63522ac85d3162dbef52c43d530912adb1113695 /lib/Format/Format.cpp
parent8a5d7cd100ebfb8c6b353ee4ad5b14ab4105d32d (diff)
Remove whitespace at end of file.
This fixes the rest of llvm.org/PR15062. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176361 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/Format.cpp')
-rw-r--r--lib/Format/Format.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index bb7e0fa7e5..a3c5e503b9 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -1132,7 +1132,15 @@ public:
IndentForLevel.resize(TheLine.Level + 1);
bool WasMoved =
PreviousLineWasTouched && TheLine.First.FormatTok.NewlinesBefore == 0;
- if (TheLine.Type != LT_Invalid && (WasMoved || touchesRanges(TheLine))) {
+ if (TheLine.First.is(tok::eof)) {
+ if (PreviousLineWasTouched) {
+ unsigned NewLines =
+ std::min(TheLine.First.FormatTok.NewlinesBefore, 1u);
+ Whitespaces.replaceWhitespace(TheLine.First, NewLines, /*Indent*/ 0,
+ /*WhitespaceStartColumn*/ 0, Style);
+ }
+ } else if (TheLine.Type != LT_Invalid &&
+ (WasMoved || touchesRanges(TheLine))) {
unsigned LevelIndent = getIndent(IndentForLevel, TheLine.Level);
unsigned Indent = LevelIndent;
if (static_cast<int>(Indent) + Offset >= 0)