Skip to content

Commit 79def2a

Browse files
committed
Attempt to recover from in-process Supported Feature query failures.
Catch thrown exceptions and fallback to the previous mechanism of shelling out a `swift-frontend -emit-supported-features` task. We are seeing spurious failures here and this will help potential users while we investigate the root cause. Workaround for rdar://105559904
1 parent 75a69f1 commit 79def2a

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

Sources/SwiftDriver/Jobs/EmitSupportedFeaturesJob.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,13 @@ extension Driver {
6464
fileSystem: FileSystem,
6565
executor: DriverExecutor)
6666
throws -> Set<String> {
67-
if let supportedArgs =
68-
try querySupportedCompilerArgsInProcess(of: toolchain, fileSystem: fileSystem) {
69-
return supportedArgs
67+
do {
68+
if let supportedArgs =
69+
try querySupportedCompilerArgsInProcess(of: toolchain, fileSystem: fileSystem) {
70+
return supportedArgs
71+
}
72+
} catch {
73+
diagnosticsEngine.emit(.warning_inprocess_supported_features_query_failed(error.localizedDescription))
7074
}
7175

7276
// Fallback: Invoke `swift-frontend -emit-supported-features` and decode the output

Sources/SwiftDriver/Utilities/Diagnostics.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ extension Diagnostic.Message {
5555
.warning("In-process target-info query failed (\(error)). Using fallback mechanism.")
5656
}
5757

58+
static func warning_inprocess_supported_features_query_failed(_ error: String) -> Diagnostic.Message {
59+
.warning("In-process supported-compiler-features query failed (\(error)). Using fallback mechanism.")
60+
}
61+
5862
static func error_argument_not_allowed_with(arg: String, other: String) -> Diagnostic.Message {
5963
.error("argument '\(arg)' is not allowed with '\(other)'")
6064
}

0 commit comments

Comments
 (0)