[llvm] e5ff1a7 - [JITLink][COFF] Fix compiler warnings.

via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 12 12:29:16 PDT 2022


Author: sunho
Date: 2022-07-13T04:29:05+09:00
New Revision: e5ff1a7f5600999bd6d3797dcd199f4814e56103

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

LOG: [JITLink][COFF] Fix compiler warnings.

Added: 
    

Modified: 
    llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.cpp
    llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.h
    llvm/lib/ExecutionEngine/JITLink/COFF_x86_64.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.cpp b/llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.cpp
index fac3d6ae142b..f3416a2c9e01 100644
--- a/llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.cpp
@@ -21,10 +21,10 @@ namespace jitlink {
 COFFLinkGraphBuilder::COFFLinkGraphBuilder(
     const object::COFFObjectFile &Obj, Triple TT,
     LinkGraph::GetEdgeKindNameFunction GetEdgeKindName)
-    : G(std::make_unique<LinkGraph>(
+    : Obj(Obj),
+      G(std::make_unique<LinkGraph>(
           Obj.getFileName().str(), Triple(std::move(TT)), getPointerSize(Obj),
-          getEndianness(Obj), std::move(GetEdgeKindName))),
-      Obj(Obj) {
+          getEndianness(Obj), std::move(GetEdgeKindName))) {
   LLVM_DEBUG({
     dbgs() << "Created COFFLinkGraphBuilder for \"" << Obj.getFileName()
            << "\"\n";
@@ -117,7 +117,8 @@ Error COFFLinkGraphBuilder::graphifySections() {
 
   GraphBlocks.resize(Obj.getNumberOfSections() + 1);
   // For each section...
-  for (COFFSectionIndex SecIndex = 1; SecIndex <= Obj.getNumberOfSections();
+  for (COFFSectionIndex SecIndex = 1;
+       SecIndex <= static_cast<COFFSectionIndex>(Obj.getNumberOfSections());
        SecIndex++) {
     Expected<const object::coff_section *> Sec = Obj.getSection(SecIndex);
     if (!Sec)
@@ -191,7 +192,8 @@ Error COFFLinkGraphBuilder::graphifySymbols() {
   SymbolSets.resize(Obj.getNumberOfSections() + 1);
   GraphSymbols.resize(Obj.getNumberOfSymbols());
 
-  for (COFFSymbolIndex SymIndex = 0; SymIndex < Obj.getNumberOfSymbols();
+  for (COFFSymbolIndex SymIndex = 0;
+       SymIndex < static_cast<COFFSymbolIndex>(Obj.getNumberOfSymbols());
        SymIndex++) {
     Expected<object::COFFSymbolRef> Sym = Obj.getSymbol(SymIndex);
     if (!Sym)
@@ -318,7 +320,8 @@ Error COFFLinkGraphBuilder::flushWeakAliasRequests() {
 // the set once it's processed in graphifySymbols. In this function, we iterate
 // each collected symbol in sorted order and calculate the implicit size.
 Error COFFLinkGraphBuilder::calculateImplicitSizeOfSymbols() {
-  for (COFFSectionIndex SecIndex = 1; SecIndex <= Obj.getNumberOfSections();
+  for (COFFSectionIndex SecIndex = 1;
+       SecIndex <= static_cast<COFFSectionIndex>(Obj.getNumberOfSections());
        SecIndex++) {
     auto &SymbolSet = SymbolSets[SecIndex];
     jitlink::Block *B = getGraphBlock(SecIndex);

diff  --git a/llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.h b/llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.h
index 8c3e19d6518d..4dc1b14dc4a2 100644
--- a/llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.h
+++ b/llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.h
@@ -58,7 +58,8 @@ class COFFLinkGraphBuilder {
   }
 
   Symbol *getGraphSymbol(COFFSymbolIndex SymIndex) const {
-    if (SymIndex < 0 || SymIndex >= GraphSymbols.size())
+    if (SymIndex < 0 ||
+        SymIndex >= static_cast<COFFSymbolIndex>(GraphSymbols.size()))
       return nullptr;
     return GraphSymbols[SymIndex];
   }
@@ -70,7 +71,8 @@ class COFFLinkGraphBuilder {
   }
 
   Block *getGraphBlock(COFFSectionIndex SecIndex) const {
-    if (SecIndex <= 0 || SecIndex >= GraphSymbols.size())
+    if (SecIndex <= 0 ||
+        SecIndex >= static_cast<COFFSectionIndex>(GraphSymbols.size()))
       return nullptr;
     return GraphBlocks[SecIndex];
   }

diff  --git a/llvm/lib/ExecutionEngine/JITLink/COFF_x86_64.cpp b/llvm/lib/ExecutionEngine/JITLink/COFF_x86_64.cpp
index d5d6fd9f197d..3d36ad1ed767 100644
--- a/llvm/lib/ExecutionEngine/JITLink/COFF_x86_64.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/COFF_x86_64.cpp
@@ -120,10 +120,6 @@ class COFFLinkGraphBuilder_x86_64 : public COFFLinkGraphBuilder {
         orc::ExecutorAddr(FixupSect.getAddress()) + Rel.getOffset();
     Edge::OffsetT Offset = FixupAddress - BlockToFix.getAddress();
 
-    // Get a pointer to the fixup content.
-    const void *FixupContent = BlockToFix.getContent().data() +
-                               (FixupAddress - BlockToFix.getAddress());
-
     Edge::Kind Kind = Edge::Invalid;
 
     switch (*RelocKind) {


        


More information about the llvm-commits mailing list