[Basic] Fix a warning
authorKazu Hirata <kazu@google.com>
Wed, 30 Nov 2022 16:57:05 +0000 (08:57 -0800)
committerKazu Hirata <kazu@google.com>
Wed, 30 Nov 2022 16:57:05 +0000 (08:57 -0800)
This patch fixes:

  clang/lib/Basic/SourceManager.cpp:1292:19: error: comparison of
  integers of different signs: 'long' and 'unsigned long'
  [-Werror,-Wsign-compare]

clang/lib/Basic/SourceManager.cpp

index f61dc0f..a5f673f 100644 (file)
@@ -1289,7 +1289,7 @@ LineOffsetMapping LineOffsetMapping::get(llvm::MemoryBufferRef Buffer,
 
   // scan sizeof(Word) bytes at a time for new lines.
   // This is much faster than scanning each byte independently.
-  if (End - Start > sizeof(Word)) {
+  if ((unsigned long)(End - Start) > sizeof(Word)) {
     do {
       Word = llvm::support::endian::read64(Buf, llvm::support::little);
       // no new line => jump over sizeof(Word) bytes.