<div dir="ltr">On Wed, Feb 13, 2013 at 1:26 PM, Mohammad Adil <span dir="ltr"><<a href="mailto:madil90@gmail.com" target="_blank">madil90@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"><div dir="ltr">To parse the command line arguments myself, I used some code from the CommonOptionsParsers constrcutor. I don't understand the sourcePaths population though. How is this list used and how is this populated? I searched through the LLVM source code and found no usage of sourcePaths anywhere? Can you provide a little more detail on how llvm command line parser and the clang parser (options after "--") work?</div>
</blockquote><div><br></div><div style>This has generally nothing to do with the command line parsing.</div><div style><br></div><div style>You need to give the ClangTool a CompilationDatabase. The CommonOptionsParser happens to implement a strategy where it:</div>
<div style>a) tries to load a FixedCompilationDatabase when you specify args after -- on the command line</div><div style>b) tries to auto-detect the compilation database from the path specified via -p</div><div style>c) tries to auto-detect the compilation database from the first source file specified on the command line</div>
<div style><br></div><div style>Cheers,</div><div style>/Manuel</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="gmail_extra"><div><div class="h5"><br><br><div class="gmail_quote">On Wed, Feb 13, 2013 at 5:15 PM, Manuel Klimek <span dir="ltr"><<a href="mailto:klimek@google.com" target="_blank">klimek@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">On Tue, Feb 12, 2013 at 5:34 PM, madil90 <span dir="ltr"><<a href="mailto:madil90@gmail.com" target="_blank">madil90@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,<br>
   I have to run multiple tools in the same code using different set of<br>
arguments for each (different source files). Seperately both tools work<br>
fine. But when I run them both, the source path list in the second tool<br>
contains all the source paths passed to the first tool too. How can I clear<br>
the source path list? e.g.<br>
<br>
CommonOptionsParser parser(size,Args);<br>
ClangTool tool(parser.getCompilations(),parser.getSourcePathList());   //<br>
source is test.cpp<br>
<br>
CommonOptionsParser parser1(size1,Args1);<br>
ClangTool tool2(parser1.getCompilations(),parser.getSourcePathList());<br>
// source is test.cpp and test1.cpp in the above while Args1 contain only<br>
test1.cpp<br>
<br>
    Is there a way to reset the whole toolig structure and run a completely<br>
new tool on a new set of arguments in the same code? (I don't wanna make 4<br>
tools and run them seperately).<br></blockquote><div><br></div><div>Yes, don't use CommonOptionsParser. It is mainly a convenience class to make writing tools easy. If you want two tools with two different argument lists, parse them yourself and hand them to the ClangTool constructors...</div>


<div><br></div><div>Cheers,</div><div>/Manuel</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Regards,<br>
Adil<br>
<br>
<br>
<br><span><font color="#888888">
<br>
--<br>
View this message in context: <a href="http://clang-developers.42468.n3.nabble.com/Clang-Tooling-Run-multiple-tools-with-different-args-tp4030423.html" target="_blank">http://clang-developers.42468.n3.nabble.com/Clang-Tooling-Run-multiple-tools-with-different-args-tp4030423.html</a><br>



Sent from the Clang Developers mailing list archive at Nabble.com.<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</font></span></blockquote></div><br></div></div>
</blockquote></div><br><br clear="all"><div><br></div></div></div><span class="HOEnZb"><font color="#888888">-- <br>Mohammad Adil<div>LUMS SSE</div>
</font></span></div>
</blockquote></div><br></div></div>