[llvm] [LTO] Turn ImportMapTy into a proper class (NFC) (PR #105748)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 22 21:52:20 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);
----------------
kazutakahirata wrote:
I'd like to keep `addDefinition` and `maybeAddDeclaration` public methods so that the intent is clear at the call sites.
https://github.com/llvm/llvm-project/pull/105748
More information about the llvm-commits
mailing list