@@ -1873,17 +1873,21 @@ InterfaceSubContextDelegateImpl::InterfaceSubContextDelegateImpl(
18731873 if (LoaderOpts.requestedAction ==
18741874 FrontendOptions::ActionType::ScanDependencies) {
18751875 // For a dependency scanning action, interface build command generation must
1876- // inherit
1877- // `-Xcc` flags used for configuration of the building instance's
1876+ // inherit `-Xcc` flags used for configuration of the building instance's
18781877 // `ClangImporter`. However, we can ignore Clang search path flags because
18791878 // explicit Swift module build tasks will not rely on them and they may be
18801879 // source-target-context-specific and hinder module sharing across
18811880 // compilation source targets.
1882- // Clang module dependecies of this Swift dependency will be distinguished by
1883- // their context hash for different variants, so would still cause a difference
1884- // in the Swift compile commands, when different.
1885- inheritedParentContextClangArgs =
1886- clangImporterOpts.getReducedExtraArgsForSwiftModuleDependency ();
1881+ // If using DirectCC1Scan, the command-line reduction is handled inside
1882+ // `getSwiftExplicitModuleDirectCC1Args()`, there is no need to inherit
1883+ // anything here as the ExtraArgs from the invocation are clang driver
1884+ // options, not cc1 options.
1885+ // Clang module dependecies of this Swift dependency will be distinguished
1886+ // by their context hash for different variants, so would still cause a
1887+ // difference in the Swift compile commands, when different.
1888+ if (!clangImporterOpts.ClangImporterDirectCC1Scan )
1889+ inheritedParentContextClangArgs =
1890+ clangImporterOpts.getReducedExtraArgsForSwiftModuleDependency ();
18871891 genericSubInvocation.getFrontendOptions ()
18881892 .DependencyScanningSubInvocation = true ;
18891893 } else if (LoaderOpts.strictImplicitModuleContext ||
@@ -2610,7 +2614,7 @@ bool ExplicitCASModuleLoader::findModule(
26102614 // that are not located on disk.
26112615 auto moduleBuf = loadCachedCompileResultFromCacheKey (
26122616 Impl.CAS , Impl.Cache , Ctx.Diags , moduleCASID,
2613- file_types::ID::TY_SwiftModuleFile);
2617+ file_types::ID::TY_SwiftModuleFile, moduleInfo. modulePath );
26142618 if (!moduleBuf) {
26152619 // We cannot read the module content, diagnose.
26162620 Ctx.Diags .diagnose (SourceLoc (), diag::error_opening_explicit_module_file,
0 commit comments