Repository navigation
Conversation
aviralg
force-pushed
the
aviralg/sarif-diagnostics
branch
4 times, most recently
from
October 12, 2026 18:54
179454c to
53d1c77
Compare
artemcm
reviewed
Oct 13, 2026
| let serializedDiagnosticsFilePath: VirtualPath.Handle? | ||
|
|
||
| /// The file type diagnostics are serialized to. | ||
| let serializedDiagnosticsType: FileType |
Contributor
There was a problem hiding this comment.
nit: I think I'd prefer "format" to "type" in these.
artemcm
reviewed
Oct 13, 2026
| public static let serializeDependencyScanCache: Option = Option("-serialize-dependency-scan-cache", .flag, attributes: [.frontend, .noDriver], helpText: "After performing a dependency scan, serialize the scanner's internal state.") | ||
| public static let serializeDiagnosticsPathEQ: Option = Option("-serialize-diagnostics-path=", .joined, alias: Option.serializeDiagnosticsPath, attributes: [.frontend, .noBatch, .argumentIsPath, .supplementaryOutput, .cacheInvariant]) | ||
| public static let serializeDiagnosticsPath: Option = Option("-serialize-diagnostics-path", .separate, attributes: [.frontend, .noBatch, .argumentIsPath, .supplementaryOutput, .cacheInvariant], metaVar: "<path>", helpText: "Emit a serialized diagnostics file to <path>") | ||
| public static let serializeDiagnosticsEQ: Option = Option("-serialize-diagnostics=", .joined, attributes: [.frontend, .noInteractive, .supplementaryOutput, .cacheInvariant], metaVar: "<format>", helpText: "Serialize diagnostics in a specific format: 'dia', a binary format (the default), or 'sarif'") |
Contributor
There was a problem hiding this comment.
A reminder that these need to be generated with:
https://github.com/swiftlang/swift-driver#rebuilding-optionsswift
In case it wasn't already.
aviralg
force-pushed
the
aviralg/sarif-diagnostics
branch
from
October 15, 2026 20:42
53d1c77 to
805ffdc
Compare
This change updates swift-driver to match the C++ driver: - Recognize `-serialize-diagnostics=<format>` wherever `-serialize-diagnostics` was recognized, so the format flag enables serialization by itself. - Choose the output file type from the requested format. This covers compile and PCH jobs, and also the emit-module and dependency scan jobs, which only swift-driver plans. Their output file map entries are `sarif-diagnostics`, `emit-module-sarif-diagnostics` and `dependency-scan-sarif-diagnostics`. - Pass the format alongside the path it belongs to, rather than to every frontend job. The flag enables serialization on its own, so a job with no diagnostics output would otherwise start writing a log the driver knows nothing about. - Keep the SARIF log of a failed compile job, just as the `.dia` file is kept, when the job's other outputs are removed. The arguments are read as the frontend reads them: the bare `-serialize-diagnostics` means `=dia`, the last of the two forms wins, and an unknown format is an error wherever it appears.
aviralg
force-pushed
the
aviralg/sarif-diagnostics
branch
from
October 21, 2026 18:11
805ffdc to
5440f5b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change updates swift-driver to match the C++ driver:
Recognize
-serialize-diagnostics=<format>wherever-serialize-diagnosticswas recognized, so the format flag enables serialization by itself. A format other thandiaorsarifis rejected.Choose the output file type from the requested format. This covers compile and PCH jobs, and also the emit-module and dependency scan jobs, which only swift-driver plans. Their output file map entries are
sarif-diagnostics,emit-module-sarif-diagnosticsanddependency-scan-sarif-diagnostics.Pass the format alongside the path it belongs to, rather than to every frontend job. The flag enables serialization on its own, so a job with no diagnostics output would otherwise start writing a log the driver knows nothing about.
Keep the SARIF log of a failed compile job, just as the
.diafile is kept, when the job's other outputs are removed.