diff options
author | Seth Cantrell <seth.cantrell@gmail.com> | 2012-11-03 23:56:43 +0000 |
---|---|---|
committer | Seth Cantrell <seth.cantrell@gmail.com> | 2012-11-03 23:56:43 +0000 |
commit | 191db6dc0d6290b5f2993691e409ff2dc8b4345e (patch) | |
tree | e215af29e0401fd92cec10ebcd590af272f3f066 /lib/Frontend/TextDiagnostic.cpp | |
parent | a60d21d9ffd2a995c58dc5c5a4e3d9a014e3bc60 (diff) |
only truncate source lines in text diagnostics when
the ellipsis is shorter than the text it replaces
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167364 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/TextDiagnostic.cpp')
-rw-r--r-- | lib/Frontend/TextDiagnostic.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Frontend/TextDiagnostic.cpp b/lib/Frontend/TextDiagnostic.cpp index ca55197f90..35dabad606 100644 --- a/lib/Frontend/TextDiagnostic.cpp +++ b/lib/Frontend/TextDiagnostic.cpp @@ -494,7 +494,7 @@ static void selectInterestingSourceRegion(std::string &SourceLine, // The line needs some trunctiona, and we'd prefer to keep the front // if possible, so remove the back - if (BackColumnsRemoved) + if (BackColumnsRemoved > strlen(back_ellipse)) SourceLine.replace(SourceEnd, std::string::npos, back_ellipse); // If that's enough then we're done @@ -502,7 +502,7 @@ static void selectInterestingSourceRegion(std::string &SourceLine, return; // Otherwise remove the front as well - if (FrontColumnsRemoved) { + if (FrontColumnsRemoved > strlen(front_ellipse)) { SourceLine.replace(0, SourceStart, front_ellipse); CaretLine.replace(0, CaretStart, front_space); if (!FixItInsertionLine.empty()) |