aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/LTO/LTO.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-08-22 21:56:01 -0700
committerGitHub <noreply@github.com>2024-08-22 21:56:01 -0700
commit3563907969843cb5d97995fb02177ee578e33aa2 (patch)
treebc6741610d97ad866d3a15d9a8405b0ff34d81e8 /llvm/lib/LTO/LTO.cpp
parent7c3237d778572931ff097e81df43d0bce9d1d4f8 (diff)
downloadllvm-3563907969843cb5d97995fb02177ee578e33aa2.zip
llvm-3563907969843cb5d97995fb02177ee578e33aa2.tar.gz
llvm-3563907969843cb5d97995fb02177ee578e33aa2.tar.bz2
[LTO] Turn ImportMapTy into a proper class (NFC) (#105748)
This patch turns type alias ImportMapTy into a proper class to provide a more intuitive interface like: ImportList.addDefinition(...) as opposed to: FunctionImporter::addDefinition(ImportList, ...) Also, this patch requires all non-const accesses to go through addDefinition, maybeAddDeclaration, and addGUID while providing const accesses via: const ImportMapTyImpl &getImportMap() const { return ImportMap; } I realize ImportMapTy may not be the best name as a class (maybe OK as a type alias). I am not renaming ImportMapTy in this patch at least because there are 47 mentions of ImportMapTy under llvm/.
Diffstat (limited to 'llvm/lib/LTO/LTO.cpp')
-rw-r--r--llvm/lib/LTO/LTO.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index e554586..ee01933 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -177,7 +177,8 @@ std::string llvm::computeLTOCacheKey(
// Include the hash for every module we import functions from. The set of
// imported symbols for each module may affect code generation and is
// sensitive to link order, so include that as well.
- using ImportMapIteratorTy = FunctionImporter::ImportMapTy::const_iterator;
+ using ImportMapIteratorTy =
+ FunctionImporter::ImportMapTy::ImportMapTyImpl::const_iterator;
struct ImportModule {
ImportMapIteratorTy ModIt;
const ModuleSummaryIndex::ModuleInfo *ModInfo;
@@ -191,10 +192,10 @@ std::string llvm::computeLTOCacheKey(
};
std::vector<ImportModule> ImportModulesVector;
- ImportModulesVector.reserve(ImportList.size());
+ ImportModulesVector.reserve(ImportList.getImportMap().size());
- for (ImportMapIteratorTy It = ImportList.begin(); It != ImportList.end();
- ++It) {
+ for (ImportMapIteratorTy It = ImportList.getImportMap().begin();
+ It != ImportList.getImportMap().end(); ++It) {
ImportModulesVector.push_back({It, Index.getModule(It->getFirst())});
}
// Order using module hash, to be both independent of module name and