r365019 - Fix MSVC "signed/unsigned mismatch" warning. NFCI.

Simon Pilgrim via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 3 03:26:29 PDT 2019


Author: rksimon
Date: Wed Jul  3 03:26:28 2019
New Revision: 365019

URL: http://llvm.org/viewvc/llvm-project?rev=365019&view=rev
Log:
Fix MSVC "signed/unsigned mismatch" warning. NFCI.

Fixes PR42426.

Modified:
    cfe/trunk/lib/Basic/SourceManager.cpp

Modified: cfe/trunk/lib/Basic/SourceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SourceManager.cpp?rev=365019&r1=365018&r2=365019&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/SourceManager.cpp (original)
+++ cfe/trunk/lib/Basic/SourceManager.cpp Wed Jul  3 03:26:28 2019
@@ -113,7 +113,8 @@ const llvm::MemoryBuffer *ContentCache::
   // Clang (including elsewhere in this file!) use 'unsigned' to represent file
   // offsets, line numbers, string literal lengths, and so on, and fail
   // miserably on large source files.
-  if (ContentsEntry->getSize() >= std::numeric_limits<unsigned>::max()) {
+  if ((uint64_t)ContentsEntry->getSize() >=
+      std::numeric_limits<unsigned>::max()) {
     // We can't make a memory buffer of the required size, so just make a small
     // one. We should never hit a situation where we've already parsed to a
     // later offset of the file, so it shouldn't matter that the buffer is




More information about the cfe-commits mailing list