Changed handleDiagnostic to take a format string and format args instead of the formatted string

This allows diagnostic consumers to modify the way formatting of diagnostics is performed.
rdar://problem/31305854
This commit is contained in:
Maxwell Swadling
2017-04-14 11:28:04 -07:00
parent 62d077d2d3
commit 93d485e4f7
18 changed files with 160 additions and 78 deletions

View File

@@ -46,7 +46,9 @@ public:
StreamDiagConsumer(llvm::raw_ostream &OS) : OS(OS) {}
void handleDiagnostic(SourceManager &SM, SourceLoc Loc,
DiagnosticKind Kind, StringRef Text,
DiagnosticKind Kind,
StringRef FormatString,
ArrayRef<DiagnosticArgument> FormatArgs,
const DiagnosticInfo &Info) override {
// FIXME: Print location info if available.
switch (Kind) {
@@ -54,7 +56,7 @@ public:
case DiagnosticKind::Warning: OS << "warning: "; break;
case DiagnosticKind::Note: OS << "note: "; break;
}
OS << Text;
DiagnosticEngine::formatDiagnosticText(OS, FormatString, FormatArgs);
}
};
} // end anonymous namespace