Don't assume size_t is unsigned long long.
authorMatt Beaumont-Gay <matthewbg@google.com>
Mon, 7 May 2012 18:12:42 +0000 (18:12 +0000)
committerMatt Beaumont-Gay <matthewbg@google.com>
Mon, 7 May 2012 18:12:42 +0000 (18:12 +0000)
Fixes a -Woverflow warning from gcc when building for 32-bit platforms.

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

lib/Support/SourceMgr.cpp

index 5fa987bc3dfd36c611f21e8255b719189d229afe..37a9d8f82744ae381f3e4d0975f05454b1529ed8 100644 (file)
@@ -121,7 +121,7 @@ SourceMgr::getLineAndColumn(SMLoc Loc, int BufferID) const {
   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 @@ void SMDiagnostic::print(const char *ProgName, raw_ostream &S,
   
   S << '\n';
 }
-
-