mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Dependency Scanning] Always use a locking diagnostic consumer
Since we enabled parallel dependency scanning by-default, each individual scan needs a diagnostic consumer that is safe to use across many threads. Deprecate the 'Locking' sub-class, making its behavior the default in the base class.
This commit is contained in:
@@ -74,6 +74,8 @@ void DependencyScanDiagnosticCollector::handleDiagnostic(SourceManager &SM,
|
||||
|
||||
void DependencyScanDiagnosticCollector::addDiagnostic(
|
||||
SourceManager &SM, const DiagnosticInfo &Info) {
|
||||
llvm::sys::SmartScopedLock<true> Lock(ScanningDiagnosticConsumerStateLock);
|
||||
|
||||
// Determine what kind of diagnostic we're emitting.
|
||||
llvm::SourceMgr::DiagKind SMKind;
|
||||
switch (Info.Kind) {
|
||||
@@ -129,12 +131,6 @@ void DependencyScanDiagnosticCollector::addDiagnostic(
|
||||
}
|
||||
}
|
||||
|
||||
void LockingDependencyScanDiagnosticCollector::addDiagnostic(
|
||||
SourceManager &SM, const DiagnosticInfo &Info) {
|
||||
llvm::sys::SmartScopedLock<true> Lock(ScanningDiagnosticConsumerStateLock);
|
||||
DependencyScanDiagnosticCollector::addDiagnostic(SM, Info);
|
||||
}
|
||||
|
||||
swiftscan_diagnostic_set_t *mapCollectedDiagnosticsForOutput(
|
||||
const DependencyScanDiagnosticCollector *diagnosticCollector) {
|
||||
auto collectedDiagnostics = diagnosticCollector->getDiagnostics();
|
||||
@@ -272,7 +268,8 @@ DependencyScanningTool::getDependencies(
|
||||
StringRef WorkingDirectory) {
|
||||
// There may be errors as early as in instance initialization, so we must ensure
|
||||
// we can catch those.
|
||||
auto ScanDiagnosticConsumer = std::make_shared<DependencyScanDiagnosticCollector>();
|
||||
auto ScanDiagnosticConsumer =
|
||||
std::make_shared<DependencyScanDiagnosticCollector>();
|
||||
|
||||
// The primary instance used to scan the query Swift source-code
|
||||
auto QueryContextOrErr = initCompilerInstanceForScan(Command,
|
||||
|
||||
Reference in New Issue
Block a user