]> granicus.if.org Git - clang/commitdiff
Make compares unsigned. The expression can't become negative anyways.
authorBenjamin Kramer <benny.kra@googlemail.com>
Tue, 23 Apr 2013 14:42:47 +0000 (14:42 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Tue, 23 Apr 2013 14:42:47 +0000 (14:42 +0000)
Silences a sign compare warning on 32 bit archs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180110 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/TextDiagnostic.cpp

index ca4ad60c524db346619b7c05d5314542b32bde99..1572d0f1d07ffa6b4e85959c981ce4f72f4f23b9 100644 (file)
@@ -1095,7 +1095,7 @@ void TextDiagnostic::emitSnippetAndCaret(
   unsigned ColNo = SM.getColumnNumber(FID, FileOffset);
   
   // Arbitrarily stop showing snippets when the line is too long.
-  static const ptrdiff_t MaxLineLengthToPrint = 4096;
+  static const size_t MaxLineLengthToPrint = 4096;
   if (ColNo > MaxLineLengthToPrint)
     return;
 
@@ -1110,7 +1110,7 @@ void TextDiagnostic::emitSnippetAndCaret(
     ++LineEnd;
 
   // Arbitrarily stop showing snippets when the line is too long.
-  if (LineEnd - LineStart > MaxLineLengthToPrint)
+  if (size_t(LineEnd - LineStart) > MaxLineLengthToPrint)
     return;
 
   // Copy the line of code into an std::string for ease of manipulation.