<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
Hi Quentin,</p>
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
Thank you for the pointer to BackendConsumer::DiagnosticsHandlerImpl. I'll have to investigate if it would fulfill my requirements.</p>
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
If so, I'd be looking to convert the assembler to use it (and improving it where necessary). Do you happen to know the reasons why the assembler isn't using this bit of LLVM?</p>
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
Thanks! <br>
Sanne </p>
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
<br>
</p>
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
From: Quentin Colombet<br>
Sent: Monday, 13 March, 15:22<br>
Subject: Re: [cfe-dev] [RFC] improvements to LLVM diagnostic infrastructure<br>
To: Sanne Wouda<br>
Cc: llvm-dev@lists.llvm.org, cfe-dev@lists.llvm.org, nd<br>
</p>
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
Hi Sanne, <br>
</p>
<blockquote type="cite">
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
On Mar 13, 2017, at 7:41 AM, Sanne Wouda via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br>
</p>
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
Hi all,<br>
</p>
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
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.<br>
</p>
</blockquote>
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
</p>
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
I am not sure I get what you want to do.</p>
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
That infrastructure already exists as far as I can tell. Look at BackendConsumer::DiagnosticHandlerImpl.<br>
</p>
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
For historical reasons, it is possible the inline assembly stuff does not use it though.<br>
</p>
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
Cheers,</p>
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
-Quentin</p>
<blockquote type="cite">
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
<br>
I plan to add an LLVMDiagnosticsEngine class that takes responsibility for handling diagnostics options (superseding parts of SourceMgr and LLVMContext).<br>
</p>
</blockquote>
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
</p>
<blockquote type="cite">
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
The diagnostics themselves will be defined in TableGen (just like in clang).<br>
</p>
</blockquote>
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
</p>
<blockquote type="cite">
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
<br>
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.<br>
</p>
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
For example in ARMAsmParser.cpp:</p>
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
 </p>
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
        Error(ImmLoc, "invalid immediate shift value");</p>
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
which eventually calls SourceMgr::PrintMessage.<br>
</p>
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
This would change to (incrementally throughout the code-base) :</p>
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
       Diag(ImmLoc, err_arm_invalid_immediate_shift);</p>
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
and pass through LLVMDiagnosticsEngine to get the diagnostic message and severity (defined in TableGen, similar to Diagnostic*Kinds.td in clang).<br>
</p>
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
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.<br>
</p>
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
 </p>
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
I intend to implement the necessary infrastructure and convert a (small) number of diagnostics.  Further conversions can be done incrementally.<br>
</p>
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
Any comments on this approach? Is this the right direction for diagnostics in LLVM? Suggestions more than welcome!<br>
</p>
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
Thanks,</p>
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
Sanne</p>
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</p>
</blockquote>
<p dir="auto" style=" text-align: left; margin-top: 25px; margin-bottom: 25px; font-family: sans-serif; font-size: 11pt; color: black; background-color: white ">
<br>
<br>
</p>
</body>
</html>