@@ -269,9 +269,11 @@ struct ExplicitClangModuleInputInfo {
269269 ExplicitClangModuleInputInfo (
270270 std::string moduleMapPath, std::string modulePath,
271271 bool isFramework = false , bool isSystem = false ,
272+ bool isBridgingHeaderDependency = true ,
272273 std::optional<std::string> moduleCacheKey = std::nullopt )
273274 : moduleMapPath(moduleMapPath), modulePath(modulePath),
274275 isFramework (isFramework), isSystem(isSystem),
276+ isBridgingHeaderDependency(isBridgingHeaderDependency),
275277 moduleCacheKey(moduleCacheKey) {}
276278 // Path of the Clang module map file.
277279 std::string moduleMapPath;
@@ -281,6 +283,8 @@ struct ExplicitClangModuleInputInfo {
281283 bool isFramework = false ;
282284 // A flag that indicates whether this module is a system module
283285 bool isSystem = false ;
286+ // A flag that indicates whether this is a module dependency of a textual header input
287+ bool isBridgingHeaderDependency = true ;
284288 // The cache key for clang module.
285289 std::optional<std::string> moduleCacheKey;
286290};
@@ -367,7 +371,12 @@ class ExplicitModuleMapParser {
367371 swiftModuleSourceInfoPath, swiftModuleCacheKey, clangModuleCacheKey;
368372 std::optional<std::vector<std::string>> headerDependencyPaths;
369373 std::string clangModuleMapPath = " " , clangModulePath = " " ;
370- bool isFramework = false , isSystem = false ;
374+ bool isFramework = false , isSystem = false ,
375+ // The default value is 'true' in case the build system does not yet
376+ // support emitting this field, in which case we must be conservative and
377+ // ensure all dependencies get '-fmodule-map-file', instead of strictly
378+ // module dependencies of textual header inputs.
379+ isBridgingHeaderDependency = true ;
371380 for (auto &entry : *mapNode) {
372381 auto key = getScalaNodeText (entry.getKey ());
373382 if (key == " prebuiltHeaderDependencyPaths" ) {
@@ -394,6 +403,8 @@ class ExplicitModuleMapParser {
394403 swiftModuleCacheKey = val.str ();
395404 } else if (key == " clangModuleCacheKey" ) {
396405 clangModuleCacheKey = val.str ();
406+ } else if (key == " isBridgingHeaderDependency" ) {
407+ isBridgingHeaderDependency = parseBoolValue (val);
397408 } else {
398409 // Being forgiving for future fields.
399410 continue ;
@@ -423,6 +434,7 @@ class ExplicitModuleMapParser {
423434 clangModulePath,
424435 isFramework,
425436 isSystem,
437+ isBridgingHeaderDependency,
426438 clangModuleCacheKey);
427439 clangModuleMap.try_emplace (moduleName, std::move (entry));
428440 }
0 commit comments