[cfe-dev] How to use clang-tidy for smaller projects

Miklos Vajna via cfe-dev cfe-dev at lists.llvm.org
Tue Oct 29 01:12:30 PDT 2019


Hi Robert,

On Mon, Oct 28, 2019 at 08:56:31AM -0500, Robert Underwood via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> Alexander Kornienko's comment about "statically-linked-out-of-tree
> checks" seems to be what I am looking for,  but that isn't really
> documented anywhere that I can find.  I'm just not sure where to start
> on this since several of the headers are internal to
> clang-tools-extra.

My understanding is that creating a libtooling-based standalone tool
that can analyze the AST and emit diagnostics / fixits is not something
that requires clang-tools-extra headers. See the tool template here:

https://github.com/llvm/llvm-project/tree/master/clang-tools-extra/tool-template

If that's too minimal, I while ago I also wrote a toy tool to play with
this, and came up with

https://github.com/vmiklos/vmexam/blob/master/llvm/libtooling/readability-avoid-auto.cxx

That just follows in-tree tools, but is a self-contained example in ~100
lines of code, including AST matchers and emitting fixits (see the
Makefile for an end-to-end demo).

Regards,

Miklos
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: Digital signature
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20191029/5930e6e2/attachment.sig>


More information about the cfe-dev mailing list