<div dir="ltr">On Thu, Apr 18, 2013 at 6:15 PM, Jonathan Anderson <span dir="ltr"><<a href="mailto:jonathan.anderson@cl.cam.ac.uk" target="_blank">jonathan.anderson@cl.cam.ac.uk</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>
<br>
I've written a Clang tool that does some analysis of a C program and uses the results to guide instrumentation of the resulting LLVM IR. This tool (and the attendant research) wouldn't have happened without Clang, so thanks to all you maintainers! I have encountered one problem, however, which is trivial to fix but seems to be deeply embedded in someone's philosophy of The Way Things Should Be Done.<br>
</blockquote><div><br></div><div style>That would be me :) </div><div style><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
My issue is that Clang and libClangTooling disagree about the name of the C file they operate on: Clang is (quite sensibly) happy to compile "foo.c", but when I run my Clang tool, it is converted to "/Users/jon/Documents/.../myproject/foo.c" (on line 242 of lib/Tooling/Tooling.cpp). Since Clang (the binary) disagrees with Clang (the library), I have to resort to a sed script that strips `pwd` out of my Clang tool's output!<br>
</blockquote><div><br></div><div style>What breaks due to that disagreement?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I can easily modify Tooling.cpp to use the filename passed to libClangTooling, and I would've submitted a patch with this e-mail, but there are tests and document that assume compile_commands.json will always contain absolute filenames. This seems wrong to me: shouldn't the canonical name of a file be whatever was passed to the compiler at the command line? Since tools like clang-check already provide arguments that separate the working directory from filenames, why do we have to refer to absolute filenames in compile_commands.json?<br>
</blockquote><div><br></div><div style>The problem with relative paths is when you get a path handed in, and you're trying to figure out which command line applies to it.</div><div style><br></div><div style>Cheers,</div>
<div style>/Manuel</div><div style> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
Jon<br>
--<br>
Jonathan Anderson<br>
<br>
Research Associate<br>
Computer Laboratory<br>
University of Cambridge<br>
<br>
<a href="mailto:jonathan.anderson@cl.cam.ac.uk">jonathan.anderson@cl.cam.ac.uk</a><br>
<a href="tel:%2B44%201223%20763%20747" value="+441223763747">+44 1223 763 747</a><br>
<br>
<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">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>
</blockquote></div><br></div></div>