-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[Dependency Scanning] Give each scanner worker a unique Diagnostic Engine #84064
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
[Dependency Scanning] Give each scanner worker a unique Diagnostic Engine #84064
Conversation
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 guess the reason for this is because there is state preserving variable in DiagnosticsEngine that affects behavior? But this only pushing the problem downstream, requires DiagnosticConsumer also having the behavior.
It is also generally required that Consumer.finishProcessing() only gets called once, so multiple diagnostics engine owning the same consumer is a bit asking for trouble. I like the idea, but I don't think this change actually fixes the problem.
The only consumer the scanner's diagnostic engine should have is the |
Maybe it is better if the worker consumer is created and added where the diagnostics engine is created? Also add comments about the requirement for all consumers to be threadSafe. Even better is create a |
edcb671
to
c2319e5
Compare
It kind of already is. In I added a pure virtual |
@swift-ci smoke test |
void handleDiagnostic(SourceManager &SM, const DiagnosticInfo &Info) final override; | ||
|
||
protected: | ||
virtual void addDiagnostic(SourceManager &SM, const DiagnosticInfo &Info) = 0; |
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.
Nit: I don't know if there is a naming convention in Swift code, but in LLVM, this usually named handleDiagnosticImpl
.
c2319e5
to
fbbf5d3
Compare
@swift-ci smoke test |
@swift-ci smoke test macOS platform |
…gine Otherwise, when multiple workers encounter a diagnostic simultaneously we can encounter races which lead to corrupted diagnostic data or crashes Resolves rdar://159598539
fbbf5d3
to
1cd1193
Compare
@swift-ci smoke test |
@swift-ci smoke test Windows platform |
Otherwise, when multiple workers encounter a diagnostic simultaneously we can encounter races which lead to corrupted diagnostic data or crashes
Resolves rdar://159598539