Add DiagID and Warning Flag to DiagnosticsLog

llvm-svn: 222042
This commit is contained in:
Steven Wu 2014-11-14 21:23:56 +00:00
parent 2700d03da5
commit 2e2b0b3942
2 changed files with 13 additions and 0 deletions

View File

@ -35,6 +35,9 @@ class LogDiagnosticPrinter : public DiagnosticConsumer {
/// The ID of the diagnostic.
unsigned DiagnosticID;
/// The Option Flag for the diagnostic
std::string WarningOption;
/// The level of the diagnostic.
DiagnosticsEngine::Level DiagnosticLevel;

View File

@ -63,6 +63,14 @@ LogDiagnosticPrinter::EmitDiagEntry(llvm::raw_ostream &OS,
<< " ";
EmitString(OS, DE.Message) << '\n';
}
OS << " <key>ID</key>\n"
<< " ";
EmitInteger(OS, DE.DiagnosticID) << '\n';
if (!DE.WarningOption.empty()) {
OS << " <key>WarningOption</key>\n"
<< " ";
EmitString(OS, DE.WarningOption) << '\n';
}
OS << " </dict>\n";
}
@ -122,6 +130,8 @@ void LogDiagnosticPrinter::HandleDiagnostic(DiagnosticsEngine::Level Level,
DE.DiagnosticID = Info.getID();
DE.DiagnosticLevel = Level;
DE.WarningOption = DiagnosticIDs::getWarningOptionForDiag(DE.DiagnosticID);
// Format the message.
SmallString<100> MessageStr;
Info.FormatDiagnostic(MessageStr);