[PATCH] Header dependencies support for modularize

Manuel Klimek klimek at google.com
Thu Aug 22 02:38:53 PDT 2013


On Thu, Aug 22, 2013 at 10:46 AM, Kim Gräsman <kim.grasman at gmail.com> wrote:

> Hi Manuel,
>
> On Thu, Aug 22, 2013 at 10:21 AM, Manuel Klimek <klimek at google.com> wrote:
> > On Wed, Aug 21, 2013 at 10:20 PM, Kim Gräsman <kim.grasman at gmail.com>
> wrote:
> >>
> >> Hi Manuel,
> >>
> >> On Wed, Aug 21, 2013 at 3:15 PM, Manuel Klimek <klimek at google.com>
> wrote:
> >> > On Wed, Aug 21, 2013 at 3:06 PM, Kim Gräsman <kim.grasman at gmail.com>
> >> > wrote:
> >> >>
> >> >> I've wanted to add compilation database support, but the way tooling
> >> >> is wired it seems I need to extract compilation db and source paths
> >> >> from the command-line and pass them to ClangTool::ClangTool. The
> >> >> compilation db is (sort of) handled by FixedCompilationDatabase, but
> >> >> it seems the source paths are assumed to be tool arguments, not Clang
> >> >> arguments.
> >> >
> >> >
> >> > Use a clang plugin if you want to run as part of a build. The code
> that
> >> > has
> >> > your main logic is basically the same, and you can use ASTMatchers and
> >> > other
> >> > stuff from tooling in your clang plugin just fine.
> >>
> >> Thanks, but this tool already exists:
> >> http://code.google.com/p/include-what-you-use
> >>
> >> and we'd like to have it act either as part of a build or stand-alone
> >> with a compilation database. It seems hard to combine the two,
> >> currently.
> >
> > Looking at
> >
> https://code.google.com/p/include-what-you-use/source/browse/trunk/iwyu.cc#3731
> ,
> > it seems like it should be fairly straight-forward to pull out the main
> > method into its own .cc file, and have 2 .cc files:
> > iwyu_main.cc (the current main code)
> > iwyu_plugin.cc (a clang plugin that hands a new IwyuAction to clang to
> run)
>
> Ah, and then build two different binaries out of it? One stand-alone
> tool and one Clang plugin dylib? Or can they be combined into the same
> binary? That would be my preference, of course, but I can't quite see
> the big picture for all the details at this point.
>

Yes, you'd have one binary and one dylib (which you'd give to clang as
plugin during the normal build).
The cool thing about that solution is that you can run it next to the build
on every build - you don't need a special tool run.


>
> > Please let me know if I'm missing something...
>
> If anybody's missing something, it's probably me :-)
>
> Thanks,
> - Kim
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130822/ed89b4f2/attachment.html>


More information about the cfe-commits mailing list