fix calculation of end pointer
authorSeth Cantrell <seth.cantrell@gmail.com>
Tue, 30 Oct 2012 06:13:50 +0000 (06:13 +0000)
committerSeth Cantrell <seth.cantrell@gmail.com>
Tue, 30 Oct 2012 06:13:50 +0000 (06:13 +0000)
llvm-svn: 167006

clang/lib/Frontend/TextDiagnostic.cpp

index 598238860d60dd8baf9980182a57908cd4050c1b..bbd96b91f59c636f6fc4aa151f1bbfa06401cd6d 100644 (file)
@@ -127,7 +127,7 @@ printableTextForNextCharacter(StringRef SourceLine, size_t *i,
 
   unsigned char const *begin, *end;
   begin = reinterpret_cast<unsigned char const *>(&*(SourceLine.begin() + *i));
-  end = begin + SourceLine.size();
+  end = begin + (SourceLine.size() - *i);
   
   if (isLegalUTF8Sequence(begin, end)) {
     UTF32 c;