[llvm] [ThinLTO] Add lookup to ImportListsTy (PR #109036)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 14 02:06:29 PST 2025


================
@@ -270,20 +270,28 @@ class FunctionImporter {
   // A map from destination modules to lists of imports.
   class ImportListsTy {
   public:
-    ImportListsTy() = default;
-    ImportListsTy(size_t Size) : ListsImpl(Size) {}
+    ImportListsTy() : EmptyList(ImportIDs) {}
+    ImportListsTy(size_t Size) : EmptyList(ImportIDs), ListsImpl(Size) {}
----------------
mstorsjo wrote:

When compiling with GCC (13, in Ubuntu 24.04), this change added a rather noisy warning; as this issue is in a header, it gets printed a large number of times while building:
```
In file included from ../include/llvm/LTO/LTO.h:31,
                 from ../lib/LTO/LTO.cpp:13:
../include/llvm/Transforms/IPO/FunctionImport.h: In constructor ‘llvm::FunctionImporter::ImportListsTy::ImportListsTy()’:
../include/llvm/Transforms/IPO/FunctionImport.h:273:33: warning: member ‘llvm::FunctionImporter::ImportListsTy::ImportIDs’ is used uninitialized [-Wuninitialized]
  273 |     ImportListsTy() : EmptyList(ImportIDs) {}
      |                                 ^~~~~~~~~
../include/llvm/Transforms/IPO/FunctionImport.h: In constructor ‘llvm::FunctionImporter::ImportListsTy::ImportListsTy(size_t)’:
../include/llvm/Transforms/IPO/FunctionImport.h:274:44: warning: member ‘llvm::FunctionImporter::ImportListsTy::ImportIDs’ is used uninitialized [-Wuninitialized]
  274 |     ImportListsTy(size_t Size) : EmptyList(ImportIDs), ListsImpl(Size) {}
      |                                            ^~~~~~~~~
```

https://github.com/llvm/llvm-project/pull/109036


More information about the llvm-commits mailing list