mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[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:
@@ -46,20 +46,25 @@ class StreamDiagConsumer : public DiagnosticConsumer {
|
||||
public:
|
||||
StreamDiagConsumer(llvm::raw_ostream &OS) : OS(OS) {}
|
||||
|
||||
void
|
||||
handleDiagnostic(SourceManager &SM, SourceLoc Loc, DiagnosticKind Kind,
|
||||
StringRef FormatString,
|
||||
ArrayRef<DiagnosticArgument> FormatArgs,
|
||||
const DiagnosticInfo &Info,
|
||||
const SourceLoc bufferIndirectlyCausingDiagnostic) override {
|
||||
void handleDiagnostic(SourceManager &SM,
|
||||
const DiagnosticInfo &Info) override {
|
||||
// FIXME: Print location info if available.
|
||||
switch (Kind) {
|
||||
case DiagnosticKind::Error: OS << "error: "; break;
|
||||
case DiagnosticKind::Warning: OS << "warning: "; break;
|
||||
case DiagnosticKind::Note: OS << "note: "; break;
|
||||
case DiagnosticKind::Remark: OS << "remark: "; break;
|
||||
switch (Info.Kind) {
|
||||
case DiagnosticKind::Error:
|
||||
OS << "error: ";
|
||||
break;
|
||||
case DiagnosticKind::Warning:
|
||||
OS << "warning: ";
|
||||
break;
|
||||
case DiagnosticKind::Note:
|
||||
OS << "note: ";
|
||||
break;
|
||||
case DiagnosticKind::Remark:
|
||||
OS << "remark: ";
|
||||
break;
|
||||
}
|
||||
DiagnosticEngine::formatDiagnosticText(OS, FormatString, FormatArgs);
|
||||
DiagnosticEngine::formatDiagnosticText(OS, Info.FormatString,
|
||||
Info.FormatArgs);
|
||||
}
|
||||
};
|
||||
} // end anonymous namespace
|
||||
|
||||
Reference in New Issue
Block a user