@@ -311,20 +311,40 @@ struct ModuleInterfaceLoaderOptions {
311
311
ModuleInterfaceLoaderOptions () = default ;
312
312
};
313
313
314
+ // / Strongly typed enum that represents if we require all SILModules to have
315
+ // / OSSA modules emitted. This is implemented by incorporating this bit into the
316
+ // / module cache hash.
317
+ struct RequireOSSAModules_t {
318
+ enum ValueTy {
319
+ No = 0 ,
320
+ Yes = 1 ,
321
+ };
322
+
323
+ ValueTy value;
324
+
325
+ RequireOSSAModules_t (const SILOptions &opts)
326
+ : value(opts.EnableOSSAModules ? RequireOSSAModules_t::Yes
327
+ : RequireOSSAModules_t::No) {}
328
+
329
+ operator ValueTy () const { return value; }
330
+ explicit operator bool () const { return bool (value); }
331
+ };
332
+
314
333
class ModuleInterfaceCheckerImpl : public ModuleInterfaceChecker {
315
334
friend class ModuleInterfaceLoader ;
316
335
ASTContext &Ctx;
317
336
std::string CacheDir;
318
337
std::string PrebuiltCacheDir;
319
338
ModuleInterfaceLoaderOptions Opts;
339
+ RequireOSSAModules_t RequiresOSSAModules;
320
340
321
341
public:
322
- explicit ModuleInterfaceCheckerImpl (ASTContext &Ctx,
323
- StringRef cacheDir,
342
+ explicit ModuleInterfaceCheckerImpl (ASTContext &Ctx, StringRef cacheDir,
324
343
StringRef prebuiltCacheDir,
325
- ModuleInterfaceLoaderOptions Opts)
326
- : Ctx(Ctx), CacheDir(cacheDir), PrebuiltCacheDir(prebuiltCacheDir),
327
- Opts(Opts) {}
344
+ ModuleInterfaceLoaderOptions opts,
345
+ RequireOSSAModules_t requiresOSSAModules)
346
+ : Ctx(Ctx), CacheDir(cacheDir), PrebuiltCacheDir(prebuiltCacheDir),
347
+ Opts(opts), RequiresOSSAModules(requiresOSSAModules) {}
328
348
329
349
std::vector<std::string>
330
350
getCompiledModuleCandidatesForInterface (StringRef moduleName,
@@ -390,13 +410,13 @@ class ModuleInterfaceLoader : public SerializedModuleLoaderBase {
390
410
// /
391
411
// / A simplified version of the core logic in #openModuleFiles.
392
412
static bool buildSwiftModuleFromSwiftInterface (
393
- SourceManager &SourceMgr, DiagnosticEngine &Diags,
394
- const SearchPathOptions &SearchPathOpts, const LangOptions &LangOpts,
395
- const ClangImporterOptions &ClangOpts,
396
- StringRef CacheDir , StringRef PrebuiltCacheDir ,
397
- StringRef ModuleName, StringRef InPath, StringRef OutPath ,
398
- bool SerializeDependencyHashes, bool TrackSystemDependencies,
399
- ModuleInterfaceLoaderOptions Opts );
413
+ SourceManager &SourceMgr, DiagnosticEngine &Diags,
414
+ const SearchPathOptions &SearchPathOpts, const LangOptions &LangOpts,
415
+ const ClangImporterOptions &ClangOpts, StringRef CacheDir ,
416
+ StringRef PrebuiltCacheDir , StringRef ModuleName, StringRef InPath ,
417
+ StringRef OutPath, bool SerializeDependencyHashes ,
418
+ bool TrackSystemDependencies, ModuleInterfaceLoaderOptions Opts ,
419
+ RequireOSSAModules_t RequireOSSAModules );
400
420
};
401
421
402
422
struct InterfaceSubContextDelegateImpl : InterfaceSubContextDelegate {
@@ -420,25 +440,24 @@ struct InterfaceSubContextDelegateImpl: InterfaceSubContextDelegate {
420
440
}
421
441
return Diags.diagnose (loc, ID, std::move (Args)...);
422
442
}
423
- void inheritOptionsForBuildingInterface (const SearchPathOptions &SearchPathOpts,
424
- const LangOptions &LangOpts);
443
+ void
444
+ inheritOptionsForBuildingInterface (const SearchPathOptions &SearchPathOpts,
445
+ const LangOptions &LangOpts,
446
+ RequireOSSAModules_t requireOSSAModules);
425
447
bool extractSwiftInterfaceVersionAndArgs (CompilerInvocation &subInvocation,
426
448
SmallVectorImpl<const char *> &SubArgs,
427
449
std::string &CompilerVersion,
428
450
StringRef interfacePath,
429
451
SourceLoc diagnosticLoc);
430
452
public:
431
- InterfaceSubContextDelegateImpl (SourceManager &SM,
432
- DiagnosticEngine &Diags,
433
- const SearchPathOptions &searchPathOpts,
434
- const LangOptions &langOpts,
435
- const ClangImporterOptions &clangImporterOpts,
436
- ModuleInterfaceLoaderOptions LoaderOpts,
437
- bool buildModuleCacheDirIfAbsent,
438
- StringRef moduleCachePath,
439
- StringRef prebuiltCachePath,
440
- bool serializeDependencyHashes,
441
- bool trackSystemDependencies);
453
+ InterfaceSubContextDelegateImpl (
454
+ SourceManager &SM, DiagnosticEngine &Diags,
455
+ const SearchPathOptions &searchPathOpts, const LangOptions &langOpts,
456
+ const ClangImporterOptions &clangImporterOpts,
457
+ ModuleInterfaceLoaderOptions LoaderOpts, bool buildModuleCacheDirIfAbsent,
458
+ StringRef moduleCachePath, StringRef prebuiltCachePath,
459
+ bool serializeDependencyHashes, bool trackSystemDependencies,
460
+ RequireOSSAModules_t requireOSSAModules);
442
461
std::error_code runInSubContext (StringRef moduleName,
443
462
StringRef interfacePath,
444
463
StringRef outputPath,
0 commit comments