[cfe-dev] [clang-tidy] Highlight "custom range" in diagnostic of check

Whisperity via cfe-dev cfe-dev at lists.llvm.org
Mon Oct 21 09:31:52 PDT 2019


Hi List!

I'm currently working on a Tidy check which implements interface design
rule from cppcoreguidelines ("avoid adjacent args of same type").

The problem with such a check is two-fold: the highlight of the diagnostic
it should give isn't a singles AST node but a range.
But this->diag only accept a source location.

I'd wish to highlight a "custom" range (from beginning of one node's
sourceloc through the last letter of another node, they appear sequentially
in the source text).

I know fixit replace/delete hint works with ranges, but the diagnostic
itself isn't about something that is trivially fixable with an
automatically generated hint.

How would you go about doing this in a proper and user friendly way?
Putting two notes like "range begins here" and "range ends here" is ugly.

Regards,
Whisperity.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20191021/188fe4a7/attachment.html>


More information about the cfe-dev mailing list