[llvm] r343957 - [DebugInfo][PDB] Fix a signed/unsigned coversion warning

Kristina Brooks via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 8 02:03:17 PDT 2018


Author: kristina
Date: Mon Oct  8 02:03:17 2018
New Revision: 343957

URL: http://llvm.org/viewvc/llvm-project?rev=343957&view=rev
Log:
[DebugInfo][PDB] Fix a signed/unsigned coversion warning

Fix the following warning when compiling with clang (caused by commit
rL343951):

GlobalsStream.cpp:61:33: warning: comparison of integers of different
signs: 'int' and 'uint32_t'

This also avoids double evaluation of `GlobalsTable.HashBuckets.size()`.


Modified:
    llvm/trunk/lib/DebugInfo/PDB/Native/GlobalsStream.cpp

Modified: llvm/trunk/lib/DebugInfo/PDB/Native/GlobalsStream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/GlobalsStream.cpp?rev=343957&r1=343956&r2=343957&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Native/GlobalsStream.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Native/GlobalsStream.cpp Mon Oct  8 02:03:17 2018
@@ -58,7 +58,7 @@ GlobalsStream::findRecordsByName(StringR
 
   uint32_t ChainStartOffset = GlobalsTable.HashBuckets[CompressedBucketIndex];
   uint32_t NextChainStart = GlobalsTable.HashBuckets.size();
-  if (CompressedBucketIndex + 1 < GlobalsTable.HashBuckets.size())
+  if (static_cast<uint32_t>(CompressedBucketIndex + 1) < NextChainStart)
     NextChainStart = GlobalsTable.HashBuckets[CompressedBucketIndex + 1];
   ChainStartOffset /= 12;
   NextChainStart /= 12;




More information about the llvm-commits mailing list