-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Gardening] Sprinkle Const Qualification Around the Frontend #29155
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
@swift-ci please test |
Build failed |
Build failed |
cfc4426
to
203da7d
Compare
@swift-ci please test |
Build failed |
Build failed |
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.
Great to see this!! I love it.
The changes I feel are important are the places where I mentioned adding a comment to explain what's going on. The others are optional, IMO.
I didn't check any algorithmic changes for correctness.
203da7d
to
44a61be
Compare
44a61be
to
e3f07a0
Compare
@swift-ci smoke test |
lib/Frontend/CompilerInvocation.cpp
Outdated
@@ -111,6 +111,59 @@ static void updateRuntimeLibraryPaths(SearchPathOptions &SearchPathOpts, | |||
} | |||
} | |||
|
|||
// FIXME: This function is a bit of a layering violation. It should be | |||
// dispersed into IRGen option parsing if possible. |
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.
It would be nice to explain specifically how it violates layering--would help a noobie. Also since it is required to preserve the incoming settings, where do they come from?
@swift-ci smoke test macOS platform |
@swift-ci clean smoke test macOS platform |
Use the presence or absence of the PGO reader instead. SILGen was wiping out this option then checking for it being wiped out anyways.
This was being done at an odd point in the frontend presumably because by that point the private discriminator had been fully computed. Instead, push the conditions for generating the prefix data down to debug info generation and stop mutating IRGenOptions::DebugFlag in the frontend.
Add an extra phase after all the argument parsing has completed that sets inter-option-dependent flags. This allows for the const-qualification of IRGenOptions, and removes some weird state flipping in FrontendTool.
The REPL was using the CompilerInstance to stash this parameter, then it would immediately move it into IRGen. Drop the setter and pass this data directly.
e3f07a0
to
e1b6e2b
Compare
@swift-ci smoke test |
For those operations that do not need to emit diagnostics or manipulate modules, there's no reason to mutate the passed instance.
e1b6e2b
to
2af598f
Compare
@swift-ci smoke test |
@swift-ci clean smoke test macOS platform |
Ugh, finally. |
⛵️ |
[Gardening] Adjust for swiftlang/swift#29155
(cherry picked from commit 5d455c2)
[Gardening] Adjust for swiftlang/swift#29155
Const-qualify a bunch of frontend-related data structures like the compiler instance, compiler invocation, and frontend options wherever as much as possible. This entailed pushing state callers would previously mutate down as parameters.
Goes a long way towards rdar://57122646