<div dir="ltr">On Thu, Aug 22, 2013 at 10:46 AM, Kim Gräsman <span dir="ltr"><<a href="mailto:kim.grasman@gmail.com" target="_blank">kim.grasman@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Manuel,<br>
<div><div class="h5"><br>
On Thu, Aug 22, 2013 at 10:21 AM, Manuel Klimek <<a href="mailto:klimek@google.com">klimek@google.com</a>> wrote:<br>
> On Wed, Aug 21, 2013 at 10:20 PM, Kim Gräsman <<a href="mailto:kim.grasman@gmail.com">kim.grasman@gmail.com</a>> wrote:<br>
>><br>
>> Hi Manuel,<br>
>><br>
>> On Wed, Aug 21, 2013 at 3:15 PM, Manuel Klimek <<a href="mailto:klimek@google.com">klimek@google.com</a>> wrote:<br>
>> > On Wed, Aug 21, 2013 at 3:06 PM, Kim Gräsman <<a href="mailto:kim.grasman@gmail.com">kim.grasman@gmail.com</a>><br>
>> > wrote:<br>
>> >><br>
>> >> I've wanted to add compilation database support, but the way tooling<br>
>> >> is wired it seems I need to extract compilation db and source paths<br>
>> >> from the command-line and pass them to ClangTool::ClangTool. The<br>
>> >> compilation db is (sort of) handled by FixedCompilationDatabase, but<br>
>> >> it seems the source paths are assumed to be tool arguments, not Clang<br>
>> >> arguments.<br>
>> ><br>
>> ><br>
>> > Use a clang plugin if you want to run as part of a build. The code that<br>
>> > has<br>
>> > your main logic is basically the same, and you can use ASTMatchers and<br>
>> > other<br>
>> > stuff from tooling in your clang plugin just fine.<br>
>><br>
>> Thanks, but this tool already exists:<br>
>> <a href="http://code.google.com/p/include-what-you-use" target="_blank">http://code.google.com/p/include-what-you-use</a><br>
>><br>
>> and we'd like to have it act either as part of a build or stand-alone<br>
>> with a compilation database. It seems hard to combine the two,<br>
>> currently.<br>
><br>
> Looking at<br>
> <a href="https://code.google.com/p/include-what-you-use/source/browse/trunk/iwyu.cc#3731" target="_blank">https://code.google.com/p/include-what-you-use/source/browse/trunk/iwyu.cc#3731</a>,<br>
> it seems like it should be fairly straight-forward to pull out the main<br>
> method into its own .cc file, and have 2 .cc files:<br>
> iwyu_main.cc (the current main code)<br>
> iwyu_plugin.cc (a clang plugin that hands a new IwyuAction to clang to run)<br>
<br>
</div></div>Ah, and then build two different binaries out of it? One stand-alone<br>
tool and one Clang plugin dylib? Or can they be combined into the same<br>
binary? That would be my preference, of course, but I can't quite see<br>
the big picture for all the details at this point.<br></blockquote><div><br></div><div>Yes, you'd have one binary and one dylib (which you'd give to clang as plugin during the normal build).</div><div>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.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
> Please let me know if I'm missing something...<br>
<br>
</div>If anybody's missing something, it's probably me :-)<br>
<br>
Thanks,<br>
- Kim<br>
</blockquote></div><br></div></div>