r180110 - Make compares unsigned. The expression can't become negative anyways.

Benjamin Kramer benny.kra at googlemail.com
Tue Apr 23 07:42:47 PDT 2013


Author: d0k
Date: Tue Apr 23 09:42:47 2013
New Revision: 180110

URL: http://llvm.org/viewvc/llvm-project?rev=180110&view=rev
Log:
Make compares unsigned. The expression can't become negative anyways.

Silences a sign compare warning on 32 bit archs.

Modified:
    cfe/trunk/lib/Frontend/TextDiagnostic.cpp

Modified: cfe/trunk/lib/Frontend/TextDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/TextDiagnostic.cpp?rev=180110&r1=180109&r2=180110&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/TextDiagnostic.cpp (original)
+++ cfe/trunk/lib/Frontend/TextDiagnostic.cpp Tue Apr 23 09:42:47 2013
@@ -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.





More information about the cfe-commits mailing list