<div dir="ltr">On Wed, Aug 21, 2013 at 10:20 PM, 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi Manuel,<br>
<div class="im"><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>> wrote:<br>
>><br>
</div><div class="im">>> 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 has<br>
> your main logic is basically the same, and you can use ASTMatchers and other<br>
> stuff from tooling in your clang plugin just fine.<br>
<br>
</div>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></blockquote><div><br></div><div>Looking at <a href="https://code.google.com/p/include-what-you-use/source/browse/trunk/iwyu.cc#3731">https://code.google.com/p/include-what-you-use/source/browse/trunk/iwyu.cc#3731</a>, 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:</div>
<div>iwyu_main.cc (the current main code)</div><div>iwyu_plugin.cc (a clang plugin that hands a new IwyuAction to clang to run)</div><div><br></div><div>Please let me know if I'm missing something...</div><div><br></div>
<div>Cheers,</div><div>/Manuel</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
I'm interested in the Tooling approach because it would cut lots of<br>
boilerplate from our setup and make us less exposed to driver changes.<br>
<span class=""><font color="#888888"><br>
- Kim<br>
</font></span></blockquote></div><br></div></div>