Skip to content

Commit eff784a

Browse files
committed
Remove Frontend Parseable Output code
This was a temporary measure to support Swift Build, which is no longer necessary as of swiftlang/swift-build#1050.
1 parent 87f4951 commit eff784a

5 files changed

Lines changed: 6 additions & 80 deletions

File tree

Sources/SwiftDriver/Driver/Driver.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3454,10 +3454,8 @@ extension Driver {
34543454

34553455
static func validateParseableOutputArgs(_ parsedOptions: inout ParsedOptions,
34563456
diagnosticEngine: DiagnosticsEngine) {
3457-
if parsedOptions.contains(.parseableOutput) &&
3458-
parsedOptions.contains(.useFrontendParseableOutput) {
3459-
diagnosticEngine.emit(.error(Error.conflictingOptions(.parseableOutput, .useFrontendParseableOutput)),
3460-
location: nil)
3457+
if parsedOptions.contains(.useFrontendParseableOutput) {
3458+
diagnosticEngine.emit(.warning_frontend_parseable_output_deprecated)
34613459
}
34623460
}
34633461

Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -568,11 +568,6 @@ extension Driver {
568568
commandLine.appendFlags("-package-name", packageName)
569569
}
570570

571-
// Enable frontend Parseable-output, if needed.
572-
if parsedOptions.contains(.useFrontendParseableOutput) {
573-
commandLine.appendFlag("-frontend-parseable-output")
574-
}
575-
576571
if let protocolsList = parsedOptions.getLastArgument(.constGatherProtocolsList)?.asSingle {
577572
let path = try VirtualPath(path: protocolsList)
578573
// Before the compiler supports proper const gather protocol list, the path cannot be prefix mapped.
@@ -1378,12 +1373,6 @@ extension Driver {
13781373
reproJob.commandLine.appendFlag(.genReproducer)
13791374
reproJob.commandLine.appendFlag(.genReproducerDir)
13801375
reproJob.commandLine.appendPath(output)
1381-
reproJob.commandLine.removeAll {
1382-
guard case let .flag(opt) = $0 else {
1383-
return false
1384-
}
1385-
return opt == Option.frontendParseableOutput.spelling
1386-
}
13871376
reproJob.outputs.removeAll()
13881377
reproJob.outputCacheKeys.removeAll()
13891378
return reproJob

Sources/SwiftDriver/Utilities/Diagnostics.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,4 +196,8 @@ extension Diagnostic.Message {
196196
static func warning_xclang_linker_unsupported_for_emscripten(_ value: String) -> Diagnostic.Message {
197197
.warning("'-Xclang-linker \(value)' is not supported for Emscripten targets; use '-Xlinker-driver' to pass flags to emcc")
198198
}
199+
200+
static var warning_frontend_parseable_output_deprecated: Diagnostic.Message {
201+
.warning("'-use-frontend-parseable-output' is no longer supported")
202+
}
199203
}

Sources/SwiftOptions/Options.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,6 @@ extension Option {
602602
public static let forceStructTypeLayouts: Option = Option("-force-struct-type-layouts", .flag, attributes: [.helpHidden, .frontend, .noDriver], helpText: "Force type layout based lowering for structs")
603603
public static let formalCxxInteroperabilityMode: Option = Option("-formal-cxx-interoperability-mode=", .joined, attributes: [.helpHidden, .frontend, .noDriver], metaVar: "<cxx-interop-version>|off", helpText: "What version of C++ interoperability a textual interface was originally generated with")
604604
public static let framework: Option = Option("-framework", .separate, attributes: [.frontend, .doesNotAffectIncrementalBuild], helpText: "Specifies a framework which should be linked against", group: .linkerOption)
605-
public static let frontendParseableOutput: Option = Option("-frontend-parseable-output", .flag, attributes: [.frontend, .noDriver, .cacheInvariant], helpText: "Emit textual output in a parseable format")
606605
public static let Fsystem: Option = Option("-Fsystem", .separate, attributes: [.frontend, .synthesizeInterface, .argumentIsPath], helpText: "Add directory to system framework search path")
607606
public static let functionSections: Option = Option("-function-sections", .flag, attributes: [.helpHidden, .frontend, .noDriver], helpText: "Emit functions to separate sections.")
608607
public static let F: Option = Option("-F", .joinedOrSeparate, attributes: [.frontend, .synthesizeInterface, .argumentIsPath], helpText: "Add directory to framework search path")
@@ -1645,7 +1644,6 @@ extension Option {
16451644
Option.forceStructTypeLayouts,
16461645
Option.formalCxxInteroperabilityMode,
16471646
Option.framework,
1648-
Option.frontendParseableOutput,
16491647
Option.Fsystem,
16501648
Option.functionSections,
16511649
Option.F,

Tests/SwiftDriverTests/ParsableMessageTests.swift

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -461,67 +461,4 @@ import class Foundation.NSString
461461
}
462462
}
463463
}
464-
465-
@Test func frontendMessages() async throws {
466-
do {
467-
try await withTemporaryDirectory { path in
468-
let main = path.appending(component: "main.swift")
469-
let output = path.appending(component: "main.o")
470-
try localFileSystem.writeFileContents(main, bytes: "print(\"hello, world!\")")
471-
472-
let diags = DiagnosticsEngine()
473-
let sdkArgumentsForTesting = (try? Driver.sdkArgumentsForTesting()) ?? []
474-
var driver = try TestDriver(
475-
args: [
476-
"swiftc", main.pathString,
477-
"-use-frontend-parseable-output",
478-
"-o", output.pathString,
479-
] + sdkArgumentsForTesting,
480-
diagnosticsEngine: diags,
481-
integratedDriver: false
482-
)
483-
let jobs = try await driver.planBuild()
484-
#expect(jobs.removingAutolinkExtractJobs().map(\.kind) == [.compile, .link])
485-
#expect(jobs[0].outputs.count == 1)
486-
let compileArgs = jobs[0].commandLine
487-
#expect(compileArgs.contains((.flag("-frontend-parseable-output"))))
488-
try await driver.run(jobs: jobs)
489-
let captured = driver.capturedStderr
490-
#expect(
491-
captured.contains(
492-
"""
493-
{
494-
"kind": "began",
495-
"name": "compile",
496-
"""
497-
)
498-
)
499-
#expect(
500-
captured.contains(
501-
"""
502-
{
503-
"kind": "finished",
504-
"name": "compile",
505-
"""
506-
)
507-
)
508-
}
509-
}
510-
511-
do {
512-
try await assertDriverDiagnostics(args: [
513-
"swiftc", "foo.swift", "-parseable-output",
514-
"-use-frontend-parseable-output",
515-
]) {
516-
$1.expect(
517-
.error(
518-
Driver.Error.conflictingOptions(
519-
.parseableOutput,
520-
.useFrontendParseableOutput
521-
)
522-
)
523-
)
524-
}
525-
}
526-
}
527464
}

0 commit comments

Comments
 (0)