[Macro] Fix bugs in macro dependency scanning

Fix few issues from previous implementation from explicit module build
with macros and accurate macro dependency scanning in
https://github.com/swiftlang/swift/pull/73421.

First, there is a crash when propagating the macro dependencies. It
turns out that the current macro plugin implementation doesn't need the
downstream users to know about the plugin search path from the upstream
dependencies.

Secondly, fix a bug that the swiftinterface that has macro usage won't
build because the build command doesn't inherit the plugin search path
option.

Finally, add JSON output for macro dependencies so it is easier to
debug the macro dependencies.

rdar://131214106
This commit is contained in:
Steven Wu
2024-07-08 15:08:19 -07:00
parent 4e4d547825
commit da10a02231
9 changed files with 252 additions and 16 deletions

View File

@@ -305,7 +305,7 @@ bool ModuleDependenciesCacheDeserializer::readGraph(SwiftDependencyScanningServi
if (!moduleCacheKeyID)
llvm::report_fatal_error("Bad moduleCacheKey");
// TODO: LinkLibraries
// TODO: LinkLibraries, MacroDependencies
// Form the dependencies storage object
auto moduleDep = ModuleDependencyInfo::forSwiftInterfaceModule(
outputModulePath.value(), optionalSwiftInterfaceFile.value(),