[Diagnostics] Refactor DiagnosticConsumer interface

DiagnosticInfo now holds all the information needed to consume
a diagnostic, so remove unneeded parameters from handleDiagnostic.
This commit is contained in:
Owen Voorhees
2019-10-24 14:47:33 -07:00
parent dfe00c3217
commit 8a6711769e
22 changed files with 314 additions and 414 deletions

View File

@@ -94,15 +94,10 @@ ModuleDifferDiagsConsumer::ModuleDifferDiagsConsumer(bool DiagnoseModuleDiff,
}
void swift::ide::api::ModuleDifferDiagsConsumer::handleDiagnostic(
SourceManager &SM, SourceLoc Loc, DiagnosticKind Kind,
StringRef FormatString, ArrayRef<DiagnosticArgument> FormatArgs,
const DiagnosticInfo &Info,
const SourceLoc bufferIndirectlyCausingDiagnostic) {
SourceManager &SM, const DiagnosticInfo &Info) {
auto Category = getCategoryName((uint32_t)Info.ID);
if (Category.empty()) {
PrintingDiagnosticConsumer::handleDiagnostic(
SM, Loc, Kind, FormatString, FormatArgs, Info,
bufferIndirectlyCausingDiagnostic);
PrintingDiagnosticConsumer::handleDiagnostic(SM, Info);
return;
}
if (!DiagnoseModuleDiff)
@@ -110,7 +105,8 @@ void swift::ide::api::ModuleDifferDiagsConsumer::handleDiagnostic(
llvm::SmallString<256> Text;
{
llvm::raw_svector_ostream Out(Text);
DiagnosticEngine::formatDiagnosticText(Out, FormatString, FormatArgs);
DiagnosticEngine::formatDiagnosticText(Out, Info.FormatString,
Info.FormatArgs);
}
AllDiags[Category].insert(Text.str().str());
}