[llvm] [IPO] Fix warnings in FunctionImport.h (PR #112861)

via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 18 02:24:38 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: Karl-Johan Karlsson (karka228)

<details>
<summary>Changes</summary>

Fix gcc 13.3 warnings like:
FunctionImport.h:273:33: warning: member 'llvm::FunctionImporter::ImportListsTy::ImportIDs' is used uninitialized [-Wuninitialized]

---
Full diff: https://github.com/llvm/llvm-project/pull/112861.diff


1 Files Affected:

- (modified) llvm/include/llvm/Transforms/IPO/FunctionImport.h (+4-3) 


``````````diff
diff --git a/llvm/include/llvm/Transforms/IPO/FunctionImport.h b/llvm/include/llvm/Transforms/IPO/FunctionImport.h
index 3623f9194d4d13..9cf3898d380318 100644
--- a/llvm/include/llvm/Transforms/IPO/FunctionImport.h
+++ b/llvm/include/llvm/Transforms/IPO/FunctionImport.h
@@ -270,8 +270,9 @@ class FunctionImporter {
   // A map from destination modules to lists of imports.
   class ImportListsTy {
   public:
-    ImportListsTy() : EmptyList(ImportIDs) {}
-    ImportListsTy(size_t Size) : EmptyList(ImportIDs), ListsImpl(Size) {}
+    ImportListsTy() : ImportIDs(), EmptyList(ImportIDs) {}
+    ImportListsTy(size_t Size)
+        : ImportIDs(), EmptyList(ImportIDs), ListsImpl(Size) {}
 
     ImportMapTy &operator[](StringRef DestMod) {
       return ListsImpl.try_emplace(DestMod, ImportIDs).first->second;
@@ -291,9 +292,9 @@ class FunctionImporter {
     const_iterator end() const { return ListsImpl.end(); }
 
   private:
+    ImportIDTable ImportIDs;
     ImportMapTy EmptyList;
     DenseMap<StringRef, ImportMapTy> ListsImpl;
-    ImportIDTable ImportIDs;
   };
 
   /// The set contains an entry for every global value that the module exports.

``````````

</details>


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


More information about the llvm-commits mailing list