Skip to content

Commit 68c9ee3

Browse files
[GeneratePCH] Don't assert when libSwiftScan is not initialized
Do not assert if libSwiftScan is not initialized when querying PCH generation feature. If libSwiftScan is not initialized, then the feature is not available so just return false for not available. rdar://141554457
1 parent ad97b40 commit 68c9ee3

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

Sources/SwiftDriver/ExplicitModuleBuilds/ExplicitDependencyBuildPlanner.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ public typealias ExternalTargetModuleDetailsMap = [ModuleDependencyId: ExternalT
7979
}
8080

8181
/// Supports resolving bridging header pch command from swiftScan.
82-
public func supportsBridgingHeaderPCHCommand() throws -> Bool {
83-
return try swiftScanOracle.supportsBridgingHeaderPCHCommand()
82+
public var supportsBridgingHeaderPCHCommand: Bool {
83+
return swiftScanOracle.supportsBridgingHeaderPCHCommand
8484
}
8585

8686
/// Generate build jobs for all dependencies of the main module.

Sources/SwiftDriver/ExplicitModuleBuilds/InterModuleDependencies/InterModuleDependencyOracle.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,10 @@ public class InterModuleDependencyOracle {
118118
return swiftScan.supportsBinaryModuleHeaderDependencies || swiftScan.supportsBinaryModuleHeaderDependency
119119
}
120120

121-
@_spi(Testing) public func supportsBridgingHeaderPCHCommand() throws -> Bool {
121+
@_spi(Testing) public var supportsBridgingHeaderPCHCommand: Bool {
122122
guard let swiftScan = swiftScanLibInstance else {
123-
fatalError("Attempting to query supported scanner API with no scanner instance.")
123+
// If no scanner, feature is not supported.
124+
return false
124125
}
125126
return swiftScan.supportsBridgingHeaderPCHCommand
126127
}

Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -852,8 +852,8 @@ extension Driver {
852852

853853

854854
/// If explicit dependency planner supports creating bridging header pch command.
855-
public func supportsBridgingHeaderPCHCommand() throws -> Bool {
856-
return try explicitDependencyBuildPlanner?.supportsBridgingHeaderPCHCommand() ?? false
855+
public var supportsBridgingHeaderPCHCommand: Bool {
856+
return explicitDependencyBuildPlanner?.supportsBridgingHeaderPCHCommand ?? false
857857
}
858858

859859
/// In Explicit Module Build mode, distinguish between main module jobs and intermediate dependency build jobs,

Sources/SwiftDriver/Jobs/GeneratePCHJob.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ extension Driver {
3030

3131
var commandLine: [Job.ArgTemplate] = swiftCompilerPrefixArgs.map { Job.ArgTemplate.flag($0) }
3232

33-
if try supportsBridgingHeaderPCHCommand() {
33+
if supportsBridgingHeaderPCHCommand {
3434
try addExplicitPCHBuildArguments(inputs: &inputs, commandLine: &commandLine)
3535
addCacheReplayMapping(to: &commandLine)
3636
} else {

0 commit comments

Comments
 (0)