]> granicus.if.org Git - clang/commitdiff
don't step into the middle of multibyte sequences
authorSeth Cantrell <seth.cantrell@gmail.com>
Sat, 3 Nov 2012 21:21:17 +0000 (21:21 +0000)
committerSeth Cantrell <seth.cantrell@gmail.com>
Sat, 3 Nov 2012 21:21:17 +0000 (21:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167361 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/TextDiagnostic.cpp

index 0eb3d60e0b0f158b4621b76f7a7646980ebb7df9..ca55197f90e675cb5218190764ba0ceda1f4de9f 100644 (file)
@@ -418,7 +418,7 @@ static void selectInterestingSourceRegion(std::string &SourceLine,
     bool ExpandedRegion = false;
 
     if (SourceStart>0) {
-      unsigned NewStart = SourceStart-1;
+      unsigned NewStart = map.startOfPreviousColumn(SourceStart);
 
       // Skip over any whitespace we see here; we're looking for
       // another bit of interesting text.
@@ -445,7 +445,7 @@ static void selectInterestingSourceRegion(std::string &SourceLine,
     }
 
     if (SourceEnd<SourceLine.size()) {
-      unsigned NewEnd = SourceEnd+1;
+      unsigned NewEnd = map.startOfNextColumn(SourceEnd);
 
       // Skip over any whitespace we see here; we're looking for
       // another bit of interesting text.