[llvm] 22d41ba - Fix -Wsign-compare warning with clang-cl

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 30 15:20:49 PDT 2019


Author: Reid Kleckner
Date: 2019-10-30T15:20:43-07:00
New Revision: 22d41ba024fa08026ebd85ec842712fcf780ca2a

URL: https://github.com/llvm/llvm-project/commit/22d41ba024fa08026ebd85ec842712fcf780ca2a
DIFF: https://github.com/llvm/llvm-project/commit/22d41ba024fa08026ebd85ec842712fcf780ca2a.diff

LOG: Fix -Wsign-compare warning with clang-cl

off_t apparently is just "long" on Win64, which is 32-bits, and
therefore not long enough to compare with UINT32_MAX. Use auto to follow
the surrounding code. uint64_t would also be fine.

Added: 
    

Modified: 
    llvm/lib/DebugInfo/GSYM/FunctionInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/DebugInfo/GSYM/FunctionInfo.cpp b/llvm/lib/DebugInfo/GSYM/FunctionInfo.cpp
index ad022fec9e32..e234a13fe06b 100644
--- a/llvm/lib/DebugInfo/GSYM/FunctionInfo.cpp
+++ b/llvm/lib/DebugInfo/GSYM/FunctionInfo.cpp
@@ -114,7 +114,7 @@ llvm::Expected<uint64_t> FunctionInfo::encode(FileWriter &O) const {
     llvm::Error err = OptLineTable->encode(O, Range.Start);
     if (err)
       return std::move(err);
-    const off_t Length = O.tell() - StartOffset;
+    const auto Length = O.tell() - StartOffset;
     if (Length > UINT32_MAX)
         return createStringError(std::errc::invalid_argument,
             "LineTable length is greater than UINT32_MAX");
@@ -132,7 +132,7 @@ llvm::Expected<uint64_t> FunctionInfo::encode(FileWriter &O) const {
     llvm::Error err = Inline->encode(O, Range.Start);
     if (err)
       return std::move(err);
-    const off_t Length = O.tell() - StartOffset;
+    const auto Length = O.tell() - StartOffset;
     if (Length > UINT32_MAX)
         return createStringError(std::errc::invalid_argument,
             "InlineInfo length is greater than UINT32_MAX");


        


More information about the llvm-commits mailing list