Skip to content

Commit e72629d

Browse files
Merge pull request swiftlang#32771 from varungandhi-apple/vg-include-spi-deps-in-trace
Include SPI dependencies in module trace.
2 parents 54baf04 + 7c36683 commit e72629d

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

lib/FrontendTool/FrontendTool.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ static bool emitLoadedModuleTraceIfNeeded(ModuleDecl *mainModule,
427427
ModuleDecl::ImportFilter filter = ModuleDecl::ImportFilterKind::Public;
428428
filter |= ModuleDecl::ImportFilterKind::Private;
429429
filter |= ModuleDecl::ImportFilterKind::ImplementationOnly;
430+
filter |= ModuleDecl::ImportFilterKind::SPIAccessControl;
430431
filter |= ModuleDecl::ImportFilterKind::ShadowedBySeparateOverlay;
431432
SmallVector<ModuleDecl::ImportedModule, 8> imports;
432433
mainModule->getImportedModules(imports, filter);
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-build-swift %s -emit-module -module-name Module0 -DSPI_DECLARING_MODULE -o %t/Module0.swiftmodule
3+
// RUN: %target-build-swift %s -module-name Module1 -DSPI_IMPORTING_MODULE -emit-loaded-module-trace -o %t/spi_import -I %t
4+
// RUN: %FileCheck %s < %t/Module1.trace.json
5+
6+
#if SPI_DECLARING_MODULE
7+
8+
@_spi(ForModule1)
9+
public func f() {}
10+
11+
#endif
12+
13+
#if SPI_IMPORTING_MODULE
14+
15+
@_spi(ForModule1)
16+
import Module0
17+
18+
#endif
19+
20+
// CHECK: "name":"Module0","path":"{{[^"]*}}","isImportedDirectly":true

0 commit comments

Comments
 (0)