@@ -1197,18 +1197,6 @@ static void printASTValidationError(
1197
1197
LLDB_LOG (log, " -- {0}" , ExtraOpt);
1198
1198
}
1199
1199
1200
- void SwiftASTContext::DiagnoseWarnings (Process &process,
1201
- const SymbolContext &sc) const {
1202
- if (!sc.module_sp || !HasDiagnostics ())
1203
- return ;
1204
- auto debugger_id = process.GetTarget ().GetDebugger ().GetID ();
1205
- std::string msg;
1206
- llvm::raw_string_ostream (msg) << " Cannot load Swift type information for "
1207
- << sc.module_sp ->GetFileSpec ().GetPath ();
1208
- Debugger::ReportWarning (msg, debugger_id, &m_swift_import_warning);
1209
- StreamAllDiagnostics (debugger_id);
1210
- }
1211
-
1212
1200
// / Locate the swift-plugin-server for a plugin library,
1213
1201
// / by converting ${toolchain}/usr/(local)?/lib/swift/host/plugins
1214
1202
// / into ${toolchain}/usr/bin/swift-plugin-server
@@ -3236,35 +3224,6 @@ Status SwiftASTContext::GetAllDiagnostics() const {
3236
3224
return error;
3237
3225
}
3238
3226
3239
- void SwiftASTContext::StreamAllDiagnostics (
3240
- std::optional<lldb::user_id_t > debugger_id) const {
3241
- Status error = m_fatal_errors.Clone ();
3242
- if (!error.Success ()) {
3243
- Debugger::ReportWarning (error.AsCString (), debugger_id,
3244
- &m_swift_diags_streamed);
3245
- return ;
3246
- }
3247
-
3248
- // Retrieve the error message from the DiagnosticConsumer.
3249
- DiagnosticManager diagnostic_manager;
3250
- PrintDiagnostics (diagnostic_manager);
3251
- for (auto &diag : diagnostic_manager.Diagnostics ())
3252
- if (diag) {
3253
- std::string msg = diag->GetMessage ().str ();
3254
- switch (diag->GetSeverity ()) {
3255
- case eSeverityError:
3256
- Debugger::ReportError (msg, debugger_id, &m_swift_diags_streamed);
3257
- break ;
3258
- case eSeverityWarning:
3259
- case eSeverityInfo:
3260
- Debugger::ReportWarning (msg, debugger_id, &m_swift_warning_streamed);
3261
- break ;
3262
- }
3263
- }
3264
- static_cast <StoringDiagnosticConsumer *>(m_diagnostic_consumer_ap.get ())
3265
- ->Clear ();
3266
- }
3267
-
3268
3227
void SwiftASTContext::LogFatalErrors () const {
3269
3228
// Avoid spamming the health log with redundant copies of the fatal error.
3270
3229
if (m_logged_fatal_error) {
@@ -5376,8 +5335,22 @@ bool SwiftASTContext::HasClangImporterErrors() const {
5376
5335
5377
5336
void SwiftASTContext::AddDiagnostic (lldb::Severity severity,
5378
5337
llvm::StringRef message) {
5379
- assert (m_diagnostic_consumer_ap);
5380
5338
HEALTH_LOG_PRINTF (" %s" , message.str ().c_str ());
5339
+
5340
+ if (auto target_sp = GetTargetWP ().lock ()) {
5341
+ auto debugger_id = target_sp->GetDebugger ().GetID ();
5342
+ switch (severity) {
5343
+ case eSeverityError:
5344
+ Debugger::ReportError (message.str (), debugger_id);
5345
+ break ;
5346
+ case eSeverityWarning:
5347
+ case eSeverityInfo:
5348
+ Debugger::ReportWarning (message.str (), debugger_id);
5349
+ break ;
5350
+ }
5351
+ }
5352
+
5353
+ assert (m_diagnostic_consumer_ap);
5381
5354
if (!m_diagnostic_consumer_ap.get ())
5382
5355
return ;
5383
5356
0 commit comments