summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-05-15 18:05:24 +0000
committerDouglas Gregor <dgregor@apple.com>2009-05-15 18:05:24 +0000
commit12c3a5cedfed8f36898991c09d4ab85d3a60b2d2 (patch)
treec75f27abed445e05d0d8a9225b16c4554d65b749 /clang/lib/Frontend
parent67da0d97e6790cc554aa0ca9986ee8651797caaf (diff)
downloadbcm5719-llvm-12c3a5cedfed8f36898991c09d4ab85d3a60b2d2.tar.gz
bcm5719-llvm-12c3a5cedfed8f36898991c09d4ab85d3a60b2d2.zip
When word-wrapping, be more defensive about a ridiculously small number of columns. Fixes <rdar://problem/6892178>
llvm-svn: 71870
Diffstat (limited to 'clang/lib/Frontend')
-rw-r--r--clang/lib/Frontend/TextDiagnosticPrinter.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Frontend/TextDiagnosticPrinter.cpp b/clang/lib/Frontend/TextDiagnosticPrinter.cpp
index f936807b6cf..09c29109f18 100644
--- a/clang/lib/Frontend/TextDiagnosticPrinter.cpp
+++ b/clang/lib/Frontend/TextDiagnosticPrinter.cpp
@@ -160,10 +160,12 @@ static void SelectInterestingSourceRegion(std::string &SourceLine,
// 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;
OpenPOWER on IntegriCloud