-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Rdar 27397701 synthesized get set typechecking #5588
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
Rdar 27397701 synthesized get set typechecking #5588
Conversation
@swift-ci please test |
|
||
#include "llvm/ADT/Statistic.h" | ||
|
||
#define SWIFT_FUNC_STAT \ |
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.
Does this need a do { ... } while (0)
given how often braceless control flow is used, or are macro hacks like that not Swift/LLVM style?
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.
No, that definitely would be preferred.
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.
In the future, can you split things like this up into multiple PRs? The statistics-gathering seems separate from the fixes.
@@ -763,17 +767,25 @@ void swift::addTrivialAccessorsToStorage(AbstractStorageDecl *storage, | |||
|
|||
// Synthesize and type-check the body of the getter. | |||
synthesizeTrivialGetter(getter, storage, TC); | |||
TC.typeCheckDecl(getter, true); | |||
TC.typeCheckDecl(getter, false); | |||
if (storage->getDeclContext()->isModuleScopeContext()) { |
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.
I don't see why this is the right check. What's different about members? Why can't I just validate accessors at module scope?
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.
Without that check, various resilience tests fail when emitting global getters (compiler crashes). I imagine this is due to unconditional emission of those getters, w/o being driven by any other references.
Seems to work when I tighten the condition to "only when in resilient mode", so I'll try that (and add a comment to that extent).
Build failed |
Looks like we can't rely on numpy being around |
948fa2b
to
07d8594
Compare
07d8594
to
e7336b6
Compare
e7336b6
to
166eebe
Compare
This looks fantastic, thanks! |
@swift-ci please smoke test and merge |
@swift-ci please smoke test linux and merge |
@swift-ci please smoke test linux |
Addresses redundant typechecking of getter/setter function bodies outside of the primary file.
This is responsible for unnecessary quadratic work when doing a multi-file compilation.
PR also includes more scale-testing machinery, and a regression test that uses it.
Resolves SR-2901.
Resolves rdar://27397701