@@ -300,15 +300,13 @@ struct ModuleInterfaceLoaderOptions {
300300 bool disableImplicitSwiftModule = false ;
301301 bool disableBuildingInterface = false ;
302302 bool downgradeInterfaceVerificationError = false ;
303- bool ignoreInterfaceProvidedOptions = false ;
304303 std::string mainExecutablePath;
305304 ModuleInterfaceLoaderOptions (const FrontendOptions &Opts):
306305 remarkOnRebuildFromInterface (Opts.RemarkOnRebuildFromModuleInterface),
307306 disableInterfaceLock (Opts.DisableInterfaceFileLock),
308307 disableImplicitSwiftModule (Opts.DisableImplicitModules),
309308 disableBuildingInterface (Opts.DisableBuildingInterface),
310309 downgradeInterfaceVerificationError (Opts.DowngradeInterfaceVerificationError),
311- ignoreInterfaceProvidedOptions(Opts.IgnoreInterfaceProvidedOptions),
312310 mainExecutablePath(Opts.MainExecutablePath)
313311 {
314312 switch (Opts.RequestedAction ) {
@@ -442,6 +440,21 @@ class ModuleInterfaceLoader : public SerializedModuleLoaderBase {
442440 bool SerializeDependencyHashes,
443441 bool TrackSystemDependencies, ModuleInterfaceLoaderOptions Opts,
444442 RequireOSSAModules_t RequireOSSAModules);
443+
444+ // / Unconditionally build \p InPath (a swiftinterface file) to \p OutPath (as
445+ // / a swiftmodule file).
446+ // /
447+ // / Unlike the above `buildSwiftModuleFromSwiftInterface`, this method
448+ // / bypasses the instantiation of a `CompilerInstance` from the compiler
449+ // / configuration flags in the interface and instead directly uses the
450+ // / supplied \p Instance
451+ static bool buildExplicitSwiftModuleFromSwiftInterface (
452+ CompilerInstance &Instance, const StringRef moduleCachePath,
453+ const StringRef backupInterfaceDir, const StringRef prebuiltCachePath,
454+ const StringRef ABIDescriptorPath, StringRef interfacePath,
455+ StringRef outputPath, bool ShouldSerializeDeps,
456+ ArrayRef<std::string> CompiledCandidates,
457+ DependencyTracker *tracker = nullptr );
445458};
446459
447460struct InterfaceSubContextDelegateImpl : InterfaceSubContextDelegate {
@@ -460,13 +473,8 @@ struct InterfaceSubContextDelegateImpl: InterfaceSubContextDelegate {
460473 InFlightDiagnostic diagnose (StringRef interfacePath,
461474 SourceLoc diagnosticLoc,
462475 Diag<ArgTypes...> ID,
463- typename detail::PassArgument<ArgTypes>::type... Args) {
464- SourceLoc loc = diagnosticLoc;
465- if (diagnosticLoc.isInvalid ()) {
466- // Diagnose this inside the interface file, if possible.
467- loc = SM.getLocFromExternalSource (interfacePath, 1 , 1 );
468- }
469- return Diags->diagnose (loc, ID, std::move (Args)...);
476+ typename detail::PassArgument<ArgTypes>::type... Args) {
477+ return InterfaceSubContextDelegateImpl::diagnose (interfacePath, diagnosticLoc, SM, Diags, ID, std::move (Args)...);
470478 }
471479 void
472480 inheritOptionsForBuildingInterface (const SearchPathOptions &SearchPathOpts,
@@ -476,8 +484,7 @@ struct InterfaceSubContextDelegateImpl: InterfaceSubContextDelegate {
476484 SmallVectorImpl<const char *> &SubArgs,
477485 std::string &CompilerVersion,
478486 StringRef interfacePath,
479- SourceLoc diagnosticLoc,
480- bool ignoreInterfaceProvidedOptions);
487+ SourceLoc diagnosticLoc);
481488public:
482489 InterfaceSubContextDelegateImpl (
483490 SourceManager &SM, DiagnosticEngine *Diags,
@@ -488,19 +495,33 @@ struct InterfaceSubContextDelegateImpl: InterfaceSubContextDelegate {
488495 StringRef backupModuleInterfaceDir,
489496 bool serializeDependencyHashes, bool trackSystemDependencies,
490497 RequireOSSAModules_t requireOSSAModules);
498+
499+ template <typename ...ArgTypes>
500+ static InFlightDiagnostic diagnose (StringRef interfacePath,
501+ SourceLoc diagnosticLoc,
502+ SourceManager &SM,
503+ DiagnosticEngine *Diags,
504+ Diag<ArgTypes...> ID,
505+ typename detail::PassArgument<ArgTypes>::type... Args) {
506+ SourceLoc loc = diagnosticLoc;
507+ if (diagnosticLoc.isInvalid ()) {
508+ // Diagnose this inside the interface file, if possible.
509+ loc = SM.getLocFromExternalSource (interfacePath, 1 , 1 );
510+ }
511+ return Diags->diagnose (loc, ID, std::move (Args)...);
512+ }
513+
491514 std::error_code runInSubContext (StringRef moduleName,
492515 StringRef interfacePath,
493516 StringRef outputPath,
494517 SourceLoc diagLoc,
495- bool ignoreInterfaceProvidedOptions,
496518 llvm::function_ref<std::error_code(ASTContext&, ModuleDecl*,
497519 ArrayRef<StringRef>, ArrayRef<StringRef>,
498520 StringRef)> action) override ;
499521 std::error_code runInSubCompilerInstance (StringRef moduleName,
500522 StringRef interfacePath,
501523 StringRef outputPath,
502524 SourceLoc diagLoc,
503- bool ignoreInterfaceProvidedOptions,
504525 llvm::function_ref<std::error_code(SubCompilerInstanceInfo&)> action) override ;
505526
506527 ~InterfaceSubContextDelegateImpl () = default ;
0 commit comments