r222042 - Add DiagID and Warning Flag to DiagnosticsLog
Steven Wu
stevenwu at apple.com
Fri Nov 14 13:23:57 PST 2014
Author: steven_wu
Date: Fri Nov 14 15:23:56 2014
New Revision: 222042
URL: http://llvm.org/viewvc/llvm-project?rev=222042&view=rev
Log:
Add DiagID and Warning Flag to DiagnosticsLog
Modified:
cfe/trunk/include/clang/Frontend/LogDiagnosticPrinter.h
cfe/trunk/lib/Frontend/LogDiagnosticPrinter.cpp
Modified: cfe/trunk/include/clang/Frontend/LogDiagnosticPrinter.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/LogDiagnosticPrinter.h?rev=222042&r1=222041&r2=222042&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/LogDiagnosticPrinter.h (original)
+++ cfe/trunk/include/clang/Frontend/LogDiagnosticPrinter.h Fri Nov 14 15:23:56 2014
@@ -35,6 +35,9 @@ class LogDiagnosticPrinter : public Diag
/// The ID of the diagnostic.
unsigned DiagnosticID;
+
+ /// The Option Flag for the diagnostic
+ std::string WarningOption;
/// The level of the diagnostic.
DiagnosticsEngine::Level DiagnosticLevel;
Modified: cfe/trunk/lib/Frontend/LogDiagnosticPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/LogDiagnosticPrinter.cpp?rev=222042&r1=222041&r2=222042&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/LogDiagnosticPrinter.cpp (original)
+++ cfe/trunk/lib/Frontend/LogDiagnosticPrinter.cpp Fri Nov 14 15:23:56 2014
@@ -63,6 +63,14 @@ LogDiagnosticPrinter::EmitDiagEntry(llvm
<< " ";
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::HandleDiagnos
DE.DiagnosticID = Info.getID();
DE.DiagnosticLevel = Level;
+ DE.WarningOption = DiagnosticIDs::getWarningOptionForDiag(DE.DiagnosticID);
+
// Format the message.
SmallString<100> MessageStr;
Info.FormatDiagnostic(MessageStr);
More information about the cfe-commits
mailing list