<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Manuel,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">One option would be to let my previous ArgumentsAdjuster patch through.  If you look at my modularize patch, you’ll see that it’s not a pretty solution having
 to know all the clang options that take arguments, as I have to know which options take arguments in order not to mistake an option argument for a file name.  I can’t use the file name extension because the input could be a C++ header with no extension.  It
 seems this might be useful to others as well.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Or, you could just approve my modularize patch.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">-John<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Manuel Klimek [mailto:klimek@google.com]
<br>
<b>Sent:</b> Wednesday, August 21, 2013 6:16 AM<br>
<b>To:</b> Kim Gräsman<br>
<b>Cc:</b> Thompson, John; Sean Silva; cfe-commits@cs.uiuc.edu<br>
<b>Subject:</b> Re: [PATCH] Header dependencies support for modularize<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Wed, Aug 21, 2013 at 3:06 PM, Kim Gräsman <<a href="mailto:kim.grasman@gmail.com" target="_blank">kim.grasman@gmail.com</a>> wrote:<o:p></o:p></p>
<div>
<div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">John,<o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
On Wed, Aug 21, 2013 at 2:48 PM, Thompson, John<br>
<<a href="mailto:John_Thompson@playstation.sony.com">John_Thompson@playstation.sony.com</a>> wrote:<br>
><br>
> This would seem to have a prerequisite that ClangTooling have a OptTable<br>
> somewhere, but there doesn’t seem to be a connection.<br>
><br>
> Now let’s suppose I get past that hurdle, either by creating one myself and<br>
> somehow coercing it to parse the arguments given to ArgumentsAdjuster, how<br>
> do I use libOption to walk the arguments and figure out which command-line<br>
> argument is the source file?<br>
><br>
> Ideally, tooling should have a mechanism to tell me what the source file or<br>
> files are for each command line in the compilation database.  I had a much<br>
> simpler version, but it required I modify ArgumentsAdjuster to be given the<br>
> source file, which the caller had handy, but I couldn’t get that change<br>
> through.<br>
><br>
> Could someone associated with tooling lend a hand and tell me how to get the<br>
> input file from the command lines in the compilation database?<o:p></o:p></p>
</div>
<p class="MsoNormal">I can't help, but I'm struggling with the same thing right now.<br>
<br>
Our tool is originally designed to act as a replacement for clang in<br>
Make build systems, so it accepts the same command-line (plus some<br>
additional, escaped options)<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.<o:p></o:p></p>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">See: <a href="http://clang.llvm.org/docs/Tooling.html">http://clang.llvm.org/docs/Tooling.html</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Cheers,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">/Manuel<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>