Fix a bug in caret-line-pruning logic that only happens when we have a
source line wider than the terminal where the associated fix-it line
is longer than the caret line. Previously, we would crash in this
case, which was rather unfortunate. Fixes <rdar://problem/7856226>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101426 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Misc/message-length.c b/test/Misc/message-length.c
index 3c74605..3e69b6a 100644
--- a/test/Misc/message-length.c
+++ b/test/Misc/message-length.c
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -fmessage-length 72 %s 2>&1 | FileCheck -strict-whitespace %s
-// RUN: %clang_cc1 -fmessage-length 1 %s
-
+// RUN: not %clang_cc1 -fmessage-length 72 %s 2>&1 | FileCheck -strict-whitespace %s
+// RUN: not %clang_cc1 -fmessage-length 1 %s
+// RUN: not %clang_cc1 -fmessage-length 8 %s 2>&1 | FileCheck -check-prefix=CHECK-DOT %s
 // Hack so we can check things better, force the file name and line.
 # 1 "FILE" 1
 
@@ -30,3 +30,13 @@
 
 // CHECK: FILE:23:78
 // CHECK: {{^  ...// some long comment text and a brace, eh {} }}
+
+struct A { int x; };
+void h(struct A *a) {
+  // CHECK-DOT: member
+  // CHECK-DOT: reference
+  // CHECK-DOT: type
+  (void)a
+          .
+          x;
+}