@@ -269,9 +269,11 @@ struct ExplicitClangModuleInputInfo {
269
269
ExplicitClangModuleInputInfo (
270
270
std::string moduleMapPath, std::string modulePath,
271
271
bool isFramework = false , bool isSystem = false ,
272
+ bool isBridgingHeaderDependency = true ,
272
273
std::optional<std::string> moduleCacheKey = std::nullopt)
273
274
: moduleMapPath(moduleMapPath), modulePath(modulePath),
274
275
isFramework (isFramework), isSystem(isSystem),
276
+ isBridgingHeaderDependency(isBridgingHeaderDependency),
275
277
moduleCacheKey(moduleCacheKey) {}
276
278
// Path of the Clang module map file.
277
279
std::string moduleMapPath;
@@ -281,6 +283,8 @@ struct ExplicitClangModuleInputInfo {
281
283
bool isFramework = false ;
282
284
// A flag that indicates whether this module is a system module
283
285
bool isSystem = false ;
286
+ // A flag that indicates whether this is a module dependency of a textual header input
287
+ bool isBridgingHeaderDependency = true ;
284
288
// The cache key for clang module.
285
289
std::optional<std::string> moduleCacheKey;
286
290
};
@@ -367,7 +371,12 @@ class ExplicitModuleMapParser {
367
371
swiftModuleSourceInfoPath, swiftModuleCacheKey, clangModuleCacheKey;
368
372
std::optional<std::vector<std::string>> headerDependencyPaths;
369
373
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 ;
371
380
for (auto &entry : *mapNode) {
372
381
auto key = getScalaNodeText (entry.getKey ());
373
382
if (key == " prebuiltHeaderDependencyPaths" ) {
@@ -394,6 +403,8 @@ class ExplicitModuleMapParser {
394
403
swiftModuleCacheKey = val.str ();
395
404
} else if (key == " clangModuleCacheKey" ) {
396
405
clangModuleCacheKey = val.str ();
406
+ } else if (key == " isBridgingHeaderDependency" ) {
407
+ isBridgingHeaderDependency = parseBoolValue (val);
397
408
} else {
398
409
// Being forgiving for future fields.
399
410
continue ;
@@ -423,6 +434,7 @@ class ExplicitModuleMapParser {
423
434
clangModulePath,
424
435
isFramework,
425
436
isSystem,
437
+ isBridgingHeaderDependency,
426
438
clangModuleCacheKey);
427
439
clangModuleMap.try_emplace (moduleName, std::move (entry));
428
440
}
0 commit comments