@@ -1873,17 +1873,21 @@ InterfaceSubContextDelegateImpl::InterfaceSubContextDelegateImpl(
1873
1873
if (LoaderOpts.requestedAction ==
1874
1874
FrontendOptions::ActionType::ScanDependencies) {
1875
1875
// 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
1878
1877
// `ClangImporter`. However, we can ignore Clang search path flags because
1879
1878
// explicit Swift module build tasks will not rely on them and they may be
1880
1879
// source-target-context-specific and hinder module sharing across
1881
1880
// 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 ();
1887
1891
genericSubInvocation.getFrontendOptions ()
1888
1892
.DependencyScanningSubInvocation = true ;
1889
1893
} else if (LoaderOpts.strictImplicitModuleContext ||
0 commit comments