[llvm-branch-commits] [cfe-branch] r71879 - in /cfe/branches/Apple/Dib: lib/Frontend/TextDiagnosticPrinter.cpp test/Misc/message-length.c

Mike Stump mrs at apple.com
Fri May 15 12:19:49 PDT 2009


Author: mrs
Date: Fri May 15 14:19:49 2009
New Revision: 71879

URL: http://llvm.org/viewvc/llvm-project?rev=71879&view=rev
Log:
Merge in 71870:

When word-wrapping, be more defensive about a ridiculously small number of columns. Fixes <rdar://problem/6892178>

Modified:
    cfe/branches/Apple/Dib/lib/Frontend/TextDiagnosticPrinter.cpp
    cfe/branches/Apple/Dib/test/Misc/message-length.c

Modified: cfe/branches/Apple/Dib/lib/Frontend/TextDiagnosticPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/Frontend/TextDiagnosticPrinter.cpp?rev=71879&r1=71878&r2=71879&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/lib/Frontend/TextDiagnosticPrinter.cpp (original)
+++ cfe/branches/Apple/Dib/lib/Frontend/TextDiagnosticPrinter.cpp Fri May 15 14:19:49 2009
@@ -160,10 +160,12 @@
 
   // If the end of the interesting region comes before we run out of
   // space in the terminal, start at the beginning of the line.
-  if (CaretEnd < Columns - 3)
+  if (Columns > 3 && CaretEnd < Columns - 3)
     CaretStart = 0;
 
-  unsigned TargetColumns = Columns - 8; // Give us extra room for the ellipses.
+  unsigned TargetColumns = Columns;
+  if (TargetColumns > 8)
+    TargetColumns -= 8; // Give us extra room for the ellipses.
   unsigned SourceLength = SourceLine.size();
   while ((CaretEnd - CaretStart) < TargetColumns) {
     bool ExpandedRegion = false;

Modified: cfe/branches/Apple/Dib/test/Misc/message-length.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/test/Misc/message-length.c?rev=71879&r1=71878&r2=71879&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/test/Misc/message-length.c (original)
+++ cfe/branches/Apple/Dib/test/Misc/message-length.c Fri May 15 14:19:49 2009
@@ -4,7 +4,7 @@
 // FIXME: This diagnostic is getting truncated very poorly.
 // RUN: grep -e '^  ...// some long comment text and a brace, eh {} ' %t.msg &&
 // RUN: grep -e '^                                                 \^' %t.msg &&
-
+// RUN: clang -fsyntax-only -fmessage-length=1 %s &&
 // RUN: true
 
 // Hack so we can check things better, force the file name and line.





More information about the llvm-branch-commits mailing list