-
Notifications
You must be signed in to change notification settings - Fork 129
TSCUtility: deprecate Bitstream interfaces #351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The bitstream interfaces were only used by swift-driver. The implementation has been migrated into swift-driver, allowing us to now mark the interfaces as deprecated.
@swift-ci please test |
SerializedDiagnostics also use the Bitstream interfaces, and now have warnings. SwiftPM hasn't yet switched over to use that instead of just passing the .dia file up to Xcode to parse using libclang, but the plan was to move in that direction. Is the plan to remove SerializedDiagnostics also? |
we can roll this back if premature. @compnerd ? |
@tomerd sure, we can revert this for now. I can try to create an internal alias to avoid the warnings. Not sure if I can do anything about removing the use of |
Hmm... having two copies is certainly not good. But what was the reason for wanting to move BitstreamReader directly into SwiftDriver package in the first place? Is it just part of chipping away at TSC? From SwiftPM's perspective, it certainly seems desirable for it to be able to understand .dia files without taking on external dependencies on libclang etc. SwiftPM's use of Besides being ugly, this makes it hard for SwiftPM to reason about the errors, or to produce formatted output or anything like that for diagnostics from compiled manifests and plugins. So I was hoping to clean things up by having SwiftPM just load the diagnostics and then send them through the normal observability scope APIs that it uses for diagnostics. There were a couple of fixes needed for that in So making |
Removing Currently, I'm looking at TSCUtility. We are pretty close to stripping that out in practice. swift-driver depends on I suppose I don't fully understand the SwiftPM perspective here. It is also possible to get the diagnostics without serializing them if the desire is to just get the data. That would allow us to filter and stream it through the observability APIs. A dependency on libclang also doesn't seem too onerous to me. At least for Swift toolchain distributions, clang is a requisite component. Additionally, for SourceKit-LSP (which is really an expectation I believe), clangd and libclang are part of the distribution. So, while it might be increasing the interdependence between SPM and the rest of the toolchain, that connection is already present due to the other dependencies. |
That sounds very promising! It's annoying that structured diagnostics from Clang and Swift use the bitstream format when it seems that something like a JSON format would have been easier for callers to work with. What's the other way to get these diagnostics in a structured form? I've looked at I'm certainly not tied to parsing the .dia — I do think that SwiftPM should understand the diagnostics coming from the compiler (and scraping the textual output is lossy so that's not a good option). But if there's another way at getting the diagnostics without serializing them, then that would be great. |
I don't think that there is another structured form. The diagnostics can be formatted in specific manners (e.g. msvc, vi, or clang). GCC does support |
I see — I thought you were saying that there was a better structured format (for Swift in particular, which is what the manifest and plugins are — the other diagnostics we let llbuild handle) that was easier to parse than the .dia files. |
I wonder if we should look at |
The bitstream interfaces were only used by swift-driver. The implementation has been migrated into swift-driver, allowing us to now mark the interfaces as deprecated.