aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/TextDiagnostic.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Frontend/TextDiagnostic.cpp')
-rw-r--r--lib/Frontend/TextDiagnostic.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Frontend/TextDiagnostic.cpp b/lib/Frontend/TextDiagnostic.cpp
index ae1396672b..306306d3ac 100644
--- a/lib/Frontend/TextDiagnostic.cpp
+++ b/lib/Frontend/TextDiagnostic.cpp
@@ -1160,8 +1160,13 @@ std::string TextDiagnostic::buildFixItInsertionLine(
unsigned LastColumnModified
= HintColNo + I->CodeToInsert.size();
- if (LastColumnModified <= static_cast<unsigned>(map.bytes()))
+ if (LastColumnModified <= static_cast<unsigned>(map.bytes())) {
+ // If we're right in the middle of a multibyte character skip to
+ // the end of it.
+ while (map.byteToColumn(LastColumnModified) == -1)
+ ++LastColumnModified;
LastColumnModified = map.byteToColumn(LastColumnModified);
+ }
if (LastColumnModified > FixItInsertionLine.size())
FixItInsertionLine.resize(LastColumnModified, ' ');