[PATCH] D17807: [clang-tidy] Add "clang-tidy as a clang plugin" skeleton.

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 2 10:42:44 PST 2016


On Wed, Mar 2, 2016 at 10:36 AM, Benjamin Kramer <benny.kra at gmail.com>
wrote:

> In theory yes, in practice that needs a bit of build system tweaking
> to either build clang-tidy into clang or as a shared library. Then it
> can be used like any regular Clang plugin.
>

I haven't looked at this patch in detail - soundds like you're saying here
^ that this patch doesn't make a "regular Clang plugin" for clang-tidy, but
something irregular?


> It will also slow down clang significantly, but I consider that a bug ;)
>

Yeah, that's something I'm a tad concerned about. It seems like the
matchers are convenient for writing but may be sub-optimal
performance-wise. (I don't expect them to ever be as quick as checks built
into Clang - doing the check as we parse the code is hard to beat
performance-wise, but a burden for code maintenance, but hopefully there's
something acceptable on both fronts)


>
> On Wed, Mar 2, 2016 at 6:21 PM, David Blaikie <dblaikie at gmail.com> wrote:
> > Would this also be usable as a way to run clang-tidy checks as part of
> > normal compilation? (some things in clang-tidy aren't there because the
> FP
> > is too high to be a hard error on old codebases (but might be viable
> once a
> > codebase is able to be cleaned up (like several have been with LLVM)) or
> > because they're project specific (either stylistically, or because
> they're
> > about some project specific API))
> >
> > On Wed, Mar 2, 2016 at 6:47 AM, Benjamin Kramer via cfe-commits
> > <cfe-commits at lists.llvm.org> wrote:
> >>
> >> bkramer created this revision.
> >> bkramer added a reviewer: klimek.
> >> bkramer added a subscriber: cfe-commits.
> >>
> >> This doesn't really do much at the moment. You can load it via libclang
> >> and set the -checks via an extra command line argument as illustrated in
> >> the test case. Support for other options (including headers check) is
> >> currently missing. Also when using this with libclang some checks may
> >> not work with the precompiled preamble in place.
> >>
> >> This can be used to easily show clang-tidy warnings in an editor
> >> integration as all that's needed is adding command line flags that are
> >> passed into libclang. Warnings and FixIts are exposed via the existing
> >> CXDiagnostic machinery.
> >>
> >> http://reviews.llvm.org/D17807
> >>
> >> Files:
> >>   clang-tidy/CMakeLists.txt
> >>   clang-tidy/ClangTidyDiagnosticConsumer.h
> >>   clang-tidy/plugin/CMakeLists.txt
> >>   clang-tidy/plugin/ClangTidyPlugin.cpp
> >>   test/clang-tidy/basic.cpp
> >>
> >>
> >> _______________________________________________
> >> cfe-commits mailing list
> >> cfe-commits at lists.llvm.org
> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> >>
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160302/f5cde578/attachment.html>


More information about the cfe-commits mailing list