Skip to content

Commit fd9ace6

Browse files
authored
Revert "Use libSwiftScan to query supported compiler flags in-process"
1 parent 7c27018 commit fd9ace6

File tree

1 file changed

+19
-36
lines changed

1 file changed

+19
-36
lines changed

Sources/SwiftDriver/Jobs/EmitSupportedFeaturesJob.swift

Lines changed: 19 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import SwiftOptions
1414
import struct Foundation.Data
1515
import class Foundation.JSONDecoder
16-
import struct TSCBasic.Diagnostic
16+
1717
import class TSCBasic.DiagnosticsEngine
1818
import protocol TSCBasic.FileSystem
1919
import struct TSCBasic.RelativePath
@@ -56,27 +56,27 @@ extension Toolchain {
5656
}
5757
}
5858

59-
extension Diagnostic.Message {
60-
static func warn_supported_features_frontend_fallback() -> Diagnostic.Message {
61-
.warning("Fallback to `swift-frontend` for supported compiler features query")
62-
}
63-
}
64-
6559
extension Driver {
66-
static func computeSupportedCompilerArgs(of toolchain: Toolchain,
67-
hostTriple: Triple,
68-
parsedOptions: inout ParsedOptions,
69-
diagnosticsEngine: DiagnosticsEngine,
70-
fileSystem: FileSystem,
71-
executor: DriverExecutor, env: [String: String])
60+
static func computeSupportedCompilerArgs(of toolchain: Toolchain, hostTriple: Triple,
61+
parsedOptions: inout ParsedOptions,
62+
diagnosticsEngine: DiagnosticsEngine,
63+
fileSystem: FileSystem,
64+
executor: DriverExecutor, env: [String: String])
7265
throws -> Set<String> {
73-
if let supportedArgs = try querySupportedCompilerArgsInProcess(of: toolchain, hostTriple: hostTriple,
74-
fileSystem: fileSystem, env: env) {
75-
return supportedArgs
76-
}
66+
// TODO: Once we are sure libSwiftScan is deployed across supported platforms and architectures
67+
// we should deploy it here.
68+
// let swiftScanLibPath = try Self.getScanLibPath(of: toolchain,
69+
// hostTriple: hostTriple,
70+
// env: env)
71+
//
72+
// if fileSystem.exists(swiftScanLibPath) {
73+
// let libSwiftScanInstance = try SwiftScan(dylib: swiftScanLibPath)
74+
// if libSwiftScanInstance.canQuerySupportedArguments() {
75+
// return try libSwiftScanInstance.querySupportedArguments()
76+
// }
77+
// }
7778

78-
// Fallback: Invoke `swift-frontend -emit-supported-features` and decode the output
79-
diagnosticsEngine.emit(.warn_supported_features_frontend_fallback())
79+
// Invoke `swift-frontend -emit-supported-features`
8080
let frontendOverride = try FrontendOverride(&parsedOptions, diagnosticsEngine)
8181
frontendOverride.setUpForTargetInfo(toolchain)
8282
defer { frontendOverride.setUpForCompilation(toolchain) }
@@ -91,23 +91,6 @@ extension Driver {
9191
return Set(decodedSupportedFlagList)
9292
}
9393

94-
static func querySupportedCompilerArgsInProcess(of toolchain: Toolchain,
95-
hostTriple: Triple,
96-
fileSystem: FileSystem,
97-
env: [String: String])
98-
throws -> Set<String>? {
99-
let swiftScanLibPath = try Self.getScanLibPath(of: toolchain,
100-
hostTriple: hostTriple,
101-
env: env)
102-
if fileSystem.exists(swiftScanLibPath) {
103-
let libSwiftScanInstance = try SwiftScan(dylib: swiftScanLibPath)
104-
if libSwiftScanInstance.canQuerySupportedArguments() {
105-
return try libSwiftScanInstance.querySupportedArguments()
106-
}
107-
}
108-
return nil
109-
}
110-
11194
static func computeSupportedCompilerFeatures(of toolchain: Toolchain,
11295
env: [String: String]) throws -> Set<String> {
11396
struct FeatureInfo: Codable {

0 commit comments

Comments
 (0)