[cfe-dev] Ranges for diagnostics

Milian Wolff mail at milianw.de
Fri Jan 24 10:15:06 PST 2014


On Friday 24 January 2014 17:08:53 Dmitri Gribenko wrote:
> On Fri, Jan 24, 2014 at 4:26 PM, Milian Wolff <mail at milianw.de> wrote:
> > Is there a reason why some diagnostics only have a cursor pointing to the
> > beginning of a token, while others are underlined properly?
> 
> I think the reason is that we don't have a policy on this, so in each
> separate case the decision was made by the developer implementing that
> diagnostic.  Do you have any suggestions for consistent guidelines on
> this?

My suggestion would be to always add ranges for relevant tokens to the "top-
level" diagnostics. I.e. to those tokens which the user wrote. Sub-level 
diagnostics such as the candidate functions in the example above, don't need 
the range I guess.

> > Would patches be accepted to add ranges to these diagnostics? Where would
> > I
> > have to look in the codebase?
> 
> This should not be complex.  Given the diagnostic text, find the
> diagnostic name in
> llvm/tools/clang/include/clang/Basic/Diagnostic*.td.  Then, grep for
> the diagnostic name in sources and add the source range to diag()
> call.

Thank you thats helpful!
-- 
Milian Wolff
mail at milianw.de
http://milianw.de



More information about the cfe-dev mailing list