<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Sanne,<div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 13, 2017, at 7:41 AM, Sanne Wouda via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div id="divtagdefaultwrapper" dir="ltr" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols;" class=""><p style="margin-top: 0px; margin-bottom: 0px;" class=""></p><div autoid="_rp_x" class="_rp_M4" id="Item.MessagePartBody"><div class="ms-font-color-neutralDark ms-font-weight-regular rpHighlightBodyClass rpHighlightAllClass _rp_N4" id="Item.MessageUniqueBody" tabindex="0" style="outline: none;"><div dir="ltr" class=""><div id="divtagdefaultwrapper" class=""><font face="Calibri,Arial,Helvetica,sans-serif" size="3" class=""><span id="divtagdefaultwrapper" style="font-size: 12pt;" class=""><div style="margin-top: 0px; margin-bottom: 0px;" class="">Hi all,</div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class="">I'm working on improvements to diagnostics handling in LLVM, specifically for the benefit of the (integrated) assembler. The goal is to support options such as -Werror, -w, and -W<warning> for files assembled with clang and inline assembly. Clang already has support for these options but does not apply them to diagnostics originating from (inline) assembly.</div></span></font></div></div></div></div></div></div></blockquote><div><br class=""></div><div>I am not sure I get what you want to do.</div><div>That infrastructure already exists as far as I can tell. Look at <span style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);" class="">BackendConsumer::DiagnosticHandlerImpl.</span></div><div><br class=""></div>For historical reasons, it is possible the inline assembly stuff does not use it though.</div><div><br class=""></div><div>Cheers,</div><div>-Quentin<br class=""><blockquote type="cite" class=""><div class=""><div id="divtagdefaultwrapper" dir="ltr" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols;" class=""><div autoid="_rp_x" class="_rp_M4" id="Item.MessagePartBody"><div class="ms-font-color-neutralDark ms-font-weight-regular rpHighlightBodyClass rpHighlightAllClass _rp_N4" id="Item.MessageUniqueBody" tabindex="0" style="outline: none;"><div dir="ltr" class=""><div id="divtagdefaultwrapper" class=""><font face="Calibri,Arial,Helvetica,sans-serif" size="3" class=""><span id="divtagdefaultwrapper" style="font-size: 12pt;" class=""><div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class="">I plan to add an LLVMDiagnosticsEngine class that takes responsibility for handling diagnostics options (superseding parts of SourceMgr and LLVMContext).</div></span></font></div></div></div></div></div></div></blockquote><div><br class=""></div><blockquote type="cite" class=""><div class=""><div id="divtagdefaultwrapper" dir="ltr" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols;" class=""><div autoid="_rp_x" class="_rp_M4" id="Item.MessagePartBody"><div class="ms-font-color-neutralDark ms-font-weight-regular rpHighlightBodyClass rpHighlightAllClass _rp_N4" id="Item.MessageUniqueBody" tabindex="0" style="outline: none;"><div dir="ltr" class=""><div id="divtagdefaultwrapper" class=""><font face="Calibri,Arial,Helvetica,sans-serif" size="3" class=""><span id="divtagdefaultwrapper" style="font-size: 12pt;" class=""><div style="margin-top: 0px; margin-bottom: 0px;" class=""> The diagnostics themselves will be defined in TableGen (just like in clang).</div></span></font></div></div></div></div></div></div></blockquote><br class=""><blockquote type="cite" class=""><div class=""><div id="divtagdefaultwrapper" dir="ltr" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji', EmojiSymbols;" class=""><div autoid="_rp_x" class="_rp_M4" id="Item.MessagePartBody"><div class="ms-font-color-neutralDark ms-font-weight-regular rpHighlightBodyClass rpHighlightAllClass _rp_N4" id="Item.MessageUniqueBody" tabindex="0" style="outline: none;"><div dir="ltr" class=""><div id="divtagdefaultwrapper" class=""><font face="Calibri,Arial,Helvetica,sans-serif" size="3" class=""><span id="divtagdefaultwrapper" style="font-size: 12pt;" class=""><div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class="">Currently, diagnostics are passed through a SourceMgr to get location info and then passed on to a diagnostics handler for printing (if it exists). This is usually wrapped in Warning() and Error() functions.</div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class="">For example in ARMAsmParser.cpp:</div><div style="margin-top: 0px; margin-bottom: 0px;" class=""> </div><div class=""> Error(ImmLoc, "invalid immediate shift value");</div><div class="">which eventually calls SourceMgr::PrintMessage.</div><div class=""><br class=""></div><div class="">This would change to (incrementally throughout the code-base) :</div><div class=""> <font face="Calibri,Arial,Helvetica,sans-serif" size="2" class=""><span style="font-size: 16px;" class=""> Diag(ImmLoc, err_arm_invalid_immediate_shift);</span></font></div><div class="">and pass through LLVMDiagnosticsEngine to get the diagnostic message and severity (defined in TableGen, similar to Diagnostic*Kinds.td in clang).</div><div class=""><br class=""></div><div class="">Initially, LLVMDiagnosticsEngine will be a smaller, simpler version of clang's DiagnosticEngine. Over time, I would expect more features of clang's diagnostics to migrate to LLVM, where possible, to improve diagnostics for all the LLVM tools.</div><div class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""> </div><div style="margin-top: 0px; margin-bottom: 0px;" class="">I intend to implement the necessary infrastructure and convert a (small) number of diagnostics. Further conversions can be done incrementally.</div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class="">Any comments on this approach? Is this the right direction for diagnostics in LLVM? Suggestions more than welcome!</div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class="">Thanks,</div><div style="margin-top: 0px; margin-bottom: 0px;" class="">Sanne</div></span></font></div></div></div></div><p style="margin-top: 0px; margin-bottom: 0px;" class=""></p></div><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; 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-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">cfe-dev mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:cfe-dev@lists.llvm.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">cfe-dev@lists.llvm.org</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a></div></blockquote></div><br class=""></div></body></html>