Skip to content

Commit

Permalink
[Modules] Make SubInstance spawn correctly under DirectCC1Mode
Browse files Browse the repository at this point in the history
Make sure ClangExtraArgs are inherited in the subinstance for module
lookup/building when direct cc1 mode is used. This is useful for lldb,
which does a slight different variant of the explicit module build
that do not have swift-driver cooridination and replies on the
subInstance to load swiftmodule. When such configuration is used, if
DirectCC1 compile option is inherited without any extra cc1 arguments,
the clang importer inside the sub-instance is actually malformed,
causing the swift instance failed to be created.

rdar://135611011

fixup
  • Loading branch information
cachemeifyoucan committed Sep 10, 2024
1 parent 863d2e4 commit ee45f6d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/Frontend/ModuleInterfaceLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1953,9 +1953,13 @@ InterfaceSubContextDelegateImpl::InterfaceSubContextDelegateImpl(
genericSubInvocation.getFrontendOptions()
.DependencyScanningSubInvocation = true;
} else if (LoaderOpts.strictImplicitModuleContext ||
// Explicit module Interface verification jobs still spawn a sub-instance
// and we must ensure this sub-instance gets all of the Xcc flags.
LoaderOpts.disableImplicitSwiftModule) {
// Explicit module Interface verification jobs still spawn a
// sub-instance and we must ensure this sub-instance gets all of
// the Xcc flags.
LoaderOpts.disableImplicitSwiftModule ||
// If using direct cc1 argument mode for lldb or typecheck
// interface, inherit all clang arguments.
clangImporterOpts.DirectClangCC1ModuleBuild) {
// If the compiler has been asked to be strict with ensuring downstream
// dependencies get the parent invocation's context, inherit the extra Clang
// arguments also. Inherit any clang-specific state of the compilation
Expand Down

0 comments on commit ee45f6d

Please sign in to comment.