[llvm] [LTO] Turn ImportMapTy into a proper class (NFC) (PR #105748)

Mingming Liu via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 22 21:06:33 PDT 2024


================
@@ -102,7 +102,39 @@ class FunctionImporter {
   /// elsewhere, typically by the in-memory ModuleSummaryIndex the importing
   /// decisions are made from (the module path for each summary is owned by the
   /// index's module path string table).
-  using ImportMapTy = DenseMap<StringRef, FunctionsToImportTy>;
+  class ImportMapTy {
+  public:
+    using ImportMapTyImpl = DenseMap<StringRef, FunctionsToImportTy>;
+
+    enum class AddDefinitionStatus {
+      NoChange,
+      Inserted,
+      ChangedToDefinition,
+    };
+
+    // Add the given GUID to ImportList as a definition.  If the same GUID has
+    // been added as a declaration previously, that entry is overridden.
+    AddDefinitionStatus addDefinition(StringRef FromModule,
+                                      GlobalValue::GUID GUID);
+
+    // Add the given GUID to ImportList as a declaration.  If the same GUID has
+    // been added as a definition previously, that entry takes precedence, and
+    // no change is made.
+    void maybeAddDeclaration(StringRef FromModule, GlobalValue::GUID GUID);
----------------
minglotus-6 wrote:

nit: make these two private methods of class `ImportMapTy`

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


More information about the llvm-commits mailing list