[clang] [clang][deps] Collect discovered module dependencies' Link Libraries (PR #93588)

Artem Chikin via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 3 11:29:43 PDT 2024


================
@@ -138,6 +139,14 @@ struct ModuleDeps {
   /// determined that the differences are benign for this compilation.
   std::vector<ModuleID> ClangModuleDeps;
 
+  /// The set of libraries or frameworks to link against when
+  /// an entity from this module is used.
+  llvm::SmallVector<Module::LinkLibrary, 2> LinkLibraries;
+
+  /// Autolinking uses the framework name for linking purposes
+  /// when this is false and the export_as name otherwise.
+  bool UseExportAsModuleLinkName;
----------------
artemcm wrote:

It seems that `LinkLibraries` are still collected for a `Module` separately just in case it gets discovered/imported by a module matching a `export_as` name. So I can see why a separate flag was introduced. 

The logic for adding linker flags in CodeGen omits these modules if this flag (`UseExportAsModuleLinkName`) is set, and that matching the intent behind this change here, I think it would make sense to model the same in the scanner. i.e. omit `LinkLibraries` of such module, because by the time we've discovered all the dependencies we are guaranteed to have the required knowledge to make this decision. 

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


More information about the cfe-commits mailing list