[llvm-commits] [llvm] r156313 - /llvm/trunk/lib/Support/SourceMgr.cpp

Matt Beaumont-Gay matthewbg at google.com
Mon May 7 11:12:42 PDT 2012


Author: matthewbg
Date: Mon May  7 13:12:42 2012
New Revision: 156313

URL: http://llvm.org/viewvc/llvm-project?rev=156313&view=rev
Log:
Don't assume size_t is unsigned long long.

Fixes a -Woverflow warning from gcc when building for 32-bit platforms.

Modified:
    llvm/trunk/lib/Support/SourceMgr.cpp

Modified: llvm/trunk/lib/Support/SourceMgr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/SourceMgr.cpp?rev=156313&r1=156312&r2=156313&view=diff
==============================================================================
--- llvm/trunk/lib/Support/SourceMgr.cpp (original)
+++ llvm/trunk/lib/Support/SourceMgr.cpp Mon May  7 13:12:42 2012
@@ -121,7 +121,7 @@
   Cache.LineNoOfQuery = LineNo;
   
   size_t NewlineOffs = StringRef(BufStart, Ptr-BufStart).find_last_of("\n\r");
-  if (NewlineOffs == StringRef::npos) NewlineOffs = ~0ULL;
+  if (NewlineOffs == StringRef::npos) NewlineOffs = ~(size_t)0;
   return std::make_pair(LineNo, Ptr-BufStart-NewlineOffs);
 }
 
@@ -358,5 +358,3 @@
   
   S << '\n';
 }
-
-





More information about the llvm-commits mailing list