[llvm] a43c192 - [llvm-jitlink] Use SmallVectorImpl when referencing StubInfos (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 22 01:37:26 PST 2024


Author: Nikita Popov
Date: 2024-01-22T10:37:18+01:00
New Revision: a43c192567eb4ea2535d73b83da5c7d5ed2b6122

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

LOG: [llvm-jitlink] Use SmallVectorImpl when referencing StubInfos (NFC)

The element type is declared as SmallVector<T, 1>, but we assign to
SmallVector<T> &. These types are not the same on 32-bit systems,
resulting in a compilation error.

Fix this by using SmallVectorImpl<T> & instead, which is independent
of the small size.

Added: 
    

Modified: 
    llvm/tools/llvm-jitlink/llvm-jitlink.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
index d233ebdb5a3a8dc..7e213777a6727e8 100644
--- a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
+++ b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
@@ -1212,7 +1212,7 @@ Error Session::FileInfo::registerStubEntry(
   if (!TS)
     return TS.takeError();
 
-  SmallVector<MemoryRegionInfo> &Entry = StubInfos[TS->getName()];
+  SmallVectorImpl<MemoryRegionInfo> &Entry = StubInfos[TS->getName()];
   Entry.insert(Entry.begin(),
                {Sym.getSymbolContent(), Sym.getAddress().getValue(),
                 Sym.getTargetFlags()});
@@ -1230,7 +1230,7 @@ Error Session::FileInfo::registerMultiStubEntry(
   if (!Target)
     return Target.takeError();
 
-  SmallVector<MemoryRegionInfo> &Entry = StubInfos[Target->getName()];
+  SmallVectorImpl<MemoryRegionInfo> &Entry = StubInfos[Target->getName()];
   Entry.emplace_back(Sym.getSymbolContent(), Sym.getAddress().getValue(),
                      Sym.getTargetFlags());
 


        


More information about the llvm-commits mailing list