mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #61919 from artemcm/InheritExtraClangStateForInterfaceSubInvocation
Inherit parent's extra Clang arguments when creating an interface build sub-invocation.
This commit is contained in:
@@ -1598,18 +1598,11 @@ InterfaceSubContextDelegateImpl::InterfaceSubContextDelegateImpl(
|
||||
subClangImporterOpts.DetailedPreprocessingRecord =
|
||||
clangImporterOpts.DetailedPreprocessingRecord;
|
||||
|
||||
// We need to add these extra clang flags because explicit module building
|
||||
// related flags are all there: -fno-implicit-modules, -fmodule-map-file=,
|
||||
// and -fmodule-file=.
|
||||
// If we don't add these flags, the interface will be built with implicit
|
||||
// PCMs.
|
||||
// FIXME: With Implicit Module Builds, if sub-invocations inherit `-fmodule-map-file=` options,
|
||||
// those modulemaps become File dependencies of all downstream PCMs and their depending Swift
|
||||
// modules, triggering unnecessary re-builds. We work around this by only inheriting these options
|
||||
// when building with explicit modules. While this problem will not manifest with Explicit Modules
|
||||
// (which do not use the ClangImporter to build PCMs), we may still need a better way to
|
||||
// decide which options must be inherited here.
|
||||
if (LoaderOpts.disableImplicitSwiftModule) {
|
||||
// If the compiler has been asked to be strict with ensuring downstream dependencies
|
||||
// get the parent invocation's context, or this is an Explicit build, inherit the
|
||||
// extra Clang arguments also.
|
||||
if (LoaderOpts.strictImplicitModuleContext || LoaderOpts.disableImplicitSwiftModule) {
|
||||
// Inherit any clang-specific state of the compilation (macros, clang flags, etc.)
|
||||
subClangImporterOpts.ExtraArgs = clangImporterOpts.ExtraArgs;
|
||||
for (auto arg : subClangImporterOpts.ExtraArgs) {
|
||||
GenericArgs.push_back("-Xcc");
|
||||
|
||||
Reference in New Issue
Block a user