<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class="">+  DE.WarningOption = "";</div><div class="">+  StringRef WarningOption = DiagnosticIDs::getWarningOptionForDiag(DE.DiagnosticID);</div><div class="">+  if (!WarningOption.empty()) {</div><div class="">+    DE.WarningOption = WarningOption.str();</div><div class="">+  }</div><div class="">+</div></div><div class=""><br class=""></div><div class="">Is there a reason this can’t be simplified to</div><div class=""><br class=""></div><div class="">DE.WarningOption = DiagnosticIDs::getWarningOptionForDiag(DE.DiagnosticID);</div><div class=""><br class=""></div><div class="">?</div><div class=""><br class=""></div><div class="">Otherwise LGTM.</div><br class=""><div><blockquote type="cite" class=""><div class="">On Nov 5, 2014, at 1:31 PM, Steven Wu <<a href="mailto:stevenwu@apple.com" class="">stevenwu@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Ping. Is there anyone concerned about this change?<span class="Apple-converted-space"> </span></span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">On Oct 15, 2014, at 6:08 PM, Steven Wu <<a href="mailto:stevenwu@apple.com" class="">stevenwu@apple.com</a>> wrote:<br class=""><br class="">Hi<br class=""><br class="">This patch adds two more fields to diagnostic log (not serialize-diagnostic). The two new fields are DiagnosticID and Warning Option. I find them very handy in detecting and categorizing diagnostics.<br class="">The added fields are in a dict type in a plist so it is unlikely to break any existing tools that read diagnostic logs.<span class="Apple-converted-space"> </span><br class=""><br class="">Steven<br class=""><br class="">--<br class="">include/clang/Frontend/LogDiagnosticPrinter.h |  3 +++<br class="">lib/Frontend/LogDiagnosticPrinter.cpp         | 14 ++++++++++++++<br class="">2 files changed, 17 insertions(+)<br class=""><br class="">diff --git a/include/clang/Frontend/LogDiagnosticPrinter.h b/include/clang/Frontend/LogDiagnosticPrinter.h<br class="">index 8d60e9b..98adf65 100644<br class="">--- a/include/clang/Frontend/LogDiagnosticPrinter.h<br class="">+++ b/include/clang/Frontend/LogDiagnosticPrinter.h<br class="">@@ -35,6 +35,9 @@ class LogDiagnosticPrinter : public DiagnosticConsumer {<br class=""><br class="">   /// The ID of the diagnostic.<br class="">   unsigned DiagnosticID;<br class="">+<br class="">+    /// The Option Flag for the diagnostic<br class="">+    std::string WarningOption;<br class=""><br class="">   /// The level of the diagnostic.<br class="">   DiagnosticsEngine::Level DiagnosticLevel;<br class="">diff --git a/lib/Frontend/LogDiagnosticPrinter.cpp b/lib/Frontend/LogDiagnosticPrinter.cpp<br class="">index c2dcd1b..19a4660 100644<br class="">--- a/lib/Frontend/LogDiagnosticPrinter.cpp<br class="">+++ b/lib/Frontend/LogDiagnosticPrinter.cpp<br class="">@@ -63,6 +63,14 @@ LogDiagnosticPrinter::EmitDiagEntry(llvm::raw_ostream &OS,<br class="">      << "      ";<br class="">   EmitString(OS, DE.Message) << '\n';<br class=""> }<br class="">+  OS << "      <key>ID</key>\n"<br class="">+     << "      ";<br class="">+  EmitInteger(OS, DE.DiagnosticID) << '\n';<br class="">+  if (!DE.WarningOption.empty()) {<br class="">+    OS << "      <key>WarningOption</key>\n"<br class="">+       << "      ";<br class="">+    EmitString(OS, DE.WarningOption) << '\n';<br class="">+  }<br class=""> OS << "    </dict>\n";<br class="">}<br class=""><br class="">@@ -122,6 +130,12 @@ void LogDiagnosticPrinter::HandleDiagnostic(DiagnosticsEngine::Level Level,<br class=""> DE.DiagnosticID = Info.getID();<br class=""> DE.DiagnosticLevel = Level;<br class=""><br class="">+  DE.WarningOption = "";<br class="">+  StringRef WarningOption = DiagnosticIDs::getWarningOptionForDiag(DE.DiagnosticID);<br class="">+  if (!WarningOption.empty()) {<br class="">+    DE.WarningOption = WarningOption.str();<br class="">+  }<br class="">+<br class=""> // Format the message.<br class=""> SmallString<100> MessageStr;<br class=""> Info.FormatDiagnostic(MessageStr);<br class=""><br class=""><Diaglog.patch><br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">cfe-commits mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:cfe-commits@cs.uiuc.edu" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">cfe-commits@cs.uiuc.edu</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a></div></blockquote></div><br class=""></body></html>