summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Frontend/TextDiagnosticPrinter.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Frontend/TextDiagnosticPrinter.cpp b/clang/lib/Frontend/TextDiagnosticPrinter.cpp
index 042e894febc..62446f33007 100644
--- a/clang/lib/Frontend/TextDiagnosticPrinter.cpp
+++ b/clang/lib/Frontend/TextDiagnosticPrinter.cpp
@@ -158,7 +158,7 @@ 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)
+ if (CaretEnd < Columns - 3)
CaretStart = 0;
unsigned TargetColumns = Columns - 8; // Give us extra room for the ellipses.
@@ -251,7 +251,8 @@ static void SelectInterestingSourceRegion(std::string &SourceLine,
// before the lines so that it looks nicer.
if (CaretEnd < SourceLine.size())
SourceLine.replace(CaretEnd, std::string::npos, "...");
- //CaretLine.erase(CaretEnd, std::string::npos);
+ if (CaretEnd < CaretLine.size())
+ CaretLine.erase(CaretEnd, std::string::npos);
if (FixItInsertionLine.size() > CaretEnd)
FixItInsertionLine.erase(CaretEnd, std::string::npos);
OpenPOWER on IntegriCloud