[PATCH] Refactored Clang-tidy for better reusability.

Manuel Klimek klimek at google.com
Thu Jan 2 23:11:48 PST 2014


On Fri, Jan 3, 2014 at 2:26 AM, Alexander Kornienko <alexfh at google.com>wrote:

>
> On 2 Jan 2014 20:06, "Manuel Klimek" <klimek at google.com> wrote:
> >
> >
> >   lg.
> >
> >
> > ================
> > Comment at: clang-tidy/ClangTidy.h:107-109
> > @@ +106,5 @@
> > +///
> > +/// FIXME: Ideally we'd want to build a more generic way to use
> > +/// \c FrontendAction based checkers in clang-tidy, but that needs some
> > +/// preparation work first.
> > +class ClangTidyAction : public ASTFrontendAction {
> > ----------------
> > Alexander Kornienko wrote:
> > > Manuel Klimek wrote:
> > > > Why?
> > > I'm not sure what exactly did you mean when writing this, and I was
> thinking already about asking you, if this comment is still applicable.
> > Yea, I don't understand my own fixme any more... Probably we should
> delete it :)
> >
> > ================
> > Comment at: clang-tidy/ClangTidy.h:110
> > @@ +109,3 @@
> > +  /// \brief Returns an action that runs the specified clang-tidy
> checks.
> > +  virtual FrontendAction *create() LLVM_OVERRIDE;
> > +
> > ----------------
> > Cool. One question is whether it's worth having this small function
> (with the trivial class) in here at all. Do we expect this to be called
> outside of clang-tidy itself?
>
> It's already called somewhere in tooling via the FrontendActionFactory
> interface. What would be a better alternative to this?
>

Oh, this is now a FrontendActionFactory? I thought we'd wanted to get an
interface that is free of FrontendAction* stuff.

To me, we have conceptually two parts in clang-tidy:
1. a library interface that provides an ASTConsumer and PPCallbacks to be
used by other clang-based analysis pipelines
2. something to run clang-tidy over a bunch of code

Conceptually, the first one should be as far as I understand completely
independent of anything related to FrontendAction. The second part then
creates a FrontendAction that just runs clang-tidy's ASTConsumer and
PPCallbacks

> >
> >
> > http://llvm-reviews.chandlerc.com/D2481
> >
> > BRANCH
> >   svn
> >
> > ARCANIST PROJECT
> >   clang-tools-extra
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140103/112f47e4/attachment.html>


More information about the cfe-commits mailing list