mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Allow Clang modules to be listed in the explicit module map.
This lets users of `-explicit-swift-module-map-file` use a single mapping for all module dependencies, regardless of whether they're Swift or Clang modules, instead of manually splitting them among this file and command line flags.
This commit is contained in:
@@ -173,19 +173,24 @@ public:
|
||||
~ExplicitSwiftModuleLoader();
|
||||
};
|
||||
|
||||
/// Information about explicitly specified Swift module files.
|
||||
/// Information about explicitly specified Swift and Clang module files.
|
||||
struct ExplicitModuleInfo {
|
||||
// Path of the .swiftmodule file.
|
||||
// Path of the .swiftmodule file. Empty for pure Clang modules.
|
||||
std::string modulePath;
|
||||
// Path of the .swiftmoduledoc file.
|
||||
// Path of the .swiftmoduledoc file. Empty for pure Clang modules.
|
||||
std::string moduleDocPath;
|
||||
// Path of the .swiftsourceinfo file.
|
||||
// Path of the .swiftsourceinfo file. Empty for pure Clang modules.
|
||||
std::string moduleSourceInfoPath;
|
||||
// A flag that indicates whether this module is a framework
|
||||
bool isFramework = false;
|
||||
// A flag that indicates whether this module is a system module
|
||||
// Set the default to be false.
|
||||
bool isSystem = false;
|
||||
// Path of the Clang module map file. Empty for pure Swift modules.
|
||||
std::string clangModuleMapPath;
|
||||
// Path of a compiled Clang explicit module file. Empty for pure Swift
|
||||
// modules.
|
||||
std::string clangModulePath;
|
||||
};
|
||||
|
||||
/// Parser of explicit module maps passed into the compiler.
|
||||
@@ -194,15 +199,19 @@ struct ExplicitModuleInfo {
|
||||
// "moduleName": "A",
|
||||
// "modulePath": "A.swiftmodule",
|
||||
// "docPath": "A.swiftdoc",
|
||||
// "sourceInfoPath": "A.swiftsourceinfo"
|
||||
// "isFramework": false
|
||||
// "sourceInfoPath": "A.swiftsourceinfo",
|
||||
// "isFramework": false,
|
||||
// "clangModuleMapPath": "A/module.modulemap",
|
||||
// "clangModulePath": "A.pcm",
|
||||
// },
|
||||
// {
|
||||
// "moduleName": "B",
|
||||
// "modulePath": "B.swiftmodule",
|
||||
// "docPath": "B.swiftdoc",
|
||||
// "sourceInfoPath": "B.swiftsourceinfo"
|
||||
// "isFramework": false
|
||||
// "sourceInfoPath": "B.swiftsourceinfo",
|
||||
// "isFramework": false,
|
||||
// "clangModuleMapPath": "B/module.modulemap",
|
||||
// "clangModulePath": "B.pcm",
|
||||
// }
|
||||
// ]
|
||||
class ExplicitModuleMapParser {
|
||||
@@ -279,6 +288,10 @@ private:
|
||||
result.isFramework = parseBoolValue(val);
|
||||
} else if (key == "isSystem") {
|
||||
result.isSystem = parseBoolValue(val);
|
||||
} else if (key == "clangModuleMapPath") {
|
||||
result.clangModuleMapPath = val.str();
|
||||
} else if (key == "clangModulePath") {
|
||||
result.clangModulePath = val.str();
|
||||
} else {
|
||||
// Being forgiving for future fields.
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user