-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Frontend] Add a new -emit-interface-path option #18090
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
[Frontend] Add a new -emit-interface-path option #18090
Conversation
This dates back to the early days when the Driver was still being brought up, but there's no reason to put them together now. Reorganization and elimination of redundancy only.
Reorganization only.
@swift-ci Please smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me. I would add another sentence to the comment in SupplementaryOutputPaths.h. And, I didn't inspect the logic in the large switches-by-output-type very closely, but no existing functionality will break.
@@ -60,6 +60,11 @@ struct SupplementaryOutputPaths { | |||
/// It is currently only used with WMO, but could be generalized. | |||
std::string TBDPath; | |||
|
|||
/// The path to which we should emit a textual module interface. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about adding another sentence here, regarding the purpose of the textual module interface?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. I'd rather put that on the function that actually generates the thing. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question! Where are the explanations for the other supplementary outputs? How would one find the function that does the generation if one were looking at this declaration? Seems easier to go from the use of the declaration to the declaration than the reverse, because there is a plurality of uses, but only one declaration. I guess I lean towards the declaration, but any choice that makes it discoverable (e.g. cross-references) seems fine.
ed3d625
to
982243f
Compare
I still feel a little weird putting the comment here because it doesn't seem like the place to look if you want to know what a textual interface is, but I added a bit of explanation, at least. @swift-ci Please smoke test |
include/swift/Frontend/Types.def
Outdated
@@ -48,6 +48,7 @@ TYPE("dependencies", Dependencies, "d", "") | |||
TYPE("autolink", AutolinkFile, "autolink", "") | |||
TYPE("swiftmodule", SwiftModuleFile, "swiftmodule", "") | |||
TYPE("swiftdoc", SwiftModuleDocFile, "swiftdoc", "") | |||
TYPE("swiftinterface", SwiftModuleInterfaceFile, "swiftinterface", "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worthwhile adjusting the spacing on the other lines to maintain the columnar alignment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'm not sure why I was hesitant to do so. Will fix.
I guess I expected the comment in SupplementaryOutputPaths.h to say something about "module stability" or some indication of why this is needed when today modules can be imported without it. |
Yeah, I don't think that belongs in SupplementaryOutputPaths.h. I don't know where it does belong, but SupplementaryOutputPaths.h defines a little helper structure that holds paths. It's not like Subsystems.h, which points out to a lot of other parts of the compiler. That is, I don't think this is "the declaration" that someone would use to find out what textual interfaces are. |
I'm about to make |
Fair point, but where else do you go to discover the purpose of each output? |
...but don't hook it up to anything yet. This is the very very start of the module stability / textual interfaces feature described at https://forums.swift.org/t/plan-for-module-stability/14551/ For now I've just made it a frontend option (not a driver option), which is good enough for testing.
982243f
to
b9ae66d
Compare
I'm not sure. The best answer I have is Options.td, since that's where the options for the various outputs are defined, but we only have the classic terse single lines of help text there. |
@swift-ci Please smoke test |
@davidungar, think this discussion is important enough to hold off on merging? Or should I go ahead? (Trying not to get too far ahead on my local branch, something I remember from when our roles were reversed!) |
@jrose-apple Thanks for asking. I would be OK with merging as-is, but would really prefer if something like this sentence: |
All right. I guess the least bad thing is to make SupplementaryOutputPaths the home for that information after all, or at least the links out to other APIs, files in docs/, or forum posts. I'll do that in a follow-up PR. |
Thanks! |
...but don't hook it up to anything yet. Also reorganize the Frontend tests a bit so that I can add new tests in the right place.
This is the very very start of the module stability / textual interfaces feature described at https://forums.swift.org/t/plan-for-module-stability/14551/
For now I've just made it a frontend option (not a driver option), which is good enough for testing.