[Macro][Dependencies] Properly model macro dependencies in the scanner

Add function to handle all macro dependencies kinds in the scanner,
including taking care of the macro definitions in the module interface
for its client to use. The change involves:
  * Encode the macro definition inside the binary module
  * Resolve macro modules in the dependencies scanners, including those
    declared inside the dependency modules.
  * Propagate the macro defined from the direct dependencies to track
    all the potentially available modules inside a module compilation.
This commit is contained in:
Steven Wu
2024-09-19 10:57:08 -07:00
parent b9dc764541
commit e0541b0357
20 changed files with 326 additions and 56 deletions

View File

@@ -184,6 +184,9 @@ private:
/// modules.
std::vector<serialization::SearchPath> SearchPaths;
/// The external macro plugins from the macro definition inside the module.
SmallVector<ExternalMacroPlugin, 4> MacroModuleNames;
/// Info for the (lone) imported header for this module.
struct {
off_t fileSize;
@@ -634,6 +637,11 @@ public:
return UserModuleVersion;
}
/// Get external macro names.
ArrayRef<ExternalMacroPlugin> getExternalMacros() const {
return MacroModuleNames;
}
/// If the module-defining `.swiftinterface` file is an SDK-relative path,
/// resolve it to be absolute to the specified SDK.
std::string resolveModuleDefiningFilePath(const StringRef SDKPath) const;