mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[cxx-interop] Always import cxx shim when cxx-interop is enabled (#60336)
This commit is contained in:
@@ -861,6 +861,14 @@ bool CompilerInstance::canImportSwiftStringProcessing() const {
|
||||
return getASTContext().canImportModule(modulePath);
|
||||
}
|
||||
|
||||
bool CompilerInstance::canImportCxxShim() const {
|
||||
ImportPath::Module::Builder builder(
|
||||
getASTContext().getIdentifier(CXX_SHIM_NAME));
|
||||
auto modulePath = builder.get();
|
||||
return getASTContext().canImportModule(modulePath) &&
|
||||
!Invocation.getFrontendOptions().InputsAndOutputs.hasModuleInterfaceOutputPath();
|
||||
}
|
||||
|
||||
ImplicitImportInfo CompilerInstance::getImplicitImportInfo() const {
|
||||
auto &frontendOpts = Invocation.getFrontendOptions();
|
||||
|
||||
@@ -915,6 +923,10 @@ ImplicitImportInfo CompilerInstance::getImplicitImportInfo() const {
|
||||
}
|
||||
}
|
||||
|
||||
if (Invocation.getLangOptions().EnableCXXInterop && canImportCxxShim()) {
|
||||
pushImport(CXX_SHIM_NAME);
|
||||
}
|
||||
|
||||
imports.ShouldImportUnderlyingModule = frontendOpts.ImportUnderlyingModule;
|
||||
imports.BridgingHeaderPath = frontendOpts.ImplicitObjCHeaderPath;
|
||||
return imports;
|
||||
|
||||
Reference in New Issue
Block a user