@@ -309,27 +309,52 @@ struct ModuleInterfaceLoaderOptions {
309309  ModuleInterfaceLoaderOptions () = default ;
310310};
311311
312+ class  ModuleInterfaceCheckerImpl : public  ModuleInterfaceChecker  {
313+   friend  class  ModuleInterfaceLoader ;
314+   ASTContext &Ctx;
315+   std::string CacheDir;
316+   std::string PrebuiltCacheDir;
317+   ModuleInterfaceLoaderOptions Opts;
318+ 
319+ public: 
320+   explicit  ModuleInterfaceCheckerImpl (ASTContext &Ctx,
321+                                       StringRef cacheDir,
322+                                       StringRef prebuiltCacheDir,
323+                                       ModuleInterfaceLoaderOptions Opts)
324+   : Ctx(Ctx), CacheDir(cacheDir), PrebuiltCacheDir(prebuiltCacheDir),
325+     Opts(Opts) {}
326+ 
327+   std::vector<std::string>
328+   getCompiledModuleCandidatesForInterface (StringRef moduleName,
329+                                           StringRef interfacePath) override ;
330+ 
331+   // / Given a list of potential ready-to-use compiled modules for \p interfacePath,
332+   // / check if any one of them is up-to-date. If so, emit a forwarding module
333+   // / to the candidate binary module to \p outPath.
334+   bool  tryEmitForwardingModule (StringRef moduleName,
335+                                StringRef interfacePath,
336+                                ArrayRef<std::string> candidates,
337+                                StringRef outPath) override ;
338+   bool  isCached (StringRef DepPath);
339+ };
340+ 
312341// / A ModuleLoader that runs a subordinate \c CompilerInvocation and
313342// / \c CompilerInstance to convert .swiftinterface files to .swiftmodule
314343// / files on the fly, caching the resulting .swiftmodules in the module cache
315344// / directory, and loading the serialized .swiftmodules from there.
316345class  ModuleInterfaceLoader  : public  SerializedModuleLoaderBase  {
317346  friend  class  unittest ::ModuleInterfaceLoaderTest;
318347  explicit  ModuleInterfaceLoader (
319-       ASTContext &ctx, StringRef cacheDir, StringRef prebuiltCacheDir ,
348+       ASTContext &ctx, ModuleInterfaceCheckerImpl &InterfaceChecker ,
320349      DependencyTracker *tracker, ModuleLoadingMode loadMode,
321350      ArrayRef<std::string> PreferInterfaceForModules,
322-       bool  IgnoreSwiftSourceInfoFile, ModuleInterfaceLoaderOptions Opts)
323-   : SerializedModuleLoaderBase(ctx, tracker, loadMode,
324-                                IgnoreSwiftSourceInfoFile),
325-   CacheDir(cacheDir), PrebuiltCacheDir(prebuiltCacheDir),
326-   PreferInterfaceForModules(PreferInterfaceForModules),
327-   Opts(Opts) {}
351+       bool  IgnoreSwiftSourceInfoFile)
352+   : SerializedModuleLoaderBase(ctx, tracker, loadMode, IgnoreSwiftSourceInfoFile),
353+     InterfaceChecker(InterfaceChecker),
354+     PreferInterfaceForModules(PreferInterfaceForModules){}
328355
329-   std::string CacheDir;
330-   std::string PrebuiltCacheDir;
356+   ModuleInterfaceCheckerImpl &InterfaceChecker;
331357  ArrayRef<std::string> PreferInterfaceForModules;
332-   ModuleInterfaceLoaderOptions Opts;
333358
334359  std::error_code findModuleFilesInDirectory (
335360     ImportPath::Element ModuleID,
@@ -343,17 +368,14 @@ class ModuleInterfaceLoader : public SerializedModuleLoaderBase {
343368  bool  isCached (StringRef DepPath) override ;
344369public: 
345370  static  std::unique_ptr<ModuleInterfaceLoader>
346-   create (ASTContext &ctx, StringRef cacheDir, StringRef prebuiltCacheDir ,
371+   create (ASTContext &ctx, ModuleInterfaceCheckerImpl &InterfaceChecker ,
347372         DependencyTracker *tracker, ModuleLoadingMode loadMode,
348373         ArrayRef<std::string> PreferInterfaceForModules = {},
349-          ModuleInterfaceLoaderOptions Opts = ModuleInterfaceLoaderOptions(),
350374         bool  IgnoreSwiftSourceInfoFile = false ) {
351375    return  std::unique_ptr<ModuleInterfaceLoader>(
352-       new  ModuleInterfaceLoader (ctx, cacheDir, prebuiltCacheDir,
353-                                          tracker, loadMode,
354-                                          PreferInterfaceForModules,
355-                                          IgnoreSwiftSourceInfoFile,
356-                                          Opts));
376+       new  ModuleInterfaceLoader (ctx, InterfaceChecker, tracker, loadMode,
377+                                 PreferInterfaceForModules,
378+                                 IgnoreSwiftSourceInfoFile));
357379  }
358380
359381  // / Append visible module names to \p names. Note that names are possibly
@@ -373,18 +395,6 @@ class ModuleInterfaceLoader : public SerializedModuleLoaderBase {
373395    StringRef ModuleName, StringRef InPath, StringRef OutPath,
374396    bool  SerializeDependencyHashes, bool  TrackSystemDependencies,
375397    ModuleInterfaceLoaderOptions Opts);
376- 
377-   std::vector<std::string>
378-   getCompiledModuleCandidatesForInterface (StringRef moduleName,
379-                                           StringRef interfacePath) override ;
380- 
381-   // / Given a list of potential ready-to-use compiled modules for \p interfacePath,
382-   // / check if any one of them is up-to-date. If so, emit a forwarding module
383-   // / to the candidate binary module to \p outPath.
384-   bool  tryEmitForwardingModule (StringRef moduleName,
385-                                StringRef interfacePath,
386-                                ArrayRef<std::string> candidates,
387-                                StringRef outPath) override ;
388398};
389399
390400struct  InterfaceSubContextDelegateImpl : InterfaceSubContextDelegate {
0 commit comments