mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Always add an implicit import of 'Cxx' module when C++ Interop is enabled.
We cannot always rely on being able to do so only as an overlay query upon loading 'requires cplusplus' modulemap modules. The 'requires' statement only applies to submodules, and we may not be able to query language feature modulemap attributes in dependency scanning context.
This commit is contained in:
@@ -392,7 +392,7 @@ std::error_code SerializedModuleLoaderBase::openModuleFile(
|
||||
return std::error_code();
|
||||
}
|
||||
|
||||
SerializedModuleLoaderBase::BinaryModuleImports
|
||||
llvm::ErrorOr<SerializedModuleLoaderBase::BinaryModuleImports>
|
||||
SerializedModuleLoaderBase::getImportsOfModule(
|
||||
const ModuleFileSharedCore &loadedModuleFile,
|
||||
ModuleLoadingBehavior transitiveBehavior, StringRef packageName,
|
||||
@@ -484,7 +484,7 @@ SerializedModuleLoaderBase::scanModuleFile(Twine modulePath, bool isFramework,
|
||||
getImportsOfModule(*loadedModuleFile, ModuleLoadingBehavior::Optional,
|
||||
Ctx.LangOpts.PackageName, isTestableImport);
|
||||
|
||||
auto importedModuleSet = binaryModuleImports.moduleImports;
|
||||
auto importedModuleSet = binaryModuleImports->moduleImports;
|
||||
std::vector<std::string> importedModuleNames;
|
||||
importedModuleNames.reserve(importedModuleSet.size());
|
||||
llvm::transform(importedModuleSet.keys(),
|
||||
@@ -493,8 +493,8 @@ SerializedModuleLoaderBase::scanModuleFile(Twine modulePath, bool isFramework,
|
||||
return N.str();
|
||||
});
|
||||
|
||||
auto importedHeader = binaryModuleImports.headerImport;
|
||||
auto &importedOptionalModuleSet = binaryModuleOptionalImports.moduleImports;
|
||||
auto importedHeader = binaryModuleImports->headerImport;
|
||||
auto &importedOptionalModuleSet = binaryModuleOptionalImports->moduleImports;
|
||||
std::vector<std::string> importedOptionalModuleNames;
|
||||
for (const auto optionalImportedModule : importedOptionalModuleSet.keys())
|
||||
if (!importedModuleSet.contains(optionalImportedModule))
|
||||
|
||||
Reference in New Issue
Block a user