<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<p></p>
<div autoid="_rp_x" class="_rp_M4" id="Item.MessagePartBody">
<div class="_rp_N4 ms-font-weight-regular ms-font-color-neutralDark rpHighlightAllClass rpHighlightBodyClass" id="Item.MessageUniqueBody" tabindex="0" style="outline: none;">
<div dir="ltr">
<div id="divtagdefaultwrapper"><font face="Calibri,Arial,Helvetica,sans-serif" size="3" color="black"><span id="divtagdefaultwrapper" style="font-size: 12pt;">
<div style="margin-top: 0px; margin-bottom: 0px;">Hi all,</div>
<div style="margin-top: 0px; margin-bottom: 0px;"><br>
</div>
<div style="margin-top: 0px; margin-bottom: 0px;">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>
<div style="margin-top: 0px; margin-bottom: 0px;"><br>
</div>
<div style="margin-top: 0px; margin-bottom: 0px;">I plan to add an LLVMDiagnosticsEngine class that takes responsibility for handling diagnostics options (superseding parts of SourceMgr and LLVMContext). The diagnostics themselves will be defined in TableGen
 (just like in clang).<br>
</div>
<div style="margin-top: 0px; margin-bottom: 0px;"><br>
</div>
<div style="margin-top: 0px; margin-bottom: 0px;">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;"><br>
</div>
<div style="margin-top: 0px; margin-bottom: 0px;">For example in ARMAsmParser.cpp:</div>
<div style="margin-top: 0px; margin-bottom: 0px;"> </div>
<div>        Error(ImmLoc, "invalid immediate shift value");</div>
<div>which eventually calls SourceMgr::PrintMessage.</div>
<div><br>
</div>
<div>This would change to (incrementally throughout the code-base) :</div>
<div> <font face="Calibri,Arial,Helvetica,sans-serif" size="2"><span style="font-size: 16px;">      Diag(ImmLoc, err_arm_invalid_immediate_shift);</span></font></div>
<div>and pass through LLVMDiagnosticsEngine to get the diagnostic message and severity (defined in TableGen, similar to Diagnostic*Kinds.td in clang).</div>
<div><br>
</div>
<div>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><br>
</div>
<div style="margin-top: 0px; margin-bottom: 0px;"> </div>
<div style="margin-top: 0px; margin-bottom: 0px;">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;"><br>
</div>
<div style="margin-top: 0px; margin-bottom: 0px;">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;"><br>
</div>
<div style="margin-top: 0px; margin-bottom: 0px;">Thanks,</div>
<div style="margin-top: 0px; margin-bottom: 0px;">Sanne</div>
</span></font></div>
</div>
</div>
</div>
<p></p>
</div>
</body>
</html>