[llvm] r328881 - Fix some signed / unsigned conversion problems.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 30 10:28:35 PDT 2018


Author: zturner
Date: Fri Mar 30 10:28:35 2018
New Revision: 328881

URL: http://llvm.org/viewvc/llvm-project?rev=328881&view=rev
Log:
Fix some signed / unsigned conversion problems.

Modified:
    llvm/trunk/tools/llvm-pdbutil/ExplainOutputStyle.cpp

Modified: llvm/trunk/tools/llvm-pdbutil/ExplainOutputStyle.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/ExplainOutputStyle.cpp?rev=328881&r1=328880&r2=328881&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbutil/ExplainOutputStyle.cpp (original)
+++ llvm/trunk/tools/llvm-pdbutil/ExplainOutputStyle.cpp Fri Mar 30 10:28:35 2018
@@ -339,15 +339,16 @@ static void explainSubstreamOffset(LineP
                                    const SubstreamRangeT &Substreams) {
   uint32_t SubOffset = OffsetInStream;
   for (const auto &Entry : Substreams) {
-    if (Entry.Size == 0)
+    if (Entry.Size <= 0)
       continue;
-    if (SubOffset < Entry.Size) {
-      P.formatLine("address is at offset {0}/{1} of the {2}.", SubOffset,
-                   Entry.Size, Entry.Label);
+    uint32_t S = static_cast<uint32_t>(Entry.Size);
+    if (SubOffset < S) {
+      P.formatLine("address is at offset {0}/{1} of the {2}.", SubOffset, S,
+                   Entry.Label);
       Entry.Explain(P, Stream, SubOffset);
       return;
     }
-    SubOffset -= Entry.Size;
+    SubOffset -= S;
   }
 }
 
@@ -360,22 +361,23 @@ void ExplainOutputStyle::explainDbiStrea
   assert(Header != nullptr);
 
   struct SubstreamInfo {
-    uint32_t Size;
+    int32_t Size;
     StringRef Label;
     void (*Explain)(LinePrinter &, DbiStream &, uint32_t);
   } Substreams[] = {
       {sizeof(DbiStreamHeader), "DBI Stream Header", explainDbiHeaderOffset},
-      {Header->ModiSubstreamSize, "Module Info Substream",
+      {int32_t(Header->ModiSubstreamSize), "Module Info Substream",
        explainDbiModiSubstreamOffset},
-      {Header->SecContrSubstreamSize, "Section Contribution Substream",
+      {int32_t(Header->SecContrSubstreamSize), "Section Contribution Substream",
        dontExplain<DbiStream>},
-      {Header->SectionMapSize, "Section Map", dontExplain<DbiStream>},
-      {Header->FileInfoSize, "File Info Substream", dontExplain<DbiStream>},
-      {Header->TypeServerSize, "Type Server Map Substream",
+      {int32_t(Header->SectionMapSize), "Section Map", dontExplain<DbiStream>},
+      {int32_t(Header->FileInfoSize), "File Info Substream",
        dontExplain<DbiStream>},
-      {Header->ECSubstreamSize, "Edit & Continue Substream",
+      {int32_t(Header->TypeServerSize), "Type Server Map Substream",
        dontExplain<DbiStream>},
-      {Header->OptionalDbgHdrSize, "Optional Debug Stream Array",
+      {int32_t(Header->ECSubstreamSize), "Edit & Continue Substream",
+       dontExplain<DbiStream>},
+      {int32_t(Header->OptionalDbgHdrSize), "Optional Debug Stream Array",
        dontExplain<DbiStream>},
   };
 




More information about the llvm-commits mailing list