[cfe-commits] Improving Diagnostics Documentation: Part 1

Matthieu Monrocq matthieu.monrocq at gmail.com
Fri Apr 15 12:29:02 PDT 2011


Here are two small patches to begin on the road toward improving diagnostics

The goal here is to provide a way for the user, either through libclang, the
clang binary, or the website, to get some documentation for a particular
diagnostic that has been raised during the compilation.

Those two patches implement the first drop:
> Extension of the Diagnotic object with 3 fields: Name (simply the enum
under a char const* form), Brief (a summary of the issue), Explanation (an
extensive explanation of the issue, possibly with various illustrations and
their corrections, in case a single fix-it is not suitable)
> Provide an option in the Driver to activate/deactive printing the name of
the Diagnostic in the error output (active by default), print the Diagnostic
name in the error output (for all but notes), provide a test case for the
option (active/inactive)
> Implement an Index to get back the Diagnostic ID from a name (log2 N
complexity as it's a sorted array, N ~ 2173 in my revision)

*Important*: I do not use the Makefile system, and as such was not able to
check whether this still built. It's kind of a special patch since we
generate a new file with tblgen...

*Important*: As any modification of the tblgen backend, the two patches
(against clang and llvm) are interdependent.

Note: I first tried dropping the "prefix" of the enum (warn_, fatal_,
etc...) however this created conflicts between different diagnostics. I am
not strongly attached to either dropping it or not, but since dropping it
involved renaming some enums, I preferred using the full name for now.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110415/20a3a79c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: llvm_diagnostic_1b.diff
Type: application/octet-stream
Size: 6526 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110415/20a3a79c/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang_diagnostic_1b.diff
Type: application/octet-stream
Size: 20699 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110415/20a3a79c/attachment-0001.obj>

More information about the cfe-commits mailing list