[LLVMdev] [RFC] Add warning capabilities in LLVM.

Bob Wilson bob.wilson at apple.com
Tue Jul 16 21:34:55 PDT 2013


On Jul 16, 2013, at 5:51 PM, Eli Friedman <eli.friedman at gmail.com> wrote:

> On Tue, Jul 16, 2013 at 5:21 PM, Quentin Colombet <qcolombet at apple.com> wrote:
>> ** Advices Needed **
>> 
>> 1. Decide whether or not we want such capabilities (if we do not we may just
>> add sporadically the support for a new warning/group of warning/error).
>> 2. Come up with a plan to implement that (assuming we want it).
> 
> The frontend should be presenting warnings, not the backend; adding a
> hook which provides the appropriate information shouldn't be too hard.
> Warnings coming out of the backend are very difficult to design well,
> so I don't expect we will add many.  Also, keep in mind that the
> information coming out of the backend could be used in other ways; it
> might not make sense for the backend to decide that some piece of
> information should be presented as a warning.  (Consider, for example,
> IDE integration to provide additional information about functions and
> loops on demand.)

I think we definitely need this.  In fact, I tried adding something simple earlier this year but gave up when I realized that the task was bigger than I expected.  We already have a hook for diagnostics that can be easily extended to handle warnings as well as errors (which is what I tried earlier), but the problem is that it is hardwired for inline assembly errors.  To do this right, new warnings really need to be associated with warning groups so that can be controlled from the front-end.

I agree with Eli that there probably won’t be too many of these.  Adding a few new entries to clang’s diagnostic .td files would be fine, except that the backend doesn’t see those.  It seems like we will need something in llvm that defines a set of “backend diagnostics”, along with a table in the frontend to correlate those with the corresponding clang diagnostics.  That seems awkward at best but maybe it’s tolerable as long as there aren’t many of them.

—Bob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130716/b5a97b1e/attachment.html>


More information about the llvm-dev mailing list