<div dir="ltr">On Mon, Jan 21, 2013 at 8:55 AM, 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">I am in the process of writing a rewriter program. In fact, it is almost complete and it uses the clang internal api to process and rewriter a file (I create an ast and use astconsumer and visitor to parse it). Unfortunately, I am unable to find all c++ standard library paths effectively. Some one in this mailing list suggested that I should convert this to a clang tool. By "building separately from clang", I mean that I should be able to keep my tool separate from clang and build and use it separately from clang. The .json file method requires that my tool be present in the clang directory and built along with clang. Is there any other method to build stand-alone tools that compile just like any other clang program.</div>
</blockquote><div><br></div><div style>I'll re-ask the question: why do you need to build your tool separately from clang?</div><div style><br></div><div style>Let me explain why I ask:</div><div style>Any tool that uses clang's internal AST interfaces (as opposed to libclang) is tightly coupled to a clang version anyway. As you noticed, there are for example builtin headers to detect (note that those are different from the standard library; builtin headers are definitions that are compiler specific and will change in lock-step with the compiler code).</div>
<div style><br></div><div style>So, since a clang-AST-based tool will always be tightly coupled to a specific version of clang (unless you use libclang), I do not see what the reason would be to develop it separately from clang. If all you want is to be able to build the tool independently of clang, that's already possible, although probably a bit fiddly. You'll need a "make install" equivalent tree of the clang/llvm build to a directory $prefix, then you set the include search path to $prefix/include/clang and add a library path to $prefix/lib, where you'll find all the static libraries of clang's AST - you can add them so your build picks them up as static libraries, and you should be ready to go. Note that you'll still need to fabricate an installation of your tool where the clang driver is able to locate the builtin headers of the clang you built against - the easiest way to achieve that is to put your binary into $prefix/bin.</div>
<div style><br></div><div style>Cheers,</div><div style>/Manuel</div><div><br></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">
<div class="gmail_quote">On Mon, Jan 21, 2013 at 12:37 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"><div>On Mon, Jan 21, 2013 at 8:31 AM, madil90 <span dir="ltr"><<a href="mailto:madil90@gmail.com" target="_blank">madil90@gmail.com</a>></span> wrote:<br>

</div><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 had a standalone clang program which I am trying to convert to a clang<br>
tool. My basic requirement is that my tool should be able to find all<br>
default c++ paths and that it's build should be kept separate from the clang<br>
source. How can I do this? I tried using the .json file approach but that<br>
does not enable to build my tool separately from clang. Please guide me on<br>
how to write an independent tool (just give the steps. I will figure the<br>
rest out) that can easily find all c++ header files.<br></blockquote><div><br></div><div>Hi Adil,</div><div><br></div><div>I'm not sure what you're looking for - that is, I don't understand what your exact requirements are, and why the .json compilation database didn't work for you. What exactly do you mean with "build separately from clang". And why's that a requirement?</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><span><font color="#888888">
<br>
--<br>
View this message in context: <a href="http://clang-developers.42468.n3.nabble.com/Clang-Tools-tp4029913.html" target="_blank">http://clang-developers.42468.n3.nabble.com/Clang-Tools-tp4029913.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>