tejohnson created this revision.
Herald added a subscriber: inglorion.

Clang side changes to go with LLVM change to import aliases as
a copy of their aliasee. Simply refactor out some handling that
is moved to LLVM for use elsewhere.

Depends on https://reviews.llvm.org/D40747.


Repository:
  rC Clang

https://reviews.llvm.org/D40748

Files:
  lib/CodeGen/BackendUtil.cpp


Index: lib/CodeGen/BackendUtil.cpp
===================================================================
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -1038,23 +1038,8 @@
   // we should only invoke this using the individual indexes written out
   // via a WriteIndexesThinBackend.
   FunctionImporter::ImportMapTy ImportList;
-  for (auto &GlobalList : *CombinedIndex) {
-    // Ignore entries for undefined references.
-    if (GlobalList.second.SummaryList.empty())
-      continue;
-
-    auto GUID = GlobalList.first;
-    assert(GlobalList.second.SummaryList.size() == 1 &&
-           "Expected individual combined index to have one summary per GUID");
-    auto &Summary = GlobalList.second.SummaryList[0];
-    // Skip the summaries for the importing module. These are included to
-    // e.g. record required linkage changes.
-    if (Summary->modulePath() == M->getModuleIdentifier())
-      continue;
-    // Doesn't matter what value we plug in to the map, just needs an entry
-    // to provoke importing by thinBackend.
-    ImportList[Summary->modulePath()][GUID] = 1;
-  }
+  llvm::ComputeCrossModuleImportForModuleFromIndex(M->getModuleIdentifier(),
+                                                   *CombinedIndex, ImportList);
 
   std::vector<std::unique_ptr<llvm::MemoryBuffer>> OwnedImports;
   MapVector<llvm::StringRef, llvm::BitcodeModule> ModuleMap;


Index: lib/CodeGen/BackendUtil.cpp
===================================================================
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -1038,23 +1038,8 @@
   // we should only invoke this using the individual indexes written out
   // via a WriteIndexesThinBackend.
   FunctionImporter::ImportMapTy ImportList;
-  for (auto &GlobalList : *CombinedIndex) {
-    // Ignore entries for undefined references.
-    if (GlobalList.second.SummaryList.empty())
-      continue;
-
-    auto GUID = GlobalList.first;
-    assert(GlobalList.second.SummaryList.size() == 1 &&
-           "Expected individual combined index to have one summary per GUID");
-    auto &Summary = GlobalList.second.SummaryList[0];
-    // Skip the summaries for the importing module. These are included to
-    // e.g. record required linkage changes.
-    if (Summary->modulePath() == M->getModuleIdentifier())
-      continue;
-    // Doesn't matter what value we plug in to the map, just needs an entry
-    // to provoke importing by thinBackend.
-    ImportList[Summary->modulePath()][GUID] = 1;
-  }
+  llvm::ComputeCrossModuleImportForModuleFromIndex(M->getModuleIdentifier(),
+                                                   *CombinedIndex, ImportList);
 
   std::vector<std::unique_ptr<llvm::MemoryBuffer>> OwnedImports;
   MapVector<llvm::StringRef, llvm::BitcodeModule> ModuleMap;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to