mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[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:
@@ -115,6 +115,8 @@ ModuleFile::ModuleFile(std::shared_ptr<const ModuleFileSharedCore> core)
|
||||
Dependencies.emplace_back(coreDep);
|
||||
}
|
||||
|
||||
MacroModuleNames = core->MacroModuleNames;
|
||||
|
||||
// `ModuleFileSharedCore` has immutable data, we copy these into `ModuleFile`
|
||||
// so we can mutate the arrays and replace the offsets with AST object
|
||||
// pointers as we lazily deserialize them.
|
||||
@@ -533,6 +535,11 @@ void ModuleFile::getImportedModules(SmallVectorImpl<ImportedModule> &results,
|
||||
}
|
||||
}
|
||||
|
||||
void ModuleFile::getExternalMacros(
|
||||
SmallVectorImpl<ExternalMacroPlugin> ¯os) {
|
||||
macros = MacroModuleNames;
|
||||
}
|
||||
|
||||
void ModuleFile::getImportDecls(SmallVectorImpl<Decl *> &Results) {
|
||||
if (!Bits.ComputedImportDecls) {
|
||||
ASTContext &Ctx = getContext();
|
||||
|
||||
Reference in New Issue
Block a user