aboutsummaryrefslogtreecommitdiff
path: root/lib/Format/Format.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-01-14 16:02:06 +0000
committerDaniel Jasper <djasper@google.com>2013-01-14 16:02:06 +0000
commitfd0ca976bd55167364ba1178e884d275cc6ef30b (patch)
tree38f58d8aef44bd26b55196f1e97a34d3a0496539 /lib/Format/Format.cpp
parent2b9c10bd8f80c004756308a5163fa7eda27eb5ce (diff)
Fix a bug in the line merging.
If the first line of a merge would exactly fit into the column limit, an unsigned overflow made us not break. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172426 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/Format.cpp')
-rw-r--r--lib/Format/Format.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index 742b9a8d1c..4e9fd405df 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -1408,6 +1408,8 @@ private:
unsigned Length = 0;
if (!fitsIntoLimit(I->First, Limit, &Length))
return false;
+ if (Limit == Length)
+ return true; // Couldn't fit a space.
Limit -= Length + 1; // One space.
if (I + 1 == E)
return true;